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.

Filter by
Sorted by
Tagged with
0
votes
1answer
33 views

Question about scipy’s ivp solver

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 ...
0
votes
0answers
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/...
4
votes
1answer
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 ...
-1
votes
0answers
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 ...
1
vote
1answer
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 ...
3
votes
1answer
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 ...
0
votes
0answers
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\...
0
votes
1answer
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)$ ...
0
votes
1answer
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 ...
-3
votes
2answers
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 ...
11
votes
2answers
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 ...
-1
votes
1answer
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....
2
votes
1answer
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: \begin{equation} \frac{\partial c}{\partial t} = \nabla^2\left(c^3 - c - \kappa\nabla^2c\right) \end{equation} ...
0
votes
1answer
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 ...
2
votes
1answer
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) \...
3
votes
1answer
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} &...
0
votes
1answer
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 ...
1
vote
1answer
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 ...
0
votes
0answers
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 ...
2
votes
1answer
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 ...
0
votes
2answers
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. ...
1
vote
2answers
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 ...
0
votes
1answer
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 ...
1
vote
1answer
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. ...
3
votes
1answer
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 ...
0
votes
2answers
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 ...
0
votes
0answers
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 ...
0
votes
0answers
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 ...
1
vote
1answer
77 views

Is there any way to have a better guess for initial condition of an ODE coupled to CFD as a boundary condition?

I'm doing CFD simulations for blood flow in unstructured grids. My boundary condition at the outlets is called three-element Windkessel which basically calculates the pressure by solving this ODE: $$...
1
vote
2answers
75 views

Efficient ODE steppers with query of $f$ and $\nabla f$ is efficient

Assume we have an IVP $y'(t) = f(t,y)$, and that $\partial_t f$ and $\nabla f$ are cheap to compute. Assume further that more derivatives are not cheap to compute, or inaccessible for some reason, ...
1
vote
0answers
37 views

N-body correct scaling

I realized an usual way to scale an N-body problem for an N-body simulation is by choosing units such that gravitational constant $G = 1$, but I'm probably doing it the wrong way. Suppose I simply ...
4
votes
1answer
123 views

Floating point and global error in Euler Method

Inspired by this answer, I tried to understand when floating point errors come into visibility and to check it also comparing the plot of the numerical solution with Explicit Euler with the analytical ...
0
votes
1answer
100 views

Numerical solution of ill-conditioned differential equation

I want to solve the following Cauchy problem \begin{equation} y' = y^2 + \frac{t^4 - 6t^3 + 12t^2 - 14t + 9}{(1+t)^2} \end{equation} with initial condition: $y(0) = 2$ for $t \in [0,1.6]$ using a 3 ...
3
votes
2answers
160 views

Using the BDF and RK4 methods to solve this coupled system of ODEs in C++

I'm trying to solve a system of ODEs using the BDF order 4 method. I find the first 3 points using RK4, then for the implicit part of the BDF, I use Newton-Raphson iteration. Unfortunately my solution ...
-1
votes
1answer
214 views

ODEintWarning: Excess work done on this call (perhaps wrong Dfun type)

I was messing around with some numerical integration functions. I wrote an arbitrary differential equation to test my understanding, the code is as follows: ...
6
votes
1answer
367 views

Special-case Runge-Kutta methods to exploit structure in linear ODE?

I am interested in numerical solutions of a linear, time-dependent ODE of the form $$ \dot y = A(t)y - Ry, $$ A good model is the following problem in $\mathbb R^2$: $$ A(t) = \begin{bmatrix}0 & -\...
0
votes
0answers
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 ...
0
votes
0answers
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 ...
0
votes
1answer
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 ...
4
votes
2answers
279 views

Trying to model a simple second order ODE

I am studying some computational methods and I am trying to program simples equations to understand how the methods work... Particularly, I am trying to understand how multiorders ODE's work. I've ...
4
votes
1answer
2k views

Switch between 2 equations to be given to ODE using events

I am trying to simulate a system with bilinear stiffness described by the following equations: $25\ddot{x}+15\dot{x}+330000x = p(t)$ if $x < 0.00072$ $25\ddot{x}+15\dot{x}+930000x = p(t)$ if $x &...
0
votes
1answer
76 views

What are the advantages and disadvantages of using norm error control in the MATLAB ODE suit?

In MATLAB's ODE suit, there seem to be two basic methods of controlling the Local Truncation Error (LTE) of the ODE which the user can choose from, namely: The absolute error control (default), ...
3
votes
4answers
136 views

Getting torsion and curvature out of ODE solution skeleton

Suppose I have solved an ODE $v'(t) = f(t,x)$ via some adaptive stepper, such as RK4 or Dormand-Prince, generating a list of points $\{(t_i, v_i, v_i' = f(t_i, v_i))\}_{i=0}^{n-1}$. I wish to use this ...
41
votes
3answers
4k views

What's the state of the art in parallel ODE methods?

I'm currently looking into parallel methods for ODE integration. There is a lot of new and old literature out there describing a wide range of approaches, but I haven't found any recent surveys or ...
2
votes
0answers
84 views

How to derive the adjoint sensitivity equations for a least squares objective function gradient

The Problem I would like to determine the gradient of a least squares objective function which depends on a vector of 40 parameters $p$, and the solution of a system of 32 differential equations. In ...
3
votes
3answers
5k views

How to get ODE solution at specified time points?

The code below basically illustrates my problem. It is a test code for a pendulum. I solve it using a method suggested on https://stackoverflow.com/questions/12926393/using-adaptive-step-sizes-with-...
0
votes
1answer
62 views

If I rescale the time in a differential equation, do I need to adjust the parameters?

Imagine I have a differential equation and I have some data and the model is supposed to fit the data. If I now rescale the time in the range 0 to 1, do I need to adjust the parameters of the ...
1
vote
1answer
106 views

Is there a way to bound the values of a variable when using scipy.integrate.solve_ivp in python?

I want to solve an IVP in python with two variables, x and u, but I need the values of u to be between 0 and 1. Right now it is giving me a solution with negative values for u. Here is the code I have....
2
votes
2answers
157 views

Numerical Methods of solving a non-linear ODE?

I want to solve the nonlinear equation $\frac{d^2x}{dt^2} + k\sin x = 0$, numerically. I found that solving this elliptic integral would be cumbersome, so is there a numerical method i could use to ...
0
votes
1answer
116 views

SciPy odeint fails in unpredictable ways on deterministic system of ODEs

I've been trying to solve the following (relatively simple) system of Lotka-Volterra ODEs in Python using SciPy's odeint: $$\dot{z_1} = z_1 \left(- \sigma z_1 + \sigma z_2 + \rho z_3 - z_4 - z_5\right)...

1
2 3 4 5
9