Here is a MWE for the problem I have:

NDSolve[{y'[x] == y[x] + x + z[x], y[2] == 1}, y, {x, 2, 4}]

where z is determined by

z x^z Log[z] == 1

which can't be solved for z[x] in simple form.

One possible way is to write ODE for z[x] also and solve the coupled differential equations. But for the actual problem at hand, that takes too long. Any suggestions for a different method to solve for y[x]?


The DAE-functionality of NDSolve can solve your problem:

sol = NDSolve[{y'[x] == y[x] + x + z[x], y[2] == 1,z[x] x^z[x] Log[z[x]] == 1}, {y, z}, {x, 2, 4}]
Plot[{y[x], z[x]} /. sol, {x, 2, 4}]   

enter image description here

| improve this answer | |
  • 1
    $\begingroup$ +1 Recommend that you use Evaluate, i.e., Plot[Evaluate[{y[x], z[x]} /. sol], {x, 2, 4}] $\endgroup$ – Bob Hanlon Apr 4 '19 at 18:09

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.