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
7
votes
0answers
72 views

How do we approximate the numerical error a numerical scheme (e.g Runge Kutta, Euler etc) makes without having access to an analytical solution?

So I recently encountered this question in my head while taking my Scientific Computing class, where the lecturer talked about computing numerical error of a scheme. My guess would be that we take a ...
1
vote
1answer
56 views

solve_ivp doesn't work with toms748

I have the following code ...
2
votes
1answer
85 views

SciPy odeint giving different results with matrix multiplication

I've asked this at stackoverflow but maybe this community will have a better idea of the answer. I'm currently trying to develop a function that performs matrix multiplication while expanding a ...
3
votes
1answer
105 views

Solving and Plotting Mutualism Model in Python

I am a beginner in programming. I need to program a mutualism model of two species in python that would solve and graph using the following equations: $$ \frac{dN_1}{dt} = N_1(r_1 - e_1N_1 + \alpha _{...
1
vote
0answers
78 views

Solving general initial value problem $\mathbf{f}(\mathbf{x}, \mathbf{x'}, t)=\mathbf{0}$

The common form of initial value problem that can be solved using ODE integrator is $$ \mathbf{x'}=\mathbf{g}(\mathbf{x}, t) $$ where $\mathbf{x'}=\partial\mathbf{x}/\partial t$. The initial ...
1
vote
0answers
33 views

Anyway to escape ODEintWarning (scipy)?

I am trying to fit a differential equation to some data and obtain the parameters of the underlying model. This requires me to try out various parameter values, but this often gives me an ...
1
vote
0answers
43 views

How to apply Neumann boundary conditions in Newton's method [closed]

Suppose that I have a very long and tedious set of differential equations. After discretization, I can get a mapping $f:\mathbb{R}^N \to \mathbb{R}^N$ such that solutions $\phi =(\phi_0,...,\phi_{N-1})...
2
votes
2answers
90 views

How are consistency constraints maintained in Circuit Simulation?

I have always taken for granted circuit simulators and I didn't spend time understanding now. I wish to understand better now. Normally when you forward simulate ODE systems there is a single dynamic ...
4
votes
2answers
88 views

Backward Euler + Quasi Newton(Broyden) method fails to solve Van der Pol's equation(Stiff ODE)

The first guess is using the forward Euler approach. The first jacobian is using finite differences. Then NR method is used to solve for the next iteration and Broyden's method is used to update the ...
2
votes
1answer
80 views

Implicit integrator for ODE with quadratic right-hand side

I have an ODE for an unknown $x(t):[0,\infty)\to\mathbb R^n$ of the following form: $$ x_i'(t)=a_i^\top x(t) + x(t)^\top Q_i x(t), $$ for $i\in\{1,\ldots,n\}$. Here, the vectors $a_i\in\mathbb R^n$ ...
0
votes
2answers
142 views

Recommendations for ODE solvers for stiff equations

I'm continuing the research of a former Ph.D. student in my group requiring the solution of a system of ODEs. On a technical note, they wrote: The system of Boltzmann equations behaves numerically ...
7
votes
1answer
360 views

Why is the central difference method dispersing my solution?

I am solving numerically the ODE $\ddot x(t)=-c\dot x(t) -\sin(x(t))+F\cdot \cos(\omega t), \;\dot x(0)=x(0)=0$ for $t\in [0,20\pi]$ on an $N=2000$ dimensional grid. I am working on Python, and I ...
2
votes
1answer
185 views

Solving stiff ODEs: Dealing with Jacobian terms which take too long to compute with finite differences

I have a system of PDEs describing atmospheric chemistry and transport. I use finite-differences to make my system of PDEs into a system of ~10,000 ODEs. I then integrate the ODEs forward in time with ...
3
votes
1answer
102 views

Parameters estimation with fewer variables than parameters

I am trying to estimate parameters, 4 of them, by fitting a system of 3 ordinary differential equations. I am using a model published that was using 3 parameters and gave a good fit to the data, and I ...
3
votes
2answers
176 views

How to solve the integral-like energy equation with Sagdeev potential numerically in Python?

I am trying to numerically solve equation (6) of Lakhina 2021 in Python. The equation is $$\frac{1}{2}\left(\frac{d \phi}{d\xi}\right)^2 + S(\phi, M) = 0\, .$$ The Sagdeev potential expression is ...
0
votes
0answers
49 views

What is the most common loss function used with collocation methods for differential equations

I was looking at the Cheney and Kincaid book (6th edition) on numerical methods, with respect to collocation method for differential equations. Now for linear systems of ODES, collocation is just a ...
0
votes
0answers
44 views

Plotting the motion of a positive charge in a cylindrically symmetric magnetic field

I want to plot the motion of a positive charge in a cylindrically symmetric magnetic field. I am assuming a cylinder around the z-axis, with the magnetic field going in clockwise direction. The B-...
4
votes
1answer
117 views

How can i solve these Coupled differential Equations?

I am trying to solve this with odeint module. But the first equation is function of second equation. If i ignore dw/dz in first equation and second equation is function of first one. I can solve it ...
2
votes
1answer
154 views

Why can bad jacobians sometimes works better for implicit ODE method?

I'm solving a system of stiff ODEs describing atmospheric chemistry and transport. I am using CVODE BDF from Sundials Computing. I have two ways to approximate the jacobian: Allow CVODE to ...
3
votes
1answer
75 views

Quantify difference between two discrete 1D solutions

I have an ordinary differential equation that is solved as an initial value problem using different numerical schemes. I end up with several discrete time signals that should display a reasonably ...
1
vote
2answers
98 views

ODE adaptive time stepping: is it bad to use "timescales of change" to select timestep size

Suppose you want to approximately solve a system of ODEs, using some numerical method (Euler, RK, BDF, whatever): $\frac{du}{dt} = f(u)$ To do this you need to select time steps which solve the ODEs ...
3
votes
1answer
183 views

Time discretization Navier Stokes equation

This question is a follow-up of this one. The weak form of Navier Stokes equation is (assuming $v,q$ test functions for the velocity and the pressure, respectively) $$(\frac{du}{dt},v)_{\Omega} + (\...
-1
votes
1answer
174 views

Using ODE to plot particle-motion with scipy.integrate.solve_ivp

My Problem: A positively charged particle (mass = 2 * 10-27 kg) is moving along the x-axis. It is travelling in a homogenous magnetic field such that the field axis in z-direction. The energy of the ...
1
vote
1answer
96 views

Solving chain of ODE in Julia

I am solving two different ODE whose solutions need to be matched. I am currently doing this by hand, which works great, but I would like to automatise this process. The second ODE takes one of its ...
3
votes
0answers
75 views

Solving PDEs: What is the best way to deal with non-banded/dense jacobians?

I have a system of PDEs describing atmospheric chemistry and transport. I use finite-differences to make my system of PDEs into a system of ~10,000 ODEs. I then integrate the ODEs forward in time with ...
-2
votes
2answers
90 views

numerical solution for differential equation

I have these 3 equations and i want to solve them with numerical methods. so I am using scipy library but I don't know how to solve 3 equations together. R, g, sigma and density are constants. \begin{...
2
votes
0answers
51 views

A JAVA solver for ODEs with boundary conditions (BVP)

I need to solve a system of linear first order ODEs with boundary conditions in JAVA. I was wondering if any of you know of a JAVA package with the capability of solving a boundary value problems? (i....
0
votes
0answers
89 views

Path constraints for state variables - fmincon, ODE45

My problem lies in constraining state variables (look for 23,24,25). I am currently using ODE45 to solve equations and fmincon to find best control variable.How would you go about solving this? Here ...
5
votes
2answers
563 views

Specifying ode solver options to speed up compute time

I'm specifying the 'JPattern', sparsity_pattern in the ode options to speed up the compute time of my actual system. I am sharing a sample code below to show how I ...
3
votes
1answer
94 views

Preferred application for shooting method

Every now and then there are questions asked in this site related to the shooting method for boundary value problems (see 1, 2, 3). Nevertheless, in some of the cases that I have seen here, the ...
1
vote
1answer
114 views

ODE Instability with sinh and cosh functions in Julia

I want to solve the first-order differential equation $$ \begin{align} \frac{d\alpha}{d\phi} = \frac{\phi \sigma^2 \sin(2d\alpha)+2d\sinh(\sigma^2\alpha \phi)}{-\alpha \sigma^2 \sin(2d\alpha) +2d\...
1
vote
1answer
69 views

Eigenvalue problem for ordinary differential equation

I am trying to compute the natural frequency of a cantilevered beam. The Euler-Bernoulli equation reduces to the following problem : $$ v''''=\lambda v, \text{with }, v(0)=0, v'(0)=0, v'''(1)=0,v''(1)...
2
votes
0answers
103 views

Jacobian matrix cutoff in ODE solver

I am studying an implementation of a 3rd semi-implicit Runge Kutta method (siRK3) from the book by Villadsen & Michelsen (1978), Solution of differential equation models by polynomial ...
0
votes
1answer
41 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 ...
4
votes
1answer
79 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 ...
0
votes
0answers
37 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\...
1
vote
1answer
92 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
227 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
55 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
247 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
137 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
265 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
222 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
156 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
104 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
209 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
85 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
56 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
182 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
81 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 ...

1
2 3 4 5
10