Created
February 5, 2018 17:49
-
-
Save renegarcia/2bf2dcb20e77f2df76b369f6bb419b86 to your computer and use it in GitHub Desktop.
How to test the solution to an ordinary differential equation found with sympy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
How to test a ODE in sympy properly. | |
See [http://docs.sympy.org/latest/modules/solvers/ode.html#checkodesol] for more | |
''' | |
import sympy as sp | |
x, h = sp.symbols('x h') | |
eq = sp.diff(h(x), x) - h(x) | |
sols = sp.dsolve(eq) | |
sol = sols.rhs | |
print(sp.checkodesol(eq, sol)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment