From: Antonio Jimenez Pastor Date: Wed, 10 Jul 2019 13:13:26 +0000 (+0200) Subject: Fixed the _latex_ method for DDFunctions. Now the non-zero elements to X-Git-Url: http://git.risc.jku.at/gitweb/?a=commitdiff_plain;h=fef74222360786cafbc4efa9fae79713b9af8cf0;p=ajpastor%2Fdiff_defined_functions.git Fixed the _latex_ method for DDFunctions. Now the non-zero elements to display in the differential equations are chosen properly. Moreover, we fixed two syntax errors while formating the LaTeX lines. --- diff --git a/ajpastor/dd_functions/ddFunction.py b/ajpastor/dd_functions/ddFunction.py index 0b59ad3..9f3c0ed 100644 --- a/ajpastor/dd_functions/ddFunction.py +++ b/ajpastor/dd_functions/ddFunction.py @@ -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):