• Support PF! Buy your school textbooks, materials and every day products Here!

2nd Order Differential Equation with Improved Euler Method (Heun's)

  • #1

Homework Statement


I would like to solve a 2nd Order Differential Equation using the Improved Euler Method. The 2nd ODE is a Mass-Spring-Damper equation. I tried coming up with an solution for the Improved Euler Method, but not entirely sure. Can you help me and have a look if this is correct?
This solution assumes that inital conditions for x and u are known.

Homework Equations


Forced Mass-Spring-Damper equation:

[itex]m\ddot{x} + b\dot{x}+kx = F[/itex]


The Attempt at a Solution



Converting the equation to a pair of first order differential equations:
[itex]u=\dot{x}[/itex]
[itex]\dot{u}=\ddot{x}[/itex]

And thus we have:
[itex]\dot{u}=\frac{1}{m}\left[F-bu-kx\right][/itex]

The forward Euler solution would result in:
[itex]x_{n+1}=x_{n}+dt*u_{n}[/itex]
[itex]u_{n+1}=u_{n}+dt*\dot{u_{n}}=u_{n}+dt*\frac{1}{m}\left[F_{n}-bu_{n}-kx_{n}\right][/itex]

And the Improved Euler solution would be:
[itex]x_{n+1}=x_{n}+dt*u_{n}[/itex]
[itex]u_{n+1}=u_{n}+dt*\dot{u_{n}}=u_{n}+\frac{dt}{2} \left[ \frac{1}{m} \left[F_{n}-bu_{n}-kx_{n}\right]+\frac{1}{m}\left[F_{n+1}-bu_{n+1}-kx_{n+1}\right] \right][/itex]

In the last equation, does the last [itex]F[/itex] needs to be [itex]F_{n+1}[/itex] like I have it?

Thanks a bunch, if you have time to have a look at it!
 

Answers and Replies

  • #2
STEMucator
Homework Helper
2,075
140
Your improved Euler solution looks fine to me. You indeed want the 'n+1'.
 
  • Like
Likes 1 person

Related Threads on 2nd Order Differential Equation with Improved Euler Method (Heun's)

Replies
8
Views
5K
Replies
2
Views
3K
  • Last Post
Replies
6
Views
2K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
3
Views
758
  • Last Post
Replies
4
Views
1K
  • Last Post
Replies
2
Views
440
  • Last Post
Replies
2
Views
1K
Top