Fixed the _latex_ method for DDFunctions. Now the non-zero elements to
authorAntonio Jimenez Pastor <antonio@ebook.dk-compmath.jku.at>
Wed, 10 Jul 2019 13:13:26 +0000 (15:13 +0200)
committerAntonio Jimenez Pastor <antonio@ebook.dk-compmath.jku.at>
Wed, 10 Jul 2019 13:13:26 +0000 (15:13 +0200)
display in the differential equations are chosen properly.

Moreover, we fixed two syntax errors while formating the LaTeX lines.

ajpastor/dd_functions/ddFunction.py

index 0b59ad3..9f3c0ed 100644 (file)
@@ -2524,7 +2524,7 @@ class DDFunction (IntegralDomainElement):
             elif(i == 2):
                 coeffs[i] += "%s''(x)" %c_name;
             else:
-                coeffs[i] += "%s^{(%d)}(x)" %c_name;
+                coeffs[i] += "%s^{(%d)}(x)" %(c_name, i);
                 
         ## Building the final line from the highest order to the minimal
         coeffs.reverse(); sgn.reverse();
@@ -2532,7 +2532,7 @@ class DDFunction (IntegralDomainElement):
         final = "";
         for i in range(len(coeffs)):
             ## If it is a non-zero coefficient
-            if(self[i] != 0):
+            if(self[len(coeffs)-i-1] != 0):
                 ## Adding the sign
                 if(i > 0 or sgn[i] == '-'):
                     final += "%s " %sgn[i];
@@ -2551,7 +2551,7 @@ class DDFunction (IntegralDomainElement):
             elif(i == 2):
                 res += ["f''(0) = %s" %latex(self.getInitialValue(i))];
             else:
-                res += ["f^{(%d)}(0) = %s" %latex(self.getInitialValue(i))];
+                res += ["f^{(%d)}(0) = %s" %(i,latex(self.getInitialValue(i)))];
         return ", ".join(res);        
     
     def _to_command_(self):