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.
543 questions
0
votes
0
answers
64
views
Harmonic Quantum Oscillator ODE Python
So, we have to calculate eigenvalues and eigenfunctions for this one assignment. In short, we are using a Quantum Harmonic Oscillator.
If you want to read the full thing , Here:
The probability ...
2
votes
0
answers
73
views
Simulation of a a simple vehicle with given engine power
I want to write a simple Javascript simulation of a vehicle moving horizontally in a straight line, with drag $F_\mathrm{drag} = -kv$. The engine power is $P_\mathrm{engine}$ (which can be negative) ...
3
votes
2
answers
141
views
Overview of positivity and maximum-principle-preserving numerical schemes for PDEs
I am interested in why and when positivity preserving numerical schemes for PDE are used.
Related: Which methods can ensure that physical quantities remain positive throughout a PDE simulation?
(but ...
4
votes
1
answer
181
views
Why do different ODE solvers give very different solutions to this problem?
I want to simulate the system defined by the following ordinary differential equations with periodic boundary conditions with $N$ lattice sites
\begin{equation}
i\frac{d}{dt}\phi_n = (1 + |\phi_n|^2)\...
0
votes
0
answers
56
views
Is there a reasonably simple solution for nonlinear parameter optimization using c++ objects?
I have a problem under the form of a set of 2 ODE that includes 6 free parameters. I need to optimize these parameters based on experimental results.
So far, basically, I have implemented a C++ object ...
0
votes
0
answers
59
views
Solve beam equation with elastic term using scipy solve_bvp
I want to solve the beam equation with distributed load and elatic term (which depends on how much the beam interact with the terrain) :
$$
EI\frac{d^4w}{dx^4}+k*(w(x)-t(x))=q(x)
$$
where $q(x)$ is a ...
5
votes
1
answer
366
views
Time integration of first-order ODE with higher-order information
Suppose I wish to derive a numerical integrator for the first-order ODE $$x'(t)=F(x(t)).$$ By differentiating both sides of the expression in $t$, I can write a second-order relation also satisfied ...
3
votes
3
answers
168
views
inverse problem of predicting parameters of ODEs driven by data
Consider a system of ODEs
\begin{align}
u' = f(u,v)\\
v' = g(u,v)
\end{align}
with some unknown parameters in $f$ and $g$, where primes denote time derivatives. No data of $u(t)$ or $v(t)$ are ...
6
votes
2
answers
385
views
Order of numerical solver when calculating difference between forwards and backwards solution
I'm working in applied oceanography, where people are sometimes interested in calculating ``backwards trajectories'' of things floating on the ocean, i.e., going backwards in time to figure out where ...
1
vote
1
answer
245
views
ODEs solved by physics-informed neural networks
Is it possible that an ODE (with an IC) solution by physics informed neural networks (PINNs) turns out to be a mixture of several branch solutions of the same bulk ODE but with different ICs, even ...
1
vote
1
answer
133
views
Can I combine the backward and forward euler methods - simialr to modified euler method?
Constructing Modified Euler
Using the same strategy as done in the construction of Modified Euler. Starting from Trapezoidal Method
$$y_1 = y_0 + \dfrac{h}{2}\left(f(x_0,y_0) + f(x_1,y_1)\right)$$
...
0
votes
2
answers
78
views
Raman model equations using RK4
I am trying to solve below ODE equations for Raman model but I am having errors, mostly overflow in multiply and add. Please I need your help. Below is the code I have written so far. I am new to ...
2
votes
1
answer
111
views
From Runge-Kutta Butcher tableau to general linear methods matrices?
I am trying to understand how the relationship between Butcher tables for Runge-Kutta methods and their generalization to general linear methods matrices (by Butcher also).
Runge-Kutta methods can be ...
1
vote
1
answer
116
views
Educational Purpose: How to synchronize chaotic systems
The graph plots the X coordinate of the synchronized Lorenz chaotic system. I am self learning by reading research articles on how to synchronize identical chaotic systems. But as seen from the figure,...
0
votes
1
answer
84
views
ode23, 45, 15s, 15i in matlab for conservative ODEs
Which of ode23, 45, 15s, 15i in matlab are dissipative or anti-dissipative for conservative ODEs?
Do they STAY dissipative or anti-dissipative for ALL conservative ODEs nor not? If not, what about for ...
0
votes
1
answer
90
views
shooting method to compute the interface shape
I am trying to use a shooting method to compute the shape of liquid-gas interface given by the following differential equation:
$$
\frac{d^2 \theta}{ds^2} = \frac{f(\theta)}{h(h + 3\lambda)}
$$
with $\...
1
vote
2
answers
138
views
How to estimate the stage error for Runge kutta method
Consider an ordinary differential equation (ODE) in the form $u_t=g(t,u(t))$ and apply the explicit Runge-Kutta method, as defined by the following Butcher tableau:
$$
\mathrm{RK}(s,p):\begin{array}{c|...
0
votes
1
answer
152
views
How to use a custom OdeSolver in Scipy's solve_ivp
In Scipy's solve_ivp documentation, we see the method argument can be either a string or a user-defined ...
0
votes
1
answer
87
views
Local truncation error of given implicit 1-step scheme
I'm given the 1-step implicit scheme $$y_{n+1} = y_n + \frac{h}{6}[4f(t_n, y_n) + 2f(t_{n+1}, y_{n+1}) + hf'(t_n, y_n)],$$
where $y'(t) = f(t, y)$, and I'm seeking the scheme's local truncation error. ...
2
votes
2
answers
979
views
Numerical implementation of ODE differs largely from analytical solution
I am trying to solve the ODE of a free fall including air resistance.
I therefore defined my ODE as:
def f(v, g, k, m):
return g - k/m * v**2
which in my ...
2
votes
1
answer
218
views
Using Sundials CVODE in MATLAB
I'm currently using ode15s to solve a set of stiff differential equations.
I am trying to use the MATLAB profiler to understand the section of the ode solver code which calls BLAS routines.
Since the ...
0
votes
1
answer
211
views
Using Crank-Nicolson to solve Non-Linear Schrödinger equation in Python
I aim to solve the (non-linear) Schrodinger equation using the Crank-Nicolson method in Python. Here are my two functions.
...
0
votes
0
answers
211
views
Solving system of ODEs, where time derivative approaches infinity due top initial condition
I am trying to solve a problem in python using scipy's solve_ivp. The system of ODEs I am trying to solve is for coupled where I am solving for two time-dependent ...
2
votes
2
answers
555
views
Solving IVP backward in time via python
I'm having difficulty solving an initial value problem (IVP) in Python backwards in time.
The code is at the end of this post.
First, please let me state my simplified problem.
The forward IVP is ...
1
vote
1
answer
108
views
Isolating decaying solutions to nonlinear second-order ode
I need to solve a nonlinear ODE of the form
$$
\frac{d^2 y}{dx^2} + \frac{1}{x}\frac{dy}{dx}-\frac{1}{x^2}\sin(y)\cos(y)+\frac{2}{\alpha}\frac{\sin^2(y)}{x}-\sin(y)=0
$$
numerically, subject to the ...
1
vote
2
answers
1k
views
How should I solve generalized eigenvalue problems in Python? (Orr-Sommerfeld equation)
I am trying to solve the Orr-Sommerfeld equation numerically, using the techniques given in this article. This leads to solving a generalized eigenvalue problem, that is, given two matrices $\mathbf A,...
0
votes
2
answers
180
views
Approximating the solution of a non-linear ODE using Python
This is my first time asking a question here, so please tell me if I have made a mistake or if anything is unclear.
I am working on my high school research project on the motion of a ball falling ...
6
votes
2
answers
826
views
How do people know the classic Lorenz attractor is actually deterministically chaotic at infinite time?
Correct me if I am wrong, but I take it that people actually think the classic Lorenz system is fully characterized, i.e. we know what the attractor looks like and the various fractal dimensions of it,...
5
votes
2
answers
452
views
Choice between DAE or ODE formulation for chemical systems
Consider a simple ODE system describing the evolution of two chemical species undergoing the reaction $A = B$ :
$$ \frac{dn_A}{dt} = - k * n_A $$
$$ \frac{dn_B}{dt} = k * n_A $$
We can discretize ...
1
vote
1
answer
401
views
How can we use the two boundary conditions for the Taylor-Maccoll Equations for Cone Shock Waves?
The Taylor-Maccoll equations below govern the gas dynamics around a supersonic, axially oriented cone.
Using the notation from Anderson's Fundamentals of Aerodynamics, which uses a dimensionless ...
2
votes
0
answers
79
views
Example: Velocity Verlet reduced accuracy
Velocity Verlet is often held to far more accurate than forward Euler while being no more expensive. Technically, this requires some degree of regularity on the potential. But, is there a convincing ...
0
votes
1
answer
65
views
Reverse engineering phase shift and numerical damping
I've been trying to validate the physics behind a particle system framework, but I'm having some difficulties.
A particle system is a set of lumped masses connected by spring-damper elements. Linear ...
2
votes
0
answers
73
views
Order of local error when integrating ODE with discontinous derivatives
I'm working with ODEs, $$\dot{x} = f(x, t),$$ where the (higher) derivatives of the right-hand side have discontinuities. In particular, $f(x, t)$ is obtained by interpolation of discrete samples, and ...
2
votes
1
answer
82
views
Differential Equation with Forced Behavior
I'm attempting to solve a strange differential equation problem. My goal is to know if there are kinds of ODE solver packages to solve this kind of problem.
I'm solving a 1D Partial Differential ...
3
votes
0
answers
105
views
A way to solve nonsmooth stiff ODEs
Let us considered the following ODEs
\begin{align*}
\dfrac{dX}{dt} = F(X), \tag{1.1}
\end{align*}
where the unknown $X\in \mathcal{D} \subset \mathbb{R}^l$ and it can be stiff. These ODEs can be ...
1
vote
1
answer
122
views
Do Explicit Methods Always Require an Analytical Solution
Following some comments from another question I wanted to ask: does an explicit method always require some sort of analytical function/solution?
Let's take Euler for example. You have a function $f$ ...
0
votes
1
answer
197
views
Solve 1st order ODE in using `scipy`
I've been trying to solve the following equation
$$
y(t)=-A\cdot\frac{\mathrm{d} y}{\mathrm{d} t}+B\cdot\left(\frac{\mathrm{d} y}{\mathrm{d} t}\right)^{2}+C
\\
y(t=0)=y_{0}\\
$$
where $A$, $B$, and $C$...
1
vote
0
answers
130
views
System of ODEs with stochastic process
Consider system of ordinary differential equations
$$
\begin{align}
\frac{dx}{dt}&=\sigma(y-x)\\
\frac{dy}{dt}&=\rho x-y-xz\\
\frac{dz}{dt}&=xy-\beta z
\end{align}
$$
with $\sigma=10$, $\...
1
vote
1
answer
97
views
Solving basic barystochrone problem in python
I am trying to solve $\frac{u''}{1+u'^2} - \frac{1}{2(1-u)} = 0$ subject to $u(0)=1, u(1)=0$.
If I understand how to do this properly, I first do the variable substitutions:
$u = y$, $y_1 = y; y_2 = y'...
0
votes
0
answers
87
views
Why do BVP solvers' APIs only allow "unknown" parameters in the derivative and residual functions but not "known" parameters?
I recently needed to solve a second order boundary value problem and noticed that both scipy.integrate.solve_bvp and Matlab's ...
1
vote
1
answer
721
views
Solving a 2nd order complex-valued matrix differential equation in Python
I am trying to solve the following complex-valued matrix differential equation backwards (i.e. not starting at $r=0$, but rather at $r > 0$):
$F'' = 2ikF' + VF$.
Here $F=F(r)$ and $V=V(r)$ are 2x2 ...
0
votes
0
answers
73
views
accelerating solutions of ODEs with close by parameters
Suppose $\mathbf{u}^1\in\mathbb{R}^n$ is an unknown and $\mu^1\in\mathbb{R}$ is a known parameter. Suppose we have solved the non-linear system of equation for $\mathbf{u}^1$ using Newton's iterations....
3
votes
1
answer
247
views
Convergence-test for ODE approximates wrong limit
I am trying to numerically solve a differential equation but I am having trouble getting the convergence test to run properly. The problem is as follows:
Consider an ODE
$$y'(t) \enspace = \enspace f(...
2
votes
2
answers
879
views
Using backward and forward Euler method to solve a certain stiff ODE
When using the backward and forward Euler methods to solve a certain stiff differential equation, what criteria does one look at before drawing the conclusion that one is more stable than the other?
3
votes
1
answer
143
views
Scipy solve_ivp sensitivity to random phase shifts
I am trying to solve a coupled system of ODE's using the solve_ivp function from scipy. The general form of the equation is given via
$$\dot{y}(t) = M(t)y(t).$$
The time dependence of matrix is ...
2
votes
1
answer
929
views
How to extract intermediate calculation results from an SciPy ODE function in python?
I have a bit lengthier ODE function which was simulated by using Scipy solve_ivp function. During this simulation I calculated many parameters but as the output, I am taking out put only some other ...
0
votes
1
answer
237
views
Solve discontinuous ODE with lsode
I am trying to solve a discontinuous ODE using the lsode solver. I tried setting the t_crit parameter to specify the time where the discontinuity is present, but it ...
0
votes
1
answer
404
views
solve_ivp not giving out any output and no error while souple 3 coupled 2nd order ODES
Please, someone tell me what is wrong in my code it does not give any outputs ( No plot nor print).
The code is as below:
...
2
votes
1
answer
2k
views
scipy.optimize.root not converging and RuntimeWarning
I am trying to solve the following problem:
$$ \frac{d^2y}{dx^2}=\sinh(y) $$
Where the boundary conditions are: $y(0)=-1$, and $ \frac{dy(x\rightarrow \infty)}{dx}=0 $. Through central difference ...
0
votes
1
answer
676
views
Passing additional arguments to `odeint` from `torchdiffeq` to solve an IVP
In Python I use the package torchdiffeq (as provided here) to solve initial value problems. Given an arbitrary function ...