-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x*f(x).diff(x).diff(x).diff(x) AttributeError: 'Mul' object has no attribute 'p' #16776
Comments
An iterated derivative like Line 1269 in 22e948b
The sum 1 + 1 will be unevaluated because of with evaluate(False) and the unexpected Add expression seems to confuse the algorithm. This could probably be fixed by something like c = Add(c, merged[-1][1], evaluate=True) but I am not sure if that would be worth-while.
|
@satels |
With current master I get a different error: $ isympy -c python
Python console for SymPy 1.10.dev (Python 3.8.5-64-bit) (ground types: python)
These commands were executed:
>>> from __future__ import division
>>> from sympy import *
>>> x, y, z, t = symbols('x y z t')
>>> k, m, n = symbols('k m n', integer=True)
>>> f, g, h = symbols('f g h', cls=Function)
>>> init_printing()
Documentation can be found at https://docs.sympy.org/dev
Python 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(SymPyConsole)
>>> with evaluate(False): x*f(x).diff(x).diff(x).diff(x)
...
Traceback (most recent call last):
File "/Users/enojb/current/sympy/sympy/sympy/core/assumptions.py", line 479, in getit
return self._assumptions[fact]
KeyError: 'zero'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/enojb/current/sympy/sympy/sympy/core/assumptions.py", line 479, in getit
return self._assumptions[fact]
KeyError: 'extended_real'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/enojb/current/sympy/sympy/sympy/core/assumptions.py", line 479, in getit
return self._assumptions[fact]
KeyError: 'integer'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/enojb/current/sympy/sympy/sympy/core/expr.py", line 3544, in diff
return _derivative_dispatch(self, *symbols, **assumptions)
File "/Users/enojb/current/sympy/sympy/sympy/core/function.py", line 1921, in _derivative_dispatch
return Derivative(expr, *variables, **kwargs)
File "/Users/enojb/current/sympy/sympy/sympy/core/function.py", line 1450, in __new__
if obj is not None and obj.is_zero:
File "/Users/enojb/current/sympy/sympy/sympy/core/assumptions.py", line 483, in getit
return _ask(fact, self)
File "/Users/enojb/current/sympy/sympy/sympy/core/assumptions.py", line 526, in _ask
a = evaluate(obj)
File "/Users/enojb/current/sympy/sympy/sympy/core/add.py", line 720, in _eval_is_zero
elif (S.ImaginaryUnit*a).is_extended_real:
File "/Users/enojb/current/sympy/sympy/sympy/core/assumptions.py", line 483, in getit
return _ask(fact, self)
File "/Users/enojb/current/sympy/sympy/sympy/core/assumptions.py", line 538, in _ask
_ask(pk, obj)
File "/Users/enojb/current/sympy/sympy/sympy/core/assumptions.py", line 526, in _ask
a = evaluate(obj)
File "/Users/enojb/current/sympy/sympy/sympy/core/mul.py", line 1599, in _eval_is_odd
is_integer = self.is_integer
File "/Users/enojb/current/sympy/sympy/sympy/core/assumptions.py", line 483, in getit
return _ask(fact, self)
File "/Users/enojb/current/sympy/sympy/sympy/core/assumptions.py", line 538, in _ask
_ask(pk, obj)
File "/Users/enojb/current/sympy/sympy/sympy/core/assumptions.py", line 538, in _ask
_ask(pk, obj)
File "/Users/enojb/current/sympy/sympy/sympy/core/assumptions.py", line 526, in _ask
a = evaluate(obj)
File "/Users/enojb/current/sympy/sympy/sympy/core/mul.py", line 1638, in _eval_is_even
n, d = fraction(self)
File "/Users/enojb/current/sympy/sympy/sympy/simplify/radsimp.py", line 1112, in fraction
return Mul(*numer, evaluate=not exact), Mul(*denom, evaluate=not exact)
File "/Users/enojb/current/sympy/sympy/sympy/core/cache.py", line 70, in wrapper
retval = cfunc(*args, **kwargs)
File "/Users/enojb/current/sympy/sympy/sympy/core/operations.py", line 83, in __new__
c_part, nc_part, order_symbols = cls.flatten(args)
File "/Users/enojb/current/sympy/sympy/sympy/core/mul.py", line 626, in flatten
p, q = neg1e.as_numer_denom()
File "/Users/enojb/current/sympy/sympy/sympy/core/add.py", line 624, in as_numer_denom
denoms, numers = [list(i) for i in zip(*iter(nd.items()))]
ValueError: not enough values to unpack (expected 2, got 0) |
True , I just verified this and the above error persists ! |
When I ran it in a Python 3 Shell I got this monstrosity:
|
I think that under In [8]: with evaluate(False): e = x*Derivative(f(x), (x, 3))
In [9]: e
Out[9]:
3
d
x⋅───(f(x))
3
dx In general It is not intuitive that |
The text was updated successfully, but these errors were encountered: