Midpoint Euler method, second order system

Click For Summary
SUMMARY

The discussion focuses on implementing the midpoint Euler method for a second-order system defined by the differential equation x'' = -x. The user attempts to approximate the system using u1 = -x and u2 = -x', but encounters divergence in the plotted results. The solution involves rearranging the equations to isolate u1(n+1) and u2(n+1) on the left side, treating them as simultaneous linear algebraic equations to achieve stable oscillatory behavior.

PREREQUISITES
  • Understanding of second-order differential equations
  • Familiarity with the midpoint Euler method
  • Knowledge of numerical methods for solving ordinary differential equations
  • Basic linear algebra concepts for solving simultaneous equations
NEXT STEPS
  • Study the derivation and application of the midpoint Euler method in numerical analysis
  • Learn about stability analysis in numerical methods for differential equations
  • Explore alternative numerical methods such as Runge-Kutta for solving second-order systems
  • Investigate the use of MATLAB or Python libraries for plotting and simulating differential equations
USEFUL FOR

Mathematicians, engineers, and students involved in numerical analysis, particularly those working with differential equations and numerical simulations.

pysox
Messages
1
Reaction score
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
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.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 1 ·
Replies
1
Views
961
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 28 ·
Replies
28
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K