Fixed bug on conversion.py: error while computing the real value of
authorAntonio-JP <kethewal@gmail.com>
Fri, 5 Apr 2019 15:09:12 +0000 (17:09 +0200)
committerAntonio-JP <kethewal@gmail.com>
Fri, 5 Apr 2019 15:09:12 +0000 (17:09 +0200)
LazyElements due to the substitution method does not delete all variables
from the polynomial if they are not explicitly given.

ajpastor/dd_functions/ddExamples.py
ajpastor/lazy/conversion.py
releases/diff_defined_functions.zip
releases/diff_defined_functions__0.6.zip
releases/old/diff_defined_functions__0.6__19.04.05_17:09:12.zip [new file with mode: 0644]

index 4dbe537..9fb899a 100644 (file)
@@ -53,6 +53,7 @@ def ddExamples(functions = False, names=False):
         ** HYPERGEOMETRIC FUNCTIONS (see chapters 15, 16 in https://dlmf.nist.gov)
             - HypergeometricFunction
             - GenericHypergeometricFunction
+            - Polylogarithms
         ** RICCATI EQUATION (see https://en.wikipedia.org/wiki/Riccati_equation)
             - RiccatiD
         ** MATHIEU TYPE FUNCTIONS (see chapter 28 in https://dlmf.nist.gov)
@@ -1162,6 +1163,23 @@ def GenericHypergeometricFunction(num=[],den=[],init=1):
     ## Return the cached element
     return __CACHED_HYPERGEOMETRIC[(numerator,denominator,initial)];
     
+@cached_function
+def PolylogarithmD(s=1):
+    if((not (s in ZZ)) or s < 1):
+        raise ValueError("The parameter 's' must be a positive integer. Got %d" %s);
+    
+    destiny_ring = DFinite;
+    
+    get_op = lambda p : destiny_ring.default_operator(destiny_ring.base(),p,destiny_ring.base_derivation); 
+    pos_part = prod((get_op([1,x]) for i in range(1,s+2)), get_op([1]));
+    neg_part = prod((get_op([1,x]) for i in range(1,s+1)), get_op([1])).derivative();
+    
+    final_eq = pos_part-neg_part;
+    Li_x = DFinite.element(final_eq, [Integer(1)/(n**s) *factorial(n-1) for n in range(1,s+1)]);
+    result = Li_x*x;
+    result._DDFunction__name = DinamicString("Li(_1;_2)", [str(s), "x"]);
+    return result;
+    
 ###### RICCATI DIFFERENTIAL EQUATION
 ### Basic Riccati differential equation
 @cached_function
index 74cff07..81a8eab 100644 (file)
@@ -302,9 +302,13 @@ class ConversionSystem(object):
         '''
         polynomial = self.poly_ring()(polynomial);
         variables = polynomial.variables();
+        monomials = polynomial.monomials();
+        coefficients = polynomial.coefficients();
 
         if(len(variables) == 0):
             return self.base()(polynomial);
+        
+        return sum([self.base()(coefficients[i])*prod([self.map_of_vars()[str(v)]**monomials[i].degree(v) for v in variables],self.base().one()) for i in range(len(monomials))],self.base().zero());
 
         return self.base()(polynomial(**{str(v) : self.map_of_vars()[str(v)] for v in variables}));
 #        multi = (len(variables) > _sage_const_1 );
index f23ab03..5bcb93b 100644 (file)
Binary files a/releases/diff_defined_functions.zip and b/releases/diff_defined_functions.zip differ
index f23ab03..5bcb93b 100644 (file)
Binary files a/releases/diff_defined_functions__0.6.zip and b/releases/diff_defined_functions__0.6.zip differ
diff --git a/releases/old/diff_defined_functions__0.6__19.04.05_17:09:12.zip b/releases/old/diff_defined_functions__0.6__19.04.05_17:09:12.zip
new file mode 100644 (file)
index 0000000..5bcb93b
Binary files /dev/null and b/releases/old/diff_defined_functions__0.6__19.04.05_17:09:12.zip differ