]> www.ginac.de Git - ginac.git/blobdiff - ginac/add.cpp
- diff() is now only defined on classes ex and basic, where it handles
[ginac.git] / ginac / add.cpp
index 86703ddc2b696fda366eed01d7ddcba3fe18216a..5db2045c6c4f15687f5b3195806e917a37b464da 100644 (file)
@@ -414,6 +414,14 @@ ex add::simplify_ncmul(const exvector & v) const
 
 // protected
 
+/** Implementation of ex::diff() for a sum. It differentiates each term.
+ *  @see ex::diff */
+ex add::derivative(const symbol & s) const
+{
+    // D(a+b+c)=D(a)+D(b)+D(c)
+    return (new add(diffchildren(s)))->setflag(status_flags::dynallocated);
+}
+
 int add::compare_same_type(const basic & other) const
 {
     return inherited::compare_same_type(other);