Skip to content
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

dsolve fix for 1st_exact_Integral #11299

Closed
wants to merge 3 commits into from

Conversation

arihantparsoya
Copy link
Contributor

@arihantparsoya arihantparsoya commented Jun 25, 2016

This is fix for #11290. Prevented substitution of y in the expression.

Output before this PR:

In [15]: dsolve(cos(f(x)) - (x*sin(f(x)) - f(x)**2)*f(x).diff(x), f(x), simplify=False, hint='1st_exact_Integral')
Out[15]:
f(x)
 ⌠
 ⎮   ⎛ 2              ⌠           ⎞      ⌠
 ⎮   ⎜y  - xsin(y) --sin(y) dxdy +cos(f(x)) dx = C₁
 ⎮   ⎝                ⌡           ⎠      ⌡
 ⌡


In [16]: dsolve(cos(f(x)) - (x*sin(f(x)) - f(x)**2)*f(x).diff(x), f(x), simplify=False, hint='1st_exact_Integral').doit()
Out[16]:
 3
f (x)   ⌠
───── +cos(f(x)) dx = C3

Output after this PR:

>>> from sympy import Function, dsolve, cos, sin
>>> from sympy.abc import x
>>> f = Function('f')
>>> pprint(dsolve(cos(f(x)) - (x*sin(f(x)) - f(x)**2)*f(x).diff(x), f(x), simplify=False, hint='1st_exact_Integral'))
⌠                                                     
⎮ ⎛ 2              ⌠           ⎞      ⌠               
⎮ ⎜y  - xsin(y) --sin(y) dxdy +cos(y) dx = C₁
⎮ ⎝                ⌡           ⎠      ⌡               
⌡                                                     
>>> pprint(dsolve(cos(f(x)) - (x*sin(f(x)) - f(x)**2)*f(x).diff(x), f(x), simplify=False, hint='1st_exact_Integral').doit())
 3                
y                 
── + xcos(y) = C3                 

@arihantparsoya
Copy link
Contributor Author

@asmeurer , can you review this?

@asmeurer
Copy link
Member

The final output should use f(x), not y.

@smichr smichr added the PR: author's turn The PR has been reviewed and the author needs to submit more changes. label Jul 1, 2016
@arihantparsoya
Copy link
Contributor Author

@asmeurer , based on the chat on gitter, how can the final answer be Integral(cos(f(x)), x)?

Copy link
Member

@certik certik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this requires some changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: author's turn The PR has been reviewed and the author needs to submit more changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants