-
-
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
Derivative ignores evaluate=False
for nested derivative
#16350
Comments
Can you please look my pull request and suggest me changes i need to make? |
@mloubout I am interested to contribute on this issue, is this issue open? |
I think we can't replace |
Can you do |
@mloubout, Could you please explain the question again?I'm a newcomer and I don't have an idea on where to get started (I found the functions.py and the line which is mentioned in issue) and I didn't understand the question. Thanks. |
@mloubout I am getting the following 2 errors: |
I am a beginner in the open source world and I want to work on this issue. Can someone please guide me how can i get started on this? (I already have sympy environment installed locally) |
added return self.func(expr, *variable_count, **kwargs) in last line so that inheritance doesn't break.
Hi, this is labelled as an easy to fix issue and has been open for more than 2 years now. I can see that some progress has been made here, but it hasn't been merged to the master branch or any of the release branches. I would like to fix this and make my first contribution to SymPy. Is this issue still valid and worth fixing? If it is, should I piggyback off of one of the existing PRs or start afresh? |
The issue is still valid and is worth fixing IMO. If one of the existing PRs solves the problem correctly and has reasonable tests then it would be best just to identify which PR that is so that it can be merged. Otherwise it doesn't look like the existing PRs contain substantial amounts of code changes so I don't see any need to piggyback off of them. |
Great! I shall look into the code and do my best to solve the issue, then. |
@oscarbenjamin While analyzing the code and the bug itself, I realized that I don't understand the issue very well. So if we have something of the form As far as I can tell, that is what is already happening. I would greatly appreciate an actual example that I can work with to understand the problem better. |
What currently happens is this: In [27]: f = Function('f')
In [28]: str(Derivative(f(x), x))
Out[28]: 'Derivative(f(x), x)'
In [29]: str(Derivative(Derivative(f(x), x), x))
Out[29]: 'Derivative(f(x), (x, 2))' That's all fine. Differentiating twice can collapse to a single second derivative. However in some situations we don't want that collapse and it should be possible to get that behaviour when using In [30]: str(Derivative(Derivative(f(x), x), x, evaluate=False))
Out[30]: 'Derivative(f(x), (x, 2))' This last example should ideally output: Derivative(Derivative(f(x), x), x) |
Ah, I get it now. Thank you for the clarification! |
Sweet. Sorry for the silence really half to see this fixed. Thanks @faze-geek |
Hello
There is a small issue in
Derivative
that is it is still evaluated n matterevaluate
for nested derivative dues to these lines (1340-1343 incord/functions.py
:This part is highly problematic for inheritance for two reasons:
expression is evaluated AND even if it were decided that this is necessary, the last line should be
return self.func(expr, *variable_count, **kwargs)
so that inheritance doesn't break.cheers
The text was updated successfully, but these errors were encountered: