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
0answers
7 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
40 views

Picard-Lindelöf Theorem applied on an IVP

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/...
3
votes
1answer
56 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
45 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 ...
0
votes
0answers
34 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
81 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
126 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 ...
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
134 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} ...
-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....
1
vote
1answer
147 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 ...
-3
votes
2answers
193 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 ...
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 ...
0
votes
0answers
100 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
1answer
55 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. ...
0
votes
2answers
81 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. ...
3
votes
1answer
70 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
151 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
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 ...
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 ...
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 ...
-1
votes
1answer
201 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
365 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 & -\...
3
votes
2answers
159 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 ...
0
votes
0answers
129 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 ...
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: $$...
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 ...
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, ...
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 ...
0
votes
1answer
75 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 ...
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 ...
2
votes
1answer
124 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) \...
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 ...
3
votes
1answer
121 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} &...
1
vote
2answers
327 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
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
vote
1answer
105 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
155 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
0answers
57 views

Python evaluating a second order ODE with RK4

Pasted below is my python code. It is a 4th order runge kutta that evaluates the 2nd order ode: y'' +4y'+2y=0 with initial conditions y(0)=1, y'(0)=3. I need help fixing it. When I run my code, my ...
0
votes
1answer
80 views

Odeint error for nonlineal differential equations

I receive the following error when I run the code. ODEintWarning: Excess work done on this call (perhaps wrong Dfun type). Run with full_output = 1 to get quantitative information. warnings.warn(...
3
votes
0answers
75 views

Numerical Issues with DDE from SEIRU$\delta$ model

I'm new in this community. I moved this question from Math community. I'm reading the following article Article Here and my target is to replicate the results for a project. SEIRU Model: I obtained ...
2
votes
1answer
81 views

System of moving, non-colliding particles in 1D

I have a system of ODEs for functions $f_i(t)$. At each time $t$, $f_i(t)$ is the position of particle $i$. The functions $f_i$ have a monotonicity property: at all times $0 < f_1(t) < f_2(t) &...
0
votes
0answers
92 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
1answer
135 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 ...

1
2 3 4 5
9