|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: numerical solution of differential equations
Quote:
I think you may have overlooked my earlier post #24. The attachment shows how to set up the formulas. The Midpoint method is clearly better than either Forward/Forward Euler or Forward/Backward Euler for this IVP. Last edited by Ether : 12-26-2016 at 12:23 AM. |
|
#2
|
||||
|
||||
|
Re: numerical solution of differential equations
I redid the midpoint spreadsheet - now at t=9.96s with dt=0.01s, the error is only 0.96. I replaced the Am column with the Am = sqrt(3*x').
Now to search for a possible explanation... I did find this http://www.physics.drexel.edu/~steve...rs/simple.html My guess would be that for this function, which, on the interval being examined, is concave up always (x'' > 0), the Euler method uses a point from farther back than the midpoint method to determine the slope (beginning of the interval slope vs. mid-interval slope). As it's concave up, the Euler method lags behind the midpoint method in growth, and so grows slower than the actual function by more than the midpoint method. Now to test a method where it uses the end of the interval's slope... |
|
#3
|
||||
|
||||
|
Re: numerical solution of differential equations
Drat... I tried it using the slope at the end of the interval instead of at the beginning, and it turned out to have a tad bit more error compared to the actual function.
|
|
#4
|
|||||
|
|||||
|
Re: numerical solution of differential equations
The key to efficiently numerically solving this sort of differential equation is to understand the size/scale of the various derivatives. If the second derivative is consistently small, a linear (simple Euler) integration can provide a decent prediction at a reasonably large range step. As the second derivative increases, the range step must be reduced and/or the second derivative must be included in the calculation for each range step; midpoint is one way to do this. If the third derivative is large, you need to make the steps even smaller! Fortunately, the importance of the nth derivative is scaled by 1/n!, that is, the reciprocal of n factorial (google Taylor Expansion if you aren't familiar with it).
If you want an extreme case to work with that has a simple analytic solution, try this one: x''(t) = 2x + 2x3The analytic solution is simply: x=tan tUsing a fixed step size in t, and a finite number of terms in the Taylor expansion with Euler-like integration, the numeric solution will never reach infinity, whereas the analytic solution reaches infinity at pi/2. Try to find solutions and step sizes which suitably predict pi/2, based on x being greater than, say, 10100. Last edited by GeeTwo : 12-29-2016 at 12:13 AM. |
|
#5
|
||||
|
||||
|
Re: numerical solution of differential equations
Quote:
You weren't intending to compare that result to the Midpoint method, were you? |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|