The order of calculating velocity and position alters the solution?

Click For Summary

Discussion Overview

The discussion revolves around the numerical integration of a spring-mass system using Euler's Algorithm, specifically focusing on how the order of updating position and velocity affects the results. Participants explore the implications of different update sequences on energy conservation and the accuracy of the simulation.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant describes using Euler's Algorithm to solve the differential equation for a spring-mass system and notes differing results based on the order of updating position and velocity.
  • Another participant points out that the calculation of acceleration was not provided, suggesting that the order of updates could lead to different interpretations of the system's behavior.
  • Some participants emphasize the importance of the order in which calculations are performed in numerical methods, indicating that changing the order alters the equations derived from Euler's method.
  • A participant expresses confusion over why energy oscillates in one case while it increases in another, despite both methods being executed under similar conditions.
  • Several participants suggest that discrepancies in results may indicate issues with the time step size or errors in calculations, urging a double-check of the implementation.
  • Discussion includes suggestions to create phase-space plots to visualize the trajectory of the system, which may help clarify the behavior of the numerical integration.
  • One participant notes that the energy is not constant due to the limitations of Euler's Algorithm and expresses intent to compare results with an analytic solution.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the reasons behind the differing behaviors of energy in the two cases. There are multiple competing views regarding the implications of the order of updates and the accuracy of the Euler method.

Contextual Notes

Participants acknowledge that the Euler method is a poor algorithm for this type of problem, and the results may be sensitive to the size of the time step used. There is also recognition that the energy conservation observed in the simulations may not align with theoretical expectations due to numerical errors.

Who May Find This Useful

This discussion may be useful for individuals interested in numerical methods for solving differential equations, particularly in the context of physics simulations involving oscillatory systems.

  • #31
TachyonLord said:
Thank you so much for your suggestion. I appreciate it a lot ! :) By the way, what is the maximum error for this algorithm ?
But I still kinda want to know about the reason for energy having these little disturbances. Thanks again :)
For this scheme, the error is going to be on the order of ##(\Delta t)^2##, compared to ##\Delta t## for the forward Euler scheme.

The explicit difference equations are going to be $$v(t+\Delta t)=\frac{1-(\pi \Delta t)^2}{1+(\pi \Delta t)^2}v(t)-\frac{4\pi^2\Delta t}{1+(\pi \Delta t)^2}x(t)$$
$$x(t+\Delta t)=\frac{\Delta t }{1+(\pi \Delta t)^2}v(t)+\frac{1-(\pi \Delta t)^2}{1+(\pi \Delta t)^2}x(t)$$

Try it. You'll like it.
 
  • Like
Likes   Reactions: TachyonLord
Physics news on Phys.org
  • #32
Have you tried this difference scheme yet? You will find that it exactly conserves energy with no discretization error (and only tiny roundoff error). You will also find that this scheme is much more accurate than forward Euler, for equal values of the time step.
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
1
Views
3K
Replies
15
Views
3K
Replies
7
Views
2K
  • · Replies 5 ·
Replies
5
Views
10K