Skip to main content

how to calculate the error for the system of ODEs solved by NDSolve

I have solved system of ODEs by using the NDSolve and i want to calculate the error for my system of equations. So far i have calculated error by plotting results of each equation.

  1. Is it the correct way to obtain the error for my problem?
  2. I am not sure the results I got are accurate enough depending upon this error analysis or not? If not, then kindly suggest some other way to calculate the error for my problem.

Many thanks in advance.

My code for sytem of ODEs

s = NDSolve[{x''[t] == -(1/2)*y[t]*x'[t], y''[t] == x'[t], 
   x'[0] == -1 + x[0], y[0] == 0, x[10] == 0, y'[10] == 0}, {x, 
   y}, {t, 20}]

To obtain the error for one of equation is as follows

Plot[(x''[t] + (1/2)*y[t]*x'[t]) /. s, {t, 1, 10}, 
 WorkingPrecision -> 50]

enter image description here

the for my second equation is as follows

Plot[(y''[t] + x'[t]) /. s, {t, 1, 10}, WorkingPrecision -> 50]

enter image description here

sara
  • 83
  • 3