]> www.ginac.de Git - ginac.git/blobdiff - ginac/symbol.cpp
- diff() is now only defined on classes ex and basic, where it handles
[ginac.git] / ginac / symbol.cpp
index 43927dc3a3192df4e2780440c9e701b7c3ec0066..1a8ef59cd2a5d0d15f0cd6d2e147c631456b587d 100644 (file)
@@ -259,6 +259,19 @@ ex symbol::subs(const lst & ls, const lst & lr) const
 
 // protected
 
+/** Implementation of ex::diff() for single differentiation of a symbol.
+ *  It returns 1 or 0.
+ *
+ *  @see ex::diff */
+ex symbol::derivative(const symbol & s) const
+{
+    if (compare_same_type(s)) {
+        return _ex0();
+    } else {
+        return _ex1();
+    }
+}
+
 int symbol::compare_same_type(const basic & other) const
 {
     GINAC_ASSERT(is_of_type(other,symbol));