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.

431 questions
Filter by
Sorted by
Tagged with
33 views

there is one thing I don’t understand. Is the tolerance to compute the step size updated at each timestep or fixed at all timestep. Also, when we look at the documentation and how the tolerance is ...
49 views

Picard-Lindelöf Theorem applied on an IVP [closed]

Consider the initial value problem: $$u'=f(u,t)=u^2-u^3$$ $$u(0)= 2/a>0$$ where I want the solution in $0 \leq t \leq a$. Does a unique solution exist? And how can I show that? My own attempt/...
61 views

Geometric integrators besides midpoint/Crank-Nicolson?

I have a first-order ODE $$\dot{x} = a(t) \times x, \quad x(0) \in\mathbb{R}^3.$$ with $\|a(t)\| = 1 \;\forall t$. Consequently, $\|x(t)\|=\|x(0)\|$ for all $t>0$. I would like this to be ...
46 views

A boundary value problem - an example [closed]

The matlab code below can solve finite difference method of any boundary value problem. But I am facing some challenges editing the code to suite my taste. For example in the code, you have to create ...
180 views

Prescribing variables as an excitation in Runge-Kutta method

I am using Runge-Kutta to solve a $3 \times 3$ 2nd order linear ODE $$M x'' + C x' + K x = 0$$ and initial conditions are all zeros. Then I prescribe the 2nd variable to follow a given path. As for ...
2k views

2D cross section from 3D surface

I am trying to apply the "restoring force surface" method to a dynamic linear system. The idea behind this method is that, knowing acceleration, displacement, velocity and input force it is possible ...
36 views

Using event function to shift between 2 sets of ODE

I have a bunch of ODEs I am trying to solve using ode45 in MATLAB. I have hidden the details of the equations to keep it simple (so as to build a general algorithm)! \[\frac{dR}{dt}= F_{1}(R,N) \quad\...
82 views

Numerical integrator for $a'(t)=e^{-a(t)}f(t)$

Suppose I know a function $f(t)$ and all its derivatives in $t$ in closed form. Given $a(0)$ and some $t_0>0$, I'm looking for an explicit integrator that can estimate $a(t_0)$, where $a(\cdot)$ ...
128 views

N-body problem with differents solvers (RK2, RK4, Euler symplectic, Stormer-Verlet) : planets drift to infinity

I'm trying to write an integrator for the 2 and 3-body problem. I choose to start from a generalisation to N-body problem so I can just pass my bodies to the same integrator in the two cases. I'm ...
195 views

Speed up solution of a very large system of ODEs

I need to solve many very large systems of first order ODEs, which describe some chemical reactions. The number of variables (in each system) is on the order of $n \sim 10^5$. I am using ALGLIB vector ...
1k views

Constructing explicit Runge Kutta methods of order 9 and higher

Some older books I've seen say that the minimum number of stages of an explicit Runge-Kutta method of a specified order is unknown for orders $\geq 9$. Is this still true? What libraries are there ...
59 views

ODE45 and a variable that assumes multiple values during the timespan

I have tried in different ways to see what happens to voltage V and gating conductances m, n and h when, at time step x, current I switched from 0 to 0.1, and then at time step x + n it gets back to 0....
136 views

Solving Cahn-Hilliard equation using semi-implicit Fourier spectral methods

So, I have written both a C and python code to solve the 2D Cahn-Hilliard equation: $$\frac{\partial c}{\partial t} = \nabla^2\left(c^3 - c - \kappa\nabla^2c\right)$$ ...
49 views

finding boundary conditions when transforming a higher order ode to system of first order ode

given the following ODE: $$\frac{d^{4}w}{dx^{4}} + B\frac{d^{2}w}{dx^{2}} = 1$$ with boundary conditions $w(0) =0 , w(1) = 0,w'(0) = 0,w'(1) = 0$ its possible to solve analytically but I am attempting ...
126 views

How to select initial time step in adaptive time step ODE solver (TR-BDF2)

The Problem I am currently reconstructing a TR-BDF2 scheme which contains the following two stages: \begin{align} y_{n+\gamma} & = y_n + \gamma \frac{h}{2}\left( f_n + f_{n+\gamma} \right) \...
123 views

How to derive the simplified Newton iteration in the TR-BDF2 ODE integration scheme

The Problem The TR-BDF2 explained in this paper [1], is quite a popular numerical scheme used to integrate $\dot{y} = f(t,y)$, consistent of the following two stages: \begin{align} y_{n+\gamma} &...
147 views

Perturbation problem using Runge-Kutta 4

I'm trying to evaluate the perturbations magnitude between 2 body orbiting a central one in three dimensions. In order to do this I need to have an estimate of the error, which I did using Richardson ...
149 views

Drawing saddle node bifurcation diagram for a non-linear ODE in Python

I'm trying to draw the bifurcation diagram of the following ODE, This ODE leads to a saddle-node bifurcation (see wiki) However what I get is not exactly right. There's a lot of "noise" as ...
102 views

Does non-dimensionalizing ODEs affect the stiffness of the equations?

Does non-dimensionalizing ODEs affect the stiffness of the equations? Can it improve the stability of numerical methods like ode45,ode113 in MATLAB? I am trying to solve 2 eqns. which might involve ...
202 views

Comparing numerical solutions with very different time grids

I've read an article (Long-term integrations and stability of planetary orbits in our Solar system) in which the authors solved the problem of the absence of an analytical solution for the solar ...
83 views

Numerically solving the equation of motion for inflation in cosmology

I want to solve the equation of inflation involving a scalar field numerically using Python libraries such as odeint or scipy. ...
329 views

How to set up the differential equation system to speed up computation?

I've set up a system of differential equations, obtained after discretizing pde, in the following way ...
56 views

Solving differential equation by specifying jacobian pattern

This is a follow up to my previous question posted here I'm trying to construct the sparsity pattern of the jacobian matrix to speed up the computation of a large system of odes. The following is the ...
46 views

solving differential equations with jacobian pattern

I'm trying to compare the simulation time for solving a system of differential equations with and without jacobian pattern for a toy model using ode15s in MATLAB. ...
72 views

Maintain unitary time evolution for a nonlinear ODE

I want to solve a nonlinear ODE of matrix $A(t)$ $$\mathrm{i}\dot A = A(t)M(t),\:\mathrm{with}\: M(t)=A^\dagger(t)H(t)A(t)$$ where $H(t)$ and hence $M(t)$ are Hermitian. Therefore, I presume the time ...
161 views

Solve a system of coupled differential equations in Python

I have a system of two coupled differential equations, one is a third-order and the second is second-order. I am looking for a way to solve it in Python. I would be extremely grateful for any advice ...
30 views

Estimating the Jacobian in Harmonic Balance Method

I am trying to solve a set of ODEs using the Harmonic Balance method. In order to do this, I need to compute the Jacobian of the set of equations. However I am very confused regarding the dimensions ...
80 views

“This DAE appears to be of index greater than 1” daeic12 (line76) error code

Hi I am trying to solve a set of pde converted into ODE and DAE using central finite difference method. I have used the MATLAB 'solve' command to determine the coefficients of fictitious nodes for ...
77 views

132 views

Problem with solving coupled ODE and DAE equations with mass matrix (Error using daeic12 (line 77) This DAE appears to be of index greater than 1)

I am trying to solve 6 ODE equations coupled with 1 DAE one. The ODE equations have been discritized in space domain and ode15s MATLAB solver is used to solve the equations in time domain. I have ...
122 views

Conservation of energy test for 2-body problem

I'm trying to implement a C++ code for the evaluation of the solution of an N-body system of ODE. I've started with a 2-body problem just to set the methods ...
57 views

(2) Trying to model a simple second order ODE: Why time-step smaller is not better

This question is related with this other question: Trying to model a simple second order ODE. On this other question, I get some useful comments on why the simulations are so terrible. However, I have ...