From: Antonio-JP Date: Fri, 5 Apr 2019 15:09:12 +0000 (+0200) Subject: Fixed bug on conversion.py: error while computing the real value of X-Git-Url: http://git.risc.jku.at/gitweb/?a=commitdiff_plain;h=165b60c72c59e1afb06023fd331f2b45f791de2d;p=ajpastor%2Fdiff_defined_functions.git Fixed bug on conversion.py: error while computing the real value of LazyElements due to the substitution method does not delete all variables from the polynomial if they are not explicitly given. --- diff --git a/ajpastor/dd_functions/ddExamples.py b/ajpastor/dd_functions/ddExamples.py index 4dbe537..9fb899a 100644 --- a/ajpastor/dd_functions/ddExamples.py +++ b/ajpastor/dd_functions/ddExamples.py @@ -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 diff --git a/ajpastor/lazy/conversion.py b/ajpastor/lazy/conversion.py index 74cff07..81a8eab 100644 --- a/ajpastor/lazy/conversion.py +++ b/ajpastor/lazy/conversion.py @@ -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 ); diff --git a/releases/diff_defined_functions.zip b/releases/diff_defined_functions.zip index f23ab03..5bcb93b 100644 Binary files a/releases/diff_defined_functions.zip and b/releases/diff_defined_functions.zip differ diff --git a/releases/diff_defined_functions__0.6.zip b/releases/diff_defined_functions__0.6.zip index f23ab03..5bcb93b 100644 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 index 0000000..5bcb93b Binary files /dev/null and b/releases/old/diff_defined_functions__0.6__19.04.05_17:09:12.zip differ