Questions tagged [ode]
Ordinary Differential Equations (ODEs) contain functions of only one independent variable, and one or more of their derivatives with respect to that variable. This tag is intended for questions on modeling phenomena with ODEs, solving ODEs, and other related aspects.
535
questions
0
votes
0
answers
104
views
Nondifferentiable coordinate transforms
Suppose that we have coordinates $u=u(x,y)$ and $v=v(x,y)$ in $\mathbb{R}^2$ so that $v$ is not differentiable when $u(x,y)=u_0$ where $u_0$ is a constant. Can we solve a differential equation, such ...
-2
votes
1
answer
323
views
Writing a Matlab function after calling the ode45 solver
After using ode45 to solve a set of ODEs, I want to write a Matlab function to take the initial conditions x_0 as inputs and gives the final state x_1 at time T as ...
0
votes
0
answers
92
views
How would one discretize the dynamical equations for Kerr spacetime?
Using the Hamiltonian for a test particle in Kerr spacetime, we arrive at the following equations for generalized position and momenta (in natural units, $G = c = M = 1$):
\begin{align}
\dot{r} &= ...
4
votes
1
answer
5k
views
Solving Lotka-Volterra Equations on Python
I'm trying to plot Lotka-Volterra Equations using Python. I am a real beginner when it comes to Python.
I have these two equations:
$$\frac{dR}{dt}=\alpha R-\gamma RF$$ and $$\frac{dF}{dt}=-\beta F+\...
2
votes
1
answer
228
views
Why is $1/r^2$ force law giving spiral trajectory?
I have written a program to solve for Newton's 2nd Law of motion for a given force law, in 2D polar coordinates.
It is known that if the force law is of the form $k/r^2$,we get conic sections as ...
4
votes
1
answer
189
views
What is a dense ODE system? What is a sparse ODE system?
Can you provide a jargon-free (as much as possible) explanation of what is meant by "dense ODE systems", and "sparse ODE systems"?
Some hints I have gotten from Googling:
dense ...
2
votes
1
answer
386
views
Calculating the Strange Attractor of the Duffing Oscillator in C++
I am simultaneously trying to learn computational physics methods, chaos, and C++. I think this is the right site for the question, and I apologise if not.
I started working through Thijssen's ...
0
votes
0
answers
81
views
Why is my numerical solution to a set of ODEs infinite?
I am trying to solve the following linear PDEs
$$\frac{\partial u_x}{\partial x}=-[i\omega b_{||}+\nabla_\perp u_\perp],$$
$$\frac{\partial b_{||}}{\partial x}=-\frac{i}{\omega}\mathcal{L}u_x,$$
$$\...
1
vote
1
answer
112
views
ODE forth-order very stiff equation with large errors
I’m using Mathematica home edition software to numerically solve a specific inflation equation in cosmology. The ODE equation is forth- order, non-linear, stiff. I was using the stiffness switching ...
0
votes
0
answers
39
views
Simulating the response of nonlinear system with stiff differential equations
I want to simulate the response of a nonlinear system given in the following form:
$$ \dot{x_1} = f_1(\bar{x_1})+g_1(\bar{x_1})x_2, \ x_1(0) = 0.2 $$
$$ \dot{x_2} = f_2(\bar{x_2})+g_2(\bar{x_2})x_3, \...
0
votes
1
answer
95
views
MATLAB ode45 doesn't start at initial conditions
I wrote a code in MATLAB to solve a system of differential equations, but my solution doesn't seem to take into consideration the initial conditions I specified. I am not sure how to interpret this ...
1
vote
3
answers
205
views
Runge-Kutta method for an ODE with initial value which is root of denominator
I wrote a code in Fortran to solve this differential equation using RK4 method:
$$
\frac{dy}{dx}=A\sqrt{\frac{B}{y}+\frac{C}{y^2}}
$$
$A$, $B$, and $C$ are some known constants. The problem is that ...
2
votes
1
answer
1k
views
How can I evaluate more accurate energy eigenvalues from Schrodinger equation using shooting method?
I am trying to use the "shooting method" for solving Schrodinger's equation for a reasonably arbitrary potential in 1D. But the eigenvalues so evaluated in the case of potentials that do not have hard ...
2
votes
0
answers
64
views
Solving a complex ODE with large number of variables (>1e6 variables) - best practise?
I have to solve a non-linear ODE of the shape
$$\partial_zA=f(A)$$
with $f$ a non-linear function and $A$ a matrix/vector with >1e6 variables (i.e. $A$ is a matrix with >1000x1000 entries). For each ...
0
votes
1
answer
1k
views
solve_ivp - Overflow encountered in double_scalars
I'm modeling an electron that orbits the nucleus. Of course, charged particles radiate away there energy so it'll crash into the nucleus. My approach has been to to evaluate the coulomb force and add ...
0
votes
0
answers
128
views
Scipy.integrate.odeint is returning curves with almost the same frequency for different damping ratios, shouldn't they be different?
I am trying to solve the ODE for a harmonic oscillator using Scipy's odeint solver for different dampening factors.
I'm using the following code, based off of this example:
...
0
votes
0
answers
2k
views
Solving nonlinear pendulum using Runge-Kutta 4 for smaller steps
I am trying to solve nonlinear pendulum using 4th order Runge-Kutta method for limits between a=0.0 to b=110 seconds and simulated the results to observe the pendulum movement. But when I increase the ...
2
votes
1
answer
2k
views
Vectorised second order ode solving in python
I am trying to write a python program that simulates the motion of a large number of particles by numerically integrating a second order ordinary differential equation. I first split the ODE into two ...
1
vote
1
answer
551
views
Numerical solution of pendulum equation
Given a system of equations:
\begin{align}
&f''(x) = -a \cdot \sin(f(x))\\
&f(0) = b\\
&f'(0) = c
\end{align}
$a, b, c, dt, N$ are arbitrary parameters.
How to get a values of $f(0), f(...
2
votes
0
answers
77
views
Numerical method for harmonic oscillator with jumping constant
Let $k_1 \neq k_2$ be positive reals, $t_0 > 0$ and consider the following Cauchy problem in $[0,+\infty)$:
\begin{cases}
y(t) + k(t)y''(t) = 0 \newline
y(0) = 1/\sqrt{k_1} \newline
y'(0) = 0,
\end{...
2
votes
1
answer
195
views
Solving numerically a linear ODE
I start by saying that I do not have a strong background in numerical analysis, so I may miss some basic things or make trivial mistakes.
Motivated by some problems in digital signal processing, I ...
3
votes
1
answer
452
views
Lambdifying a symbolic matrix in Julia
If I have a symbolic matrix defined as T below, is there any way to lambdify this as function of variables, say σ..., and return ...
6
votes
3
answers
168
views
Coroutines for ODE solvers
Are there any ODE solver packages that use coroutines and yield their results instead of functions and returning?
Briefly, a subroutine in a programming language does some computations, returns a ...
1
vote
1
answer
295
views
When is a dynamical system discrete vs. continuous?
I have a basic question to ask:
Let's say I am reading a paper which gives a good model that consists of a set of ordinary differential equations, with first and second derivatives. Continuity is a ...
0
votes
1
answer
2k
views
integrate.solve_ivp bugged
I am trying to solve an ODE with solve_ivp, but I am getting strange errors.
Documentation: https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.solve_ivp.html
...
2
votes
1
answer
1k
views
Solving ODEs with nonlinear constraints
I'm trying to solve an ODE problem. Let's say $\mathbf{x}(t)$ represents the position of a particle at time $t$, and $\mathbf{u}(\mathbf{x},t)$ is a velocity field defined in Cartesian coordinates on ...
-1
votes
1
answer
480
views
Solving a large system of coupled ode. (Python)
I really have a problem here. I have not found a solution yet. The system I need to solve similar to this:(Basic idea)
$$c_1 = \dfrac{dx}{dr}+y$$
$$c_2 = \dfrac{dy}{dr}+x$$
Both $c_1/ c_2$ are ...
4
votes
1
answer
1k
views
The velocity Verlet method and variable time steps
Does the velocity Verlet handle variable time steps? I found controversial statements about it.
In the paper Skeel, R. D., "Variable Step Size Destabilizes the Stömer/Leapfrog/Verlet Method", BIT ...
1
vote
1
answer
395
views
Numerical integration methods: Explicit vs Semi-Implicit vs Newton-Euler 1, 2 and use in cyclone physics engine
I am trying to understand the difference between explicit Euler and semi-implicit Euler integration, where in explicit Euler the current position is calculated as
$$x_{n+1} = x_n + v_n$$
and semi-...
1
vote
1
answer
132
views
Unexpectedly Slow Convergence Implicit Euler
I'm solving the coupled ODE
$$ \left[\begin{array}{c}x^\prime(z)\\p_x^\prime(z)\end{array}\right] = C(z)\cdot\left[\begin{array}{c}x(z)\\p_x(z)\end{array}\right] = \left[\begin{array}{cc}0& A(z)\\...
4
votes
1
answer
114
views
Parareal for particle simulations
Recently I have stumbled upon this video of M. J. Gander https://www.youtube.com/watch?v=dn5vqN8ezuE
and the coresponding notes that he wrote on Time Parallel Time Integration and I find it a quite ...
3
votes
2
answers
435
views
Solving ODE with "Jumpy" Coefficients
I'm numerically solving a linear coupled ODE of the form
$$y^{\prime}(t) = \hat{M}(t)y(t)=\left[\begin{array}{cc}0& A(t)\\ B(t)& 0\end{array}\right]y(t),$$
and the difficulty I'm running into ...
6
votes
2
answers
15k
views
Solving coupled differential equations in Python, 2nd order
I have a system of coupled differential equations, one of which is second-order. I am looking for a way to solve them in Python. I would be extremely grateful for any advice on how can I do that!
$k$...
1
vote
3
answers
2k
views
Solving coupled ODEs using Runge-Kutta method
I want to solve the following sets of $n$ coupled equations. Initial values of $x_{n}(t)$ and $p_{n}(t)$ are specified.
The problem is, I have an 1D lattice where every particle is bound with ...
3
votes
1
answer
3k
views
Numerical Solution to Rayleigh Plesset Equation in Python
I have been trying to numerically solve the Rayleigh-Plesset equation for a sonoluminescence bubble in Python. You can read about this phenomenon here: https://iopscience.iop.org/article/10.1088/0143-...
2
votes
2
answers
765
views
Solving a 1D diffusion equation with linear and nonlinear source terms
I would like to numerically solve the following equation: $$\frac{\partial \rho (z,t)}{\partial t} = B(N_D \rho (z,t) + \rho(z,t)^2) + D \frac{\partial^2 \rho (z,t)}{\partial z^2}$$
with the boundary ...
3
votes
1
answer
494
views
The Formula of Explicit Runge-Kutta Fourteen order
I need an explicit Runge-Kutta 14th order formula. If you know about some reference that discusses at least 10th order (or higher, since I'm looking for the 14th) of Runge-Kutta and there is ...
4
votes
1
answer
496
views
Recommendation for a fixed-step ODE solver?
My problem involves the solution of a second-order ODE with a fixed-step (input and output). Specifically, this ODE is the radial part of Dirac and Schrödinger equation for a spherical symmetric ...
1
vote
0
answers
181
views
Can't plot correctly precession of perihelion of Mercury in MATLAB using ode45 or ode23
I was trying to plot precession of perihelion of Mercury using matlab. For this I am following a book Computational Physics by Nicholas J. Giordano and Hisao Nakanishi 2nd Edition. In that book ...
1
vote
0
answers
62
views
Using nondimensionalization to solve an ode in MATLAB [duplicate]
I am trying to solve an ode that uses some extremely large numbers and some extremely small numbers, namely
$$
e = 1.6\times 10^{-19}\\
E = 10^6\\
\tau = 6\times 10^{-24}\\
m = 9.1\times 10^{-31}\\
c ...
2
votes
1
answer
74
views
How to store all solutions of an ODE on Matlab for multiple values of a parameter
I would like to solve an ODE for multiple values of the parameter p and most importantly, save all the solutions for all the different values.
Till now, I have ...
0
votes
1
answer
133
views
Why is modeling a physical system with ODEs sufficient?
I've read a few papers in dynamical systems where the model equations are sets of ODEs, with the state space, say, the spatial variables x, y, z, and an angle variable phi all evolving forward in time....
2
votes
1
answer
188
views
How to set up a time-dependant matrix for an ODE to be solved using python?
I want to solve a problem numerically in python like this:
$$
y(t)' = \mathbf{M}(t)y ,\\
y(0) = (1,0,0,0 ...)
$$
where $y$ is an $n$-dimensional vector and $\mathbf{M}(t)$ is a time-dependant $n \...
1
vote
1
answer
110
views
Attempting to perturb ODE when initial condition is equilibrium point does not work
I have the following system of differential equations:
$$ x' = ax- cy + e1 $$
$$y' = by- dx + e2 $$
for variables $x,y$ and parameters $a,b,c,d,e1,e2$.
I'd like to solve this in python, which is ...
2
votes
3
answers
227
views
What is the flaw in my stability analysis?
The ODE $${d^2x\over dt^2}=-kx; k>0$$can be converted in the system of linear equations as
$$\begin{align}
{dx\over dt} & =v\\
{dv\over dt} &= -kx\\
\end{align}$$
Using Euler’s method, ...
2
votes
1
answer
74
views
Numerical solution to parametrized second order ODE with nonuniform coefficients
I am trying to solve numerically the following second order linear ODE:
$a \frac{\partial^2 u}{\partial x^2} + \frac{\partial u}{\partial x} \frac{\partial a}{\partial x} + b u =0$,
on the domain $[...
2
votes
2
answers
121
views
ODE Event detection for calculating multiple roots of continuous sinusoidal equation
I found a paper [1] that has a method for computing rise and set times of a satellite given a closed form solution. It is a complicated sinusoidal function and the paper has a method to calculate a ...
1
vote
1
answer
127
views
How to Break Coupled ODEs down to first order for Runge-Kutta
My question might seem a bit simple. I am trying to solve a system of ODEs using Runge-Kutta method. I am having difficulty breaking down the equations into a system of first order ones required ...
2
votes
1
answer
575
views
Passing data as arguments in ODE45
I need to import data from file in order to describe the structure of a network.
I used the following:
weights = readtable('weights192.txt');
W = weights{:,:};
...
3
votes
2
answers
357
views
ode45 with matrix initial conditions
EDIT: We have a coupled system of 10 ode each. The coupling presents in the last equation. I thought about using a matrix 10 by 2 as initial conditions.
I also followed a similar question with the ...