-2
$\begingroup$

I am attempting to make a plot of the solution an ODE. I want to plot the solution using PolarPlot, x is the polar angle in this case. I cannot get Mathematica to make a plot, and I'm not sure where I'm going wrong. I tried going about it this way:

sol = DSolve[r'[x] == Sqrt[-r[x]^2 - 2*A*r[x]^5 + 3*A^[2/3]*r[x]^4], r[0] == 0, r[x], x]
PolarPlot[sol, {x, 0, 8*Pi}] 

but nothing is produced on the graph. Is this wrong?

$\endgroup$
2
  • 4
    $\begingroup$ You cannot ignore the error messages Mathematica puts out and then expect it to work. A^[2/3] is not a valid expression. The expression must be put in curly brackets if you provide a boundary condition. DSolve provides the result as a Rule you cannot plot a rule straight up. Look at the documentation for DSolve and study the examples. $\endgroup$
    – Matariki
    Nov 18, 2013 at 4:14
  • 3
    $\begingroup$ Other than syntax errors, you can't hope to "plot" something if your "A" has no numerical value. Mathematica needs to know the numerical value of "A" to plot the solution. $\endgroup$
    – Nasser
    Nov 18, 2013 at 4:43

2 Answers 2

3
$\begingroup$

If I make an assumption about the value of A, I can get a solution although it's not very pretty. First I solved your ODE with no boundary condition.

sol = With[{A = 2}, 
  DSolve[r'[x] == Sqrt[-r[x]^2 - 2*A*r[x]^5 + 3*A^(2/3)*r[x]^4], r[x], x]]

sol.png

Next I extract an expression that can plotted from the result.

r[x_] = (sol /. x_C -> 0)[[1, 1, 2]];

Finally I make a plot.

Plot[r[x], {x, -1.3, 0.2}]

plot.png

This isn't a polar plot. The domain and range of r[x] is so restricted that I don't think a polar plot displays it well. I further think that it is likely there is something wrong with your formulation of your ODE, but knowing nothing of the background to your problem, this is mere speculation.

$\endgroup$
1
$\begingroup$

The differential equation has constraints on real solutions and the initial condition of r[0]==0 is problematic.

Insights can be obtained by the following:

  1. Checking when derivative has real values:

    w[a_] := N@Reduce[-y^2 + 3 a^(2/3) y^4 - 2 a y^5 >= 0, y]
    
  2. Plotting the function:

    Manipulate[Plot[Sqrt[-y^2 + 3 a^(2/3) y^4 - 2 a y^5], {y, -2, 2}], {a, 0.05,
    20}]
    

    enter image description here

  3. Exploring the shape and domain of real solutions using StreamPlot:

    Manipulate[StreamPlot[{1, Sqrt[-y^2 + 3 a^(2/3) y^4 - 2 a y^5]}, {x, -4, 
    4}, {y, -2, 0}], {a, 0.05, 20}]
    

enter image description here

These issues have contributed to difficulties plotting solutions (as well as syntax errors and failure to specify value for A referred to in comments).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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