Midpoint Euler method, second order system

In summary, the conversation discusses using midpoint Euler to plot a simple system and the issue of solving for u1(n+1) and u2(n+1) in the equations. The solution involves moving all the n+1 terms to the left side and treating the equations as simultaneous linear algebraic equations in two unknowns.
  • #1
pysox
1
0
Hello

I need to plot this simple system:

x'' = -x

using midpoint Euler.

u1 = -x , u2 = -x'

u1' = u2
u2' = -x

u1(n+1) = u1(n) + h*?
u2(n+1) = u2(n) + h*f((1/2)*(u1(n) + u1(n+1))

We don't know u1(n+1). I tried approximating it with u1(n+1) = u1(n) + h*u2(n)

u2(1+i) = u2(i) + h * ((-1/2) * (u1(n) + u1(n+1))

Then we have u2(i+1) and u2(i). A midpoint value is (u2(1+i) - u(i))/2

u1(q+i) = u1(i) + h*midpoint

When i plot this the result is some awful diverging line, not an oscillating function. What is wrong?
 
Physics news on Phys.org
  • #2
If you are using mid-point euler like this, then you need to move all the n+1 terms to the left sides of the two equations, and solve for u1(n+1) and u2(n+1) treating the equations as two simultaneous linear algebraic equations in two unknowns.
 

Related to Midpoint Euler method, second order system

1. What is the Midpoint Euler method?

The Midpoint Euler method is a numerical technique used to approximate the solution of a second order differential equation. It is based on the Euler method, but instead of using the slope at the beginning of the interval, it uses the slope at the midpoint of the interval to calculate the next approximation.

2. How is the Midpoint Euler method derived?

The Midpoint Euler method is derived by approximating the solution of a second order differential equation using a linear approximation at the midpoint of the interval. This linear approximation is then used to calculate the next approximation of the solution.

3. What are the advantages of using the Midpoint Euler method?

The Midpoint Euler method is more accurate than the basic Euler method, as it takes into account the slope at the midpoint of the interval. It also has a better convergence rate, meaning that the approximated solution will approach the true solution faster.

4. Are there any limitations to using the Midpoint Euler method?

Yes, the Midpoint Euler method is limited by the fact that it is still a numerical approximation and not an exact solution. It also requires the differential equation to be well-behaved, otherwise the errors may accumulate and result in a significantly different solution.

5. How do I use the Midpoint Euler method to solve a second order system?

To use the Midpoint Euler method for a second order system, you will need to first convert the system into a set of two first order equations. Then, you can apply the method to each equation separately, using the previous approximation of one equation to calculate the next approximation of the other. By repeating this process, you can approximate the solution for the entire system.

Similar threads

  • Mechanical Engineering
Replies
2
Views
1K
  • Differential Equations
Replies
8
Views
2K
  • Introductory Physics Homework Help
Replies
3
Views
666
  • Engineering and Comp Sci Homework Help
Replies
1
Views
924
Replies
7
Views
2K
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
  • Introductory Physics Homework Help
Replies
6
Views
1K
  • Differential Equations
Replies
5
Views
1K
Replies
28
Views
3K
Back
Top