Adding a threshold in numerical codes

  • Context: Undergrad 
  • Thread starter Thread starter matteo86bo
  • Start date Start date
  • Tags Tags
    Numerical Threshold
Click For Summary
SUMMARY

The forum discussion centers on the numerical oscillations encountered when implementing a threshold in a mathematical model defined by the piecewise function f(x). Specifically, the issue arises when f(x) transitions from g(x) for x > x_c to 0 for x <= x_c, leading to oscillatory behavior in the solution of the differential equation dx/dt = f(x). The participants agree that this phenomenon is likely due to numerical instability inherent in the computational methods used, rather than a flaw in the mathematical formulation itself.

PREREQUISITES
  • Understanding of piecewise functions and their applications in mathematical modeling.
  • Familiarity with numerical methods for solving differential equations.
  • Knowledge of numerical stability and oscillations in computational algorithms.
  • Experience with grid refinement techniques in numerical simulations.
NEXT STEPS
  • Research techniques to mitigate numerical oscillations in simulations, such as smoothing algorithms.
  • Explore adaptive grid refinement methods to enhance solution accuracy.
  • Learn about the implementation of Runge-Kutta methods for solving differential equations.
  • Investigate the use of finite difference methods and their stability criteria.
USEFUL FOR

Mathematicians, computational scientists, and engineers involved in numerical modeling and simulation who are seeking to improve the stability and accuracy of their computational solutions.

matteo86bo
Messages
56
Reaction score
0
Hi,
I noticed such a strange behavior in my code every time I add a threshold: little oscillation around the threshold value itself.

For example
[tex]f(x) = g(x), x > x_c[/tex]
[tex]f(x) = 0, x <= x_c[/tex]
[tex]\frac{dx}{dt}=f(x)[/tex]

I solve the last equation and I find this oscillation. Can they be removed?
 
Physics news on Phys.org
It sounds like it is a numerical problem. Computer codes are often subject to such difficulties.
 
Yes, I definitely believe it's a numerical problem. I have no improvement if I solve the equation in a thicker grid.
 

Similar threads

  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 41 ·
2
Replies
41
Views
6K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 63 ·
3
Replies
63
Views
5K