16 votes

Why does the numerical solution of an ODE move away from an unstable equilibrium?

Note that $\pi/2$ is represented in double precision format in a way that is not exactly equal to $\pi/2$. It's only accurate to about 15 digits. Thus you're starting every so slightly away from the ...
Brian Borchers's user avatar
15 votes
Accepted

Is the exponential function, e^x, very expensive to compute in Matlab and harmful to my computer?

Computing the term $e^x$ is definitely significantly more expensive than computing a lower-order polynomial -- say $x^4$. But it may be ten to 100 times more expensive at most, not "crazy" expensive. ...
Wolfgang Bangerth's user avatar
15 votes
Accepted

Why does the numerical solution of an ODE move away from an unstable equilibrium?

I think the two main points have already been made by Brian and Ertxiem: your initial value is an unstable equilibrium and the fact that your numerical computations are never really exact provides the ...
Daniel's user avatar
  • 1,238
13 votes

Energy conservation in RK4 integration scheme in C++

RK4 is not symplectic so it has no guarantee of energy conservation. Especially when solving an N-body problem where two bodies pass by close to each other the energy conservation can be violated ...
helloworld922's user avatar
12 votes
Accepted

ODEs vs DAE vs ADE?

At least one difference is that in a system of ODEs, all the equations are differential, e.g.: $$ \dot{x}=f(x,y)\\ \dot{y}=g(x,y) $$ whereas the definition of DAEs that I'm familiar with includes ...
Bill Barth's user avatar
  • 10.9k
10 votes

Is a divide by zero error an indication of a bad conceptual model?

We should keep in mind that models are just representations of a portion of reality (a narrow portion), therefore a divide by zero error or other mathematical error (negative concentration, for ...
Toulousain's user avatar
8 votes

ODEs vs DAE vs ADE?

Differential-algebraic equations (DAE) are equations of the form $F(t,x,x')=0$, with the unknown function being $x(t)$. So in a way are generalizations of ODEs. A nice place to start is here. On the ...
adhalanay's user avatar
  • 183
8 votes
Accepted

CFL condition in Discontinuous Galerkin schemes

The restrictive CFL of DG schemes typically comes from the combination of high order accuracy and a compact stencil (see this reference for example). The CFL depends on bounding the variational form ...
Jesse Chan's user avatar
  • 3,102
8 votes

In Matlab, how can I be consistent with units?

Just simply by being consistent in all of my code? Yes this is the only way. Matlab or any other programming language does not know about units. They only know about numbers. As an example consider ...
cfdlab's user avatar
  • 2,993
8 votes
Accepted

In Matlab, how can I be consistent with units?

I would say that you have, mainly, two methods: Being consistent in all your code, as already suggested in another answer. For that purpose, I always keep a table like this one with me, since it ...
nicoguaro's user avatar
  • 8,370
8 votes

Difference between phenomenological modeling and mathematical modeling

A phenomenological model is based on observations of a system rather than on physical theory. Other physically based models are based on fundamental physical principles such as Newton's laws of ...
Brian Borchers's user avatar
8 votes
Accepted

What kind of a researcher am I?

Up until a couple of decades ago, science was based on two large pillars. Those were theory and actual physical experiments. It is an exciting time to see a third pillar arise with numerical ...
MPIchael's user avatar
  • 2,627
7 votes

Mathematical test method for the numerical solution of PDEs?

You should also read about the Method of Manufactured Solutions (PDF) which will show you how to generate analytical solutions to your problem.
Bill Barth's user avatar
  • 10.9k
7 votes
Accepted

Numerical solution of Geodesic differential equations with Python

The reason the resulting geodesic curve was deviating was because the calculated Christoffel symbol of second kind was incorrect. Using the correct Christoffel symbol : ...
imranal's user avatar
  • 425
7 votes

Physics Simulation in C++

I think you are missing a very important and crucial step that lies exactly between the physics and simulation: the mathematical model. In order to model any physics, one has to formulate the ...
Anton Menshov's user avatar
  • 8,602
7 votes

Specifying ode solver options to speed up compute time

Julia's DifferentialEquations.jl has a lot of tooling for automatically deriving (sparse) matrices. For more information, see the JuliaCon 2020 video on Auto-Optimization and Parallelism in ...
Chris Rackauckas's user avatar
7 votes

Energy conservation in RK4 integration scheme in C++

Main error As I pointed out in the previous questions of this series RK4 integration of the three-bodies problem with C++ the primary problem is that the methods are not implemented correctly. The ...
Lutz Lehmann's user avatar
  • 5,509
6 votes

Very simple (real) experiment for computational methods class

Trace the arc of a ping pong ball you are shooting through the room using a slingshot. The equations that describe this are trivial (gravity acts downward, friction acts in the opposite direction of ...
Wolfgang Bangerth's user avatar
6 votes

How to discretize the surface of a prolate spheroid?

A spheroid is really just a sphere that has been squashed in the different coordinate directions. So to get a mesh for a spheroid is the same as getting a mesh for a sphere: start with the latter, ...
Wolfgang Bangerth's user avatar
6 votes

Scaling/nondimensionalization for numerical optimization

One thing that makes your non-dimensionalized ODE confusing is that you use the same symbols for dimensionalized and nondimensionalized variables, even though they are different variables. Consider ...
Kirill's user avatar
  • 11.4k
6 votes

How does one calculate reaction force in FEA?

To calculate the reaction forces at a node, Abaqus (or any structural FE code) simply sums the internal forces for all elements attached to that node. The reaction forces are the negative of that sum. ...
Bill Greene's user avatar
  • 5,974
6 votes
Accepted

Solving for a set of coupled ODEs to get correct variable values

The function $q(e)$ satisfies a first order linear ODE $$ \frac{\mathrm{d}q}{\mathrm{d}e} = \frac{111 e^4+876 e^2+288}{(e^2-1) (121 e^2+304)} q(e), $$ which can be solved very easily by using an ...
Kirill's user avatar
  • 11.4k
6 votes

How to simulate over 1 billion particles?

A first step, if you "have never been up in computing", is to read the literature and see what others are doing and have done. The second step is that you will likely learn that what you want to do ...
Wolfgang Bangerth's user avatar
6 votes
Accepted

What numerical methods are used to model deformations in elastic physics?

It seems that the type of algorithms differ considerably depending on whether the problem is: Quasistatic elastic or Hyperelastic In the quasistatic elastic case, a simple approach is the following: ...
123's user avatar
  • 206
6 votes
Accepted

Finite difference methods in cylindrical and spherical co-ordinate systems

There are basically two methods: You can disrectize the angular part via grid points, or you can discretize it via basis expansion. I will focus on spherical symmetry here, the cylindrical case is ...
6 votes
Accepted

How does non-dimensionalization improve the behavior of ODE solvers?

Background Let’s have a brief look at what parameters an integrator typically has and what they are used for. All of them govern step-size adaption: Relative tolerance (...
Wrzlprmft's user avatar
  • 2,022
6 votes
Accepted

What are good particle dynamics ODEs for an introductory scientific computing course?

For a single particle, interesting dynamics already arise if you are in magnetic and electric fields. The situation becomes even more interesting if you consider several particles at once and how they ...
Wolfgang Bangerth's user avatar
6 votes

What are good particle dynamics ODEs for an introductory scientific computing course?

One very educational example is the Lodka-Volterra system. It can describe the observed effects of predator and prey population levels in many ecological system (foxes & rabbits). High populance ...
MPIchael's user avatar
  • 2,627
6 votes
Accepted

Using backward and forward Euler method to solve a certain stiff ODE

General observations Convergence If $L$ is a Lipschitz constant for the system that is valid for the medium term, then with $Lh\le 1$ both methods give with good probability (but not certainty) ...
Lutz Lehmann's user avatar
  • 5,509
5 votes
Accepted

Why is this method for simulating a system of springs and masses unstable?

The implicit Euler method is unconditionally stable alright, but what you are doing is not the implicit Euler method. Rather, what you do is compute where the particle would be at the end of the time ...
Wolfgang Bangerth's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible