Robby - 1 year ago 78

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`

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

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

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

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**