From: Antonio Jimenez Pastor Date: Tue, 25 Sep 2018 15:51:08 +0000 (+0200) Subject: Changed version to 0.6 (since addition of file toDiffAlgebraic.py) X-Git-Url: http://git.risc.jku.at/gitweb/?a=commitdiff_plain;h=d4e8884953d8ecd4ae35dc146b9a07aecd730a8c;p=ajpastor%2Fdiff_defined_functions.git Changed version to 0.6 (since addition of file toDiffAlgebraic.py) Renamed previous releases to fit with the version Fixed two errors: - Function sequence from ring_w_sequence.py now allows Symbolic Expressions as input - Functions __rsub__ and __rdiv__ now work properly (previously returned wrong results (inversed)) --- diff --git a/ajpastor/dd_functions/ddFunction.py b/ajpastor/dd_functions/ddFunction.py index aa3dbc6..59f1415 100644 --- a/ajpastor/dd_functions/ddFunction.py +++ b/ajpastor/dd_functions/ddFunction.py @@ -2,6 +2,7 @@ from sage.all_cmdline import * # import sage library _sage_const_1en10 = RealNumber('1e-10'); +_sage_const_0 = Integer(0); # Python imports import warnings; @@ -59,7 +60,7 @@ def _aux_derivation(p): R = p.parent(); return derivative(p,R(x)); except Exception: - return 0 ; + return _sage_const_0 ; ##################################################### ### Class for DD-Rings @@ -499,6 +500,7 @@ class DDRing (Ring_w_Sequence, IntegralDomain): dnum = self.base_derivation(num); dden = self.base_derivation(den); el = self.element([dden*num - dnum*den, num*den]); + X = num/den; name = str(X); try: name = X._DDFunction__name; @@ -509,6 +511,7 @@ class DDRing (Ring_w_Sequence, IntegralDomain): try: return self.element([1 ],[], self.base()(X), name=str(X)); except Exception: + print "WHAT??"; return self(str(element)); except TypeError as e: raise TypeError("Cannot cast an element to a DD-Function of (%s):\n\tElement: %s (%s)\n\tReason: %s" %(self, X, type(X), e)); @@ -1381,7 +1384,7 @@ class DDFunction (IntegralDomainElement): ''' ### We check some simplifications: if one of the functions is zero, then we can return directly 0 if ((other.is_null) or (self.is_null)): - return 0 ; + return _sage_const_0 ; if(self.is_one): return other; elif(other.is_one): @@ -1894,13 +1897,13 @@ class DDFunction (IntegralDomainElement): return super(DDFunction,self).__add__(self.__check_symbolic(other)); def __rsub__(self, other): - return super(DDFunction,self).__sub__(self.__check_symbolic(other)); + return (-self) + self.__check_symbolic(other); def __rmul__(self, other): return super(DDFunction,self).__mul__(self.__check_symbolic(other)); def __rdiv__(self, other): - return super(DDFunction,self).__div__(self.__check_symbolic(other)); + return self.inverse * self.__check_symbolic(other); def __iadd__(self, other): return super(DDFunction,self).__add__(self.__check_symbolic(other)); @@ -2032,7 +2035,7 @@ class DDFunction (IntegralDomainElement): ''' Missing method for DDFuntions. ''' - return 0 ; + return _sage_const_0 ; def __str__(self, detail=True): ''' @@ -2510,7 +2513,7 @@ def _get_initial_poly(poly, dic, m): ## Constant case if(poly.is_constant()): if(m > 0): - return 0; + return _sage_const_0; return poly.parent().base()(poly); ## Non-constant polynomial diff --git a/ajpastor/misc/ring_w_sequence.py b/ajpastor/misc/ring_w_sequence.py index cabffdb..1d5bb7e 100644 --- a/ajpastor/misc/ring_w_sequence.py +++ b/ajpastor/misc/ring_w_sequence.py @@ -93,6 +93,9 @@ class Wrap_w_Sequence_Ring (Ring_w_Sequence): def sequence(el, n): R = el.parent(); + if(sage.symbolic.ring.is_SymbolicExpressionRing(R)): + variable = el.variables()[0]; + return el.derivative(variable,n)(**{str(variable):0})/factorial(n); if(not isinstance(R, Ring_w_Sequence)): R = Wrap_w_Sequence_Ring(R); diff --git a/package-version.txt b/package-version.txt index 2eb3c4f..5a2a580 100644 --- a/package-version.txt +++ b/package-version.txt @@ -1 +1 @@ -0.5 +0.6 diff --git a/releases/diff_defined_functions__0.5.zip b/releases/diff_defined_functions__0.5.zip index 221e173..e7b8dd5 100644 Binary files a/releases/diff_defined_functions__0.5.zip and b/releases/diff_defined_functions__0.5.zip differ diff --git a/releases/diff_defined_functions__0.6.zip b/releases/diff_defined_functions__0.6.zip new file mode 100644 index 0000000..dedf9cc Binary files /dev/null and b/releases/diff_defined_functions__0.6.zip differ diff --git a/releases/old/.directory b/releases/old/.directory new file mode 100644 index 0000000..c156c90 --- /dev/null +++ b/releases/old/.directory @@ -0,0 +1,4 @@ +[Dolphin] +Timestamp=2018,9,25,17,47,48 +Version=3 +ViewMode=2 diff --git a/releases/old/diff_defined_functions__0.5__18.08.28_19:14:05.zip b/releases/old/diff_defined_functions__0.5__18.08.28_19:14:05.zip deleted file mode 100644 index aa554ee..0000000 Binary files a/releases/old/diff_defined_functions__0.5__18.08.28_19:14:05.zip and /dev/null differ diff --git a/releases/old/diff_defined_functions__0.5__18.08.29_19:31:34.zip b/releases/old/diff_defined_functions__0.5__18.08.29_19:31:34.zip deleted file mode 100644 index 44dd984..0000000 Binary files a/releases/old/diff_defined_functions__0.5__18.08.29_19:31:34.zip and /dev/null differ diff --git a/releases/old/diff_defined_functions__0.5__18.08.30_15:39:48.zip b/releases/old/diff_defined_functions__0.5__18.08.30_15:39:48.zip deleted file mode 100644 index fe3cab3..0000000 Binary files a/releases/old/diff_defined_functions__0.5__18.08.30_15:39:48.zip and /dev/null differ diff --git a/releases/old/diff_defined_functions__0.5__18.09.03_15:56:33.zip b/releases/old/diff_defined_functions__0.5__18.09.03_15:56:33.zip deleted file mode 100644 index 3ea93cf..0000000 Binary files a/releases/old/diff_defined_functions__0.5__18.09.03_15:56:33.zip and /dev/null differ diff --git a/releases/old/diff_defined_functions__0.5__18.09.04_16:36:11.zip b/releases/old/diff_defined_functions__0.5__18.09.04_16:36:11.zip deleted file mode 100644 index 99472a3..0000000 Binary files a/releases/old/diff_defined_functions__0.5__18.09.04_16:36:11.zip and /dev/null differ diff --git a/releases/old/diff_defined_functions__0.5__18.09.05_11:25:00.zip b/releases/old/diff_defined_functions__0.5__18.09.05_11:25:00.zip deleted file mode 100644 index b255822..0000000 Binary files a/releases/old/diff_defined_functions__0.5__18.09.05_11:25:00.zip and /dev/null differ diff --git a/releases/old/diff_defined_functions__0.5__18.09.11_17:24:39.zip b/releases/old/diff_defined_functions__0.5__18.09.11_17:24:39.zip deleted file mode 100644 index 3509c98..0000000 Binary files a/releases/old/diff_defined_functions__0.5__18.09.11_17:24:39.zip and /dev/null differ diff --git a/releases/old/diff_defined_functions__0.5__18.09.12_16:55:06.zip b/releases/old/diff_defined_functions__0.5__18.09.12_16:55:06.zip deleted file mode 100644 index 3f2414d..0000000 Binary files a/releases/old/diff_defined_functions__0.5__18.09.12_16:55:06.zip and /dev/null differ diff --git a/releases/old/diff_defined_functions__0.5__18.09.13_18:09:17.zip b/releases/old/diff_defined_functions__0.5__18.09.13_18:09:17.zip deleted file mode 100644 index 3bfd8b3..0000000 Binary files a/releases/old/diff_defined_functions__0.5__18.09.13_18:09:17.zip and /dev/null differ diff --git a/releases/old/diff_defined_functions__0.5__18.09.14_14:49:25.zip b/releases/old/diff_defined_functions__0.5__18.09.14_14:49:25.zip deleted file mode 100644 index aee1251..0000000 Binary files a/releases/old/diff_defined_functions__0.5__18.09.14_14:49:25.zip and /dev/null differ diff --git a/releases/old/diff_defined_functions__0.5__18.09.19_10:00:20.zip b/releases/old/diff_defined_functions__0.5__18.09.19_10:00:20.zip deleted file mode 100644 index 914736f..0000000 Binary files a/releases/old/diff_defined_functions__0.5__18.09.19_10:00:20.zip and /dev/null differ diff --git a/releases/old/diff_defined_functions__0.5__18.09.20_17:21:47.zip b/releases/old/diff_defined_functions__0.5__18.09.20_17:21:47.zip deleted file mode 100644 index 221e173..0000000 Binary files a/releases/old/diff_defined_functions__0.5__18.09.20_17:21:47.zip and /dev/null differ diff --git a/releases/old/diff_defined_functions__0.6__18.08.28_19:14:05.zip b/releases/old/diff_defined_functions__0.6__18.08.28_19:14:05.zip new file mode 100644 index 0000000..aa554ee Binary files /dev/null and b/releases/old/diff_defined_functions__0.6__18.08.28_19:14:05.zip differ diff --git a/releases/old/diff_defined_functions__0.6__18.08.29_19:31:34.zip b/releases/old/diff_defined_functions__0.6__18.08.29_19:31:34.zip new file mode 100644 index 0000000..44dd984 Binary files /dev/null and b/releases/old/diff_defined_functions__0.6__18.08.29_19:31:34.zip differ diff --git a/releases/old/diff_defined_functions__0.6__18.08.30_15:39:48.zip b/releases/old/diff_defined_functions__0.6__18.08.30_15:39:48.zip new file mode 100644 index 0000000..fe3cab3 Binary files /dev/null and b/releases/old/diff_defined_functions__0.6__18.08.30_15:39:48.zip differ diff --git a/releases/old/diff_defined_functions__0.6__18.09.03_15:56:33.zip b/releases/old/diff_defined_functions__0.6__18.09.03_15:56:33.zip new file mode 100644 index 0000000..3ea93cf Binary files /dev/null and b/releases/old/diff_defined_functions__0.6__18.09.03_15:56:33.zip differ diff --git a/releases/old/diff_defined_functions__0.6__18.09.04_16:36:11.zip b/releases/old/diff_defined_functions__0.6__18.09.04_16:36:11.zip new file mode 100644 index 0000000..99472a3 Binary files /dev/null and b/releases/old/diff_defined_functions__0.6__18.09.04_16:36:11.zip differ diff --git a/releases/old/diff_defined_functions__0.6__18.09.05_11:25:00.zip b/releases/old/diff_defined_functions__0.6__18.09.05_11:25:00.zip new file mode 100644 index 0000000..b255822 Binary files /dev/null and b/releases/old/diff_defined_functions__0.6__18.09.05_11:25:00.zip differ diff --git a/releases/old/diff_defined_functions__0.6__18.09.11_17:24:39.zip b/releases/old/diff_defined_functions__0.6__18.09.11_17:24:39.zip new file mode 100644 index 0000000..3509c98 Binary files /dev/null and b/releases/old/diff_defined_functions__0.6__18.09.11_17:24:39.zip differ diff --git a/releases/old/diff_defined_functions__0.6__18.09.12_16:55:06.zip b/releases/old/diff_defined_functions__0.6__18.09.12_16:55:06.zip new file mode 100644 index 0000000..3f2414d Binary files /dev/null and b/releases/old/diff_defined_functions__0.6__18.09.12_16:55:06.zip differ diff --git a/releases/old/diff_defined_functions__0.6__18.09.13_18:09:17.zip b/releases/old/diff_defined_functions__0.6__18.09.13_18:09:17.zip new file mode 100644 index 0000000..3bfd8b3 Binary files /dev/null and b/releases/old/diff_defined_functions__0.6__18.09.13_18:09:17.zip differ diff --git a/releases/old/diff_defined_functions__0.6__18.09.14_14:49:25.zip b/releases/old/diff_defined_functions__0.6__18.09.14_14:49:25.zip new file mode 100644 index 0000000..aee1251 Binary files /dev/null and b/releases/old/diff_defined_functions__0.6__18.09.14_14:49:25.zip differ diff --git a/releases/old/diff_defined_functions__0.6__18.09.19_10:00:20.zip b/releases/old/diff_defined_functions__0.6__18.09.19_10:00:20.zip new file mode 100644 index 0000000..914736f Binary files /dev/null and b/releases/old/diff_defined_functions__0.6__18.09.19_10:00:20.zip differ diff --git a/releases/old/diff_defined_functions__0.6__18.09.20_17:21:47.zip b/releases/old/diff_defined_functions__0.6__18.09.20_17:21:47.zip new file mode 100644 index 0000000..221e173 Binary files /dev/null and b/releases/old/diff_defined_functions__0.6__18.09.20_17:21:47.zip differ diff --git a/releases/old/diff_defined_functions__0.6__18.09.25_17:45:42.zip b/releases/old/diff_defined_functions__0.6__18.09.25_17:45:42.zip new file mode 100644 index 0000000..9a93121 Binary files /dev/null and b/releases/old/diff_defined_functions__0.6__18.09.25_17:45:42.zip differ diff --git a/releases/old/diff_defined_functions__0.6__18.09.25_17:46:26.zip b/releases/old/diff_defined_functions__0.6__18.09.25_17:46:26.zip new file mode 100644 index 0000000..dedf9cc Binary files /dev/null and b/releases/old/diff_defined_functions__0.6__18.09.25_17:46:26.zip differ diff --git a/releases/old/diff_defined_functions__0.6__18.09.25_17:51:08.zip b/releases/old/diff_defined_functions__0.6__18.09.25_17:51:08.zip new file mode 100644 index 0000000..dedf9cc Binary files /dev/null and b/releases/old/diff_defined_functions__0.6__18.09.25_17:51:08.zip differ