I'm really new to Mathematica, so bear with me here. I'm trying to solve an initial value problem given the first derivative of a function: y' = (y^2+2y+1)/(x^2-2x-1). I understand how the method works, but I'm trying to use Mathematica to help me figure out the derivatives of the function. I'm able to find the derivative of the first derivative using the code:

Dt[(y^2 + 2 y + 1)/(x^2 - 2 x - 1), x];
% /. Dt[y, x] -> yp

which gives me

-(((-2 + 2 x) (1 + 2 y + y^2))/(-1 - 2 x + x^2)^2) + (2 yp + 2 y yp)/(-1 - 2 x + x^2)

What I'm stuck on is then substituting the original y' back into this equation for yp, so I can then take the derivative of it again (and then one more time for a 4th order Taylor Method initial value problem). Is it a matter of defining a function so I can then reference it again and then substitute it for yp in the second derivative that I've found? Any help would be appreciated. Thanks.

  • 1
    $\begingroup$ You may want to read this post. $\endgroup$
    – xzczd
    Apr 4, 2018 at 17:41

1 Answer 1


Why not explicitely indicating that y depends on x and using

D[(y[x]^2 + 2 y[x] + 1)/(x^2 - 2 x - 1), x]

Higher order derivatives can be obtained, e.g., by

D[(y[x]^2 + 2 y[x] + 1)/(x^2 - 2 x - 1), {x,4}]

And you obtain the full 4th-order Taylor polynomial around the point 0 with

Normal@Series[(y[x]^2 + 2 y[x] + 1)/(x^2 - 2 x - 1), {x, 0, 4}]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.