Message Boards Message Boards

GROUPS:

Save output data after solving second order differential equation?

Posted 14 days ago
57 Views
|
0 Replies
|
0 Total Likes
|

Hello, first time I am using Mathematica, I tried to solve second order coupled differential equation but I don't know how to save the output data from this solution! Would you please help me! Here is my code:

m = 9.1*(10)^(-31)
q = 1.6*(10)^(-19)
Er = 14116.83261708455 
Ep = 0
Ez = 4609.405077963418 
Br = 0.2226 (10)^(-4)
Bp = 0
Bz = 0.1825*(10)^(-4)


s = NDSolve[{r''[t] - (q/m)* (Er + p'[t] * Bz - z'[t] * Bp) == 0, 
   p''[t] - (q/m) * (Ep - r'[t] * Bz + z'[t] * Br)  == 0, 
   z''[t] - (q/m)* (Ez + r'[t] * Bp - p'[t] * Br) == 0, r[0] == 0, 
   r'[0] == 0, p[0] == 0, p'[0] == 0, z[0] == 0.006, 
   z'[0] == 6.9*(10)^(5)}, {r, p, z}, {t, 0, 10}]
Plot[Evaluate[{r[t], p[t], z[t]} /. s], {t, 0*(10)^(-9), 
  10*(10)^(-9)}, PlotStyle -> Automatic]

I would like to save the output data of r[t], p[t], z[t], t as a text file. Thanks in advance!

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