how can I Plot these Equations?


(x-y[x])y'[x]== x+y[x]


Sol = DSolve[{1/r^2*D[r^2*ψ[r], r] + Subscript[ν, ct] ψ[r] == 0, ψ[r0] == ψ0/(r0^2 Ω)}, 
    ψ[r], r] /. r0 -> 0 /. Subscript[ν, ct] -> 1/λct;
  • 1
    $\begingroup$ Please write your first expression in Mathematica format. Also, if you wish to plot an expression, you must define all constants. Please include their values in your question. $\endgroup$ – bbgodfrey Oct 2 '16 at 14:19
  • $\begingroup$ Welcome! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – user9660 Oct 2 '16 at 15:07
  • $\begingroup$ how did you figure out dsolve and not the even simpler Plot? Plot[ψ[r]/.First@sol /. ψ0->1/.Ω->1/.λct->1,{r,0,1}] $\endgroup$ – george2079 Oct 2 '16 at 15:44
  • $\begingroup$ the first one is a bit more challenging as the solution is given in implicit form. You can use ContourPlot to plot the result $\endgroup$ – george2079 Oct 2 '16 at 15:54
 sol=DSolve[(x-y[x])y'[x]== x+y[x],y[x],x]

enter image description here

 ContourPlot [ Evaluate@(First@sol/.C[1]->0/.y[x]->y) ,{x,0,2}, {y,-1,5}]

enter image description here

ContourPlot [ Evaluate@Table[First@sol/.C[1]->i/.y[x]->y,{i,-2,2 }] ,{x,0,2}, {y,-1,5}]

enter image description here

incidentally, this throws a spurious unable to solve warning.. (yet shows the plot just fine anyway ).

enter image description here

Edit: here is how to do it cleanly..

sol = DSolve[(x - y[x]) y'[x] == x + y[x], y[x], x]
sol = (List @@ sol)[[1]] /.  y[x] -> y  /. C[1] -> i
ContourPlot[Evaluate[Table[sol, {i, -2, 2}]], {x, 0, 2}, {y, -1, 5}]

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.