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
2
votes
1answer
117 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
61 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 ...
-2
votes
0answers
53 views

How to solve nonlinear second order ODE in MATLAB?

0 I am working on simulating a car suspension system using Matlab. Specifically, I have to derive equation of motion using the Lagrange method and then use ode 45 to solve it. However, while using <...
-2
votes
0answers
24 views

Integrating an array of ODEs

The system I am dealing with is a compartmentalized model, each compartment having 4 ODEs describing the dynamics of the variables inside, and each ODE also having terms connecting variables across ...
1
vote
2answers
84 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
121 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
93 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
82 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
56 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
85 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
42 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
44 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
543 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
88 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
103 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
52 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)...
1
vote
0answers
53 views

Jacobian matrix cutoff in ODE solver

I am studying an implementation of a semi-implicit Runge Kutta method of 3. order (SIRK3) from the book by Villadsen & Michelsen (1978), Solution of differential equation models by polynomial ...
0
votes
1answer
40 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
72 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
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\...
1
vote
1answer
85 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
165 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
54 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
218 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
81 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
202 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
205 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
149 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
203 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
72 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
50 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
107 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
74 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
294 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
35 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
136 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
40 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
101 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
131 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
411 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
375 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
170 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
157 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
123 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
123 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
58 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
283 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
87 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), ...

1
2 3 4 5
9