Group Abstract Group Abstract

Message Boards Message Boards

Differential equation with trascendental solution

Posted 6 years ago

Hi there, guys! I'm trying to solve a differential equation from which I already have the solution by hand. Also, Mathematica provided me the answer but I encountered a problem. The output is given with the Solve argument, but it cannot be solved due to the structure of the equation. The differential equation I tried to plot is,

$$ \left(e^{2y} - y cos(xy) \right) dx + \left( 2 x e^{2y} -x cox(xy) + 2y \right) dy = 0 $$

I used Dsolve to find the solution. The input and output are shown below.

In[100]:= sol = DSolve[(E^(2 y[x]) - y[x] Cos[x y[x]]) Dt[x] + (2 x E^(2 y[x]) - x Cos[x y[x]] + 2 y[x]) Dt[y[x]] == 0, y[x], x]
Out[100]= Solve[E^(2 y[x]) x - Sin[x y[x]] + y[x]^2 == C[1], y[x]]

The problem is that because it cannot be solved with the Solve function I cannot plot the solutions with my next line,

Plot[Evaluate[y[x] /. sol /. C[1] -> Range[-10, 10]], {x, -10, 10}] 

I would like to know if there is a simple way for plotting the solution curves for this problem. I searched for analogous ED's but I couldn't find one like this on the network neither on the documentation.

Thanks a lot in advance!

Edit:

I found that if I use ContourPlot, then I can obtain the family of curves using the solution of the DE,

ContourPlot[Evaluate[{E^(2 y) x - Sin[x y] + y^2 == c} /. c -> Range[-5, 5]], {x, -5, 5}, {y, -5, 5}]

But I would like to know if there is a way using the first method with the Plot function.

3 Replies

Leonardo,

You can use NDSolve to get the numerical solution and plot that. I notice you do not give the initial conditions, you can use ParametricNDSolve to give different solutions for a variety of starting points.

Regards,

Neil

POSTED BY: Neil Singer

Solve will not give solutions for y in terms of symbolic x, but you get a solution for y when x is numeric:

explicitSol[x_] := 
  y /. Solve[E^(2 y) x - Sin[x y] + y^2 == 2 && 0 < y < 1, y];
Plot[explicitSol[x], {x, 0, 1}]
POSTED BY: Gianluca Gorni

Thanks a lot!

Wasn't what I was looking for, but it helps!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard