Robby - 9 months ago 34

Python Question

How can we derivate a implicit equation in Python 3?

Example

`x^2+y^2=25`

`dy/dx=-x/y`

`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`

Answer

You have the differential equation, so you can rearrange it using solve:

```
solve(sol, diff(y, x, 1))
```