How can we derivate a implicit equation in Python 3?
Example x^2+y^2=25
differentiation is: dy/dx=-x/y
, when try this:
from sympy import *
init_printing(use_unicode=True)
x = symbols('x')
y = Function('y')(x)
eq = x**2+y**2-25
sol = diff(eq, x)
print(sol)
But it shows:
2*x + 2*y(x)*Derivative(y(x), x)
How can get -x/y
?
SymPy has the function idiff
which does what you want
In [2]: idiff(x**2+y**2-25, y, x)
Out[2]:
-x
───
y
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With