Message Boards Message Boards

Solve the following differential equations and plot them?

Posted 6 years ago

Good evening, I'm a new user and I just started with Mathematica. I need some help. I study an astrophysics (PhD cand.). In that moment I making calculations, and create code which need to be solved. But now I have problem with graphics. The program does not create it. Maybe something is wrong with program code? I will be grateful for the help.

Program code

solution = NDSolve[{
   x'[t] = u[t]/0.01 Sqrt[u[t]^2 + v[t]^2 + w[t]^2], x[0] == 5.0, 

   y'[t] == v[t]/x (0.01 Sqrt[u[t]^2 + v[t]^2 + w[t]^2]) sin[y], 
   y[0] == 5.0,
   z'[t] == w[t]/x (0.01 Sqrt[u[t]^2 + v[t]^2 + w[t]^2]), 
   z[0] = .00001, 

   u'[t] == 0, u[0] == 0.0,
   v'[t] == 0, 
   01 (x (Sqrt[u[t]^2 + v[t]^2 + w[t]^2]) sin[y] - x[t] - z[t]), 
   v[0] == 0.0,
   w'[t] == 0, 01 y'[t], w[0] == 1.0},
  {x, z, y, u, v, w}, {t, 0, 5, 1700.0},

  MaxSteps -> 1000000000, Method -> ExplicitRungeKutta]
ParametricPlot[Evaluate[{x[t], v[t]} /. solution], {t, 0, 1700}, 
  AxesLabel -> {"10\[Rho]", "p\[Phi]"}];
POSTED BY: Alexey Faust
2 Replies

Thank you! The program became is running.

P.S. Unfortunanely, my program does not creat curves which I need yet...)

POSTED BY: Alexey Faust

After quite some syntax cleaning I got a running version:

solution = NDSolve[
  {x'[t] == u[t]/0.01 Sqrt[u[t]^2 + v[t]^2 + w[t]^2],
   x[0] == 5.0,
   y'[t] == 
    v[t]/x[t] (0.01 Sqrt[u[t]^2 + v[t]^2 + w[t]^2]) Sin[y[t]],
   y[0] == 5.0,
   z'[t] == w[t]/x[t] (0.01 Sqrt[u[t]^2 + v[t]^2 + w[t]^2]),
   z[0] == .00001,
   u'[t] == 0,
   u[0] == 0.0,
   v'[t] == 
    0.01 (x[t] (Sqrt[u[t]^2 + v[t]^2 + w[t]^2]) Sin[y[t]] - x[t] - 
       z[t]),
   v[0] == 0.0,
   w'[t] == 0.01 y'[t],
   w[0] == 1.0},
  {x, z, y, u, v, w}, {t, 0, 5},
  MaxSteps -> 1000000000,
  Method -> {"TimeIntegration" -> "ExplicitRungeKutta"}]
Plot[Evaluate[{x[t], v[t]} /. solution], {t, 0, 5}, 
 AxesLabel -> {"10[Rho]", "p[Phi]"}]

It may not be what you intended.

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

Group Abstract Group Abstract