I was using scipy.integrate.odeint
function , the ode is
$$\frac{y\ dx - x\ dy}{(x+y)^2} + dy = dx$$
with solution
$$y^2 - x^2 - y = c (x + y)\ .$$
Solving it via odeint
from scipy.integrate import odeint
import numpy as np
import matplotlib.pyplot as plt
def dy_dx(y, x):
return ((x+y)**2 - y)/((x+y)**2 - x)
xs = np.linspace(1,100,100)
y0 = 1
ys = odeint(dy_dx, y0, xs ,atol = 2)
ys = np.array(ys).flatten()
plt.plot(xs, ys)
plt.xlabel("x")
plt.ylabel("y")
which certainly doesn't match the answer. What could be going wrong?