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
1 answer
53 views

Local truncation error of given implicit 1-step scheme

I'm given the 1-step implicit scheme $$y_{n+1} = y_n + \frac{h}{6}[4f(t_n, y_n) + 2f(t_{n+1}, y_{n+1}) + hf'(t_n, y_n)],$$ where $y'(t) = f(t, y)$, and I'm seeking the scheme's local truncation error. ...
jackyooo's user avatar
1 vote
0 answers
61 views

How to prove a truncation error of integration when using runge-kutta to approximate exponential function

If I using the $s$ stage $p$ order explicit Runge-Kutta method with the following Butcher table $$ \begin{array}{c|cccc} c_{0} & 0 & & & \\ c_{1} & a_{2,0} & 0 & & \\ \...
Owen Jun's user avatar
2 votes
2 answers
926 views

Numerical implementation of ODE differs largely from analytical solution

I am trying to solve the ODE of a free fall including air resistance. I therefore defined my ODE as: def f(v, g, k, m): return g - k/m * v**2 which in my ...
Axel's user avatar
  • 123
1 vote
0 answers
131 views

Using Sundials CVODE in MATLAB

I'm currently using ode15s to solve a set of stiff differential equations. I am trying to use the MATLAB profiler to understand the section of the ode solver code which calls BLAS routines. Since the ...
Natasha's user avatar
  • 411
0 votes
1 answer
112 views

Using Crank-Nicolson to solve Non-Linear Schrödinger equation in Python

I aim to solve the (non-linear) Schrodinger equation using the Crank-Nicolson method in Python. Here are my two functions. ...
FairyLiquid's user avatar
0 votes
0 answers
66 views

Solving system of ODEs, where time derivative approaches infinity due top initial condition

I am trying to solve a problem in python using scipy's solve_ivp. The system of ODEs I am trying to solve is for coupled where I am solving for two time-dependent ...
HWIK's user avatar
  • 23
2 votes
2 answers
228 views

Solving IVP backward in time via python

I'm having difficulty solving an initial value problem (IVP) in Python backwards in time. The code is at the end of this post. First, please let me state my simplified problem. The forward IVP is ...
JesseJC's user avatar
  • 21
1 vote
1 answer
102 views

Isolating decaying solutions to nonlinear second-order ode

I need to solve a nonlinear ODE of the form $$ \frac{d^2 y}{dx^2} + \frac{1}{x}\frac{dy}{dx}-\frac{1}{x^2}\sin(y)\cos(y)+\frac{2}{\alpha}\frac{\sin^2(y)}{x}-\sin(y)=0 $$ numerically, subject to the ...
Ali Shakir's user avatar
1 vote
2 answers
189 views

How should I solve generalized eigenvalue problems in Python? (Orr-Sommerfeld equation)

I am trying to solve the Orr-Sommerfeld equation numerically, using the techniques given in this article. This leads to solving a generalized eigenvalue problem, that is, given two matrices $\mathbf A,...
K.defaoite's user avatar
0 votes
2 answers
155 views

Approximating the solution of a non-linear ODE using Python

This is my first time asking a question here, so please tell me if I have made a mistake or if anything is unclear. I am working on my high school research project on the motion of a ball falling ...
user1193197's user avatar
5 votes
2 answers
639 views

How do people know the classic Lorenz attractor is actually deterministically chaotic at infinite time?

Correct me if I am wrong, but I take it that people actually think the classic Lorenz system is fully characterized, i.e. we know what the attractor looks like and the various fractal dimensions of it,...
Axel Wang's user avatar
4 votes
2 answers
378 views

Choice between DAE or ODE formulation for chemical systems

Consider a simple ODE system describing the evolution of two chemical species undergoing the reaction $A = B$ : $$ \frac{dn_A}{dt} = - k * n_A $$ $$ \frac{dn_B}{dt} = k * n_A $$ We can discretize ...
Anon_Chem's user avatar
1 vote
1 answer
120 views

How can we use the two boundary conditions for the Taylor-Maccoll Equations for Cone Shock Waves?

The Taylor-Maccoll equations below govern the gas dynamics around a supersonic, axially oriented cone. Using the notation from Anderson's Fundamentals of Aerodynamics, which uses a dimensionless ...
Jacob Ivanov's user avatar
2 votes
0 answers
62 views

Example: Velocity Verlet reduced accuracy

Velocity Verlet is often held to far more accurate than forward Euler while being no more expensive. Technically, this requires some degree of regularity on the potential. But, is there a convincing ...
msm's user avatar
  • 201
0 votes
1 answer
59 views

Reverse engineering phase shift and numerical damping

I've been trying to validate the physics behind a particle system framework, but I'm having some difficulties. A particle system is a set of lumped masses connected by spring-damper elements. Linear ...
AlexBatch's user avatar
2 votes
0 answers
66 views

Order of local error when integrating ODE with discontinous derivatives

I'm working with ODEs, $$\dot{x} = f(x, t),$$ where the (higher) derivatives of the right-hand side have discontinuities. In particular, $f(x, t)$ is obtained by interpolation of discrete samples, and ...
Tor's user avatar
  • 181
2 votes
1 answer
78 views

Differential Equation with Forced Behavior

I'm attempting to solve a strange differential equation problem. My goal is to know if there are kinds of ODE solver packages to solve this kind of problem. I'm solving a 1D Partial Differential ...
nicholaswogan's user avatar
3 votes
0 answers
96 views

A way to solve nonsmooth stiff ODEs

Let us considered the following ODEs \begin{align*} \dfrac{dX}{dt} = F(X), \tag{1.1} \end{align*} where the unknown $X\in \mathcal{D} \subset \mathbb{R}^l$ and it can be stiff. These ODEs can be ...
Tung Nguyen's user avatar
1 vote
1 answer
112 views

Do Explicit Methods Always Require an Analytical Solution

Following some comments from another question I wanted to ask: does an explicit method always require some sort of analytical function/solution? Let's take Euler for example. You have a function $f$ ...
cgbsu's user avatar
  • 33
0 votes
1 answer
142 views

Solve 1st order ODE in using `scipy`

I've been trying to solve the following equation $$ y(t)=-A\cdot\frac{\mathrm{d} y}{\mathrm{d} t}+B\cdot\left(\frac{\mathrm{d} y}{\mathrm{d} t}\right)^{2}+C \\ y(t=0)=y_{0}\\ $$ where $A$, $B$, and $C$...
BackSpace42's user avatar
1 vote
0 answers
77 views

System of ODEs with stochastic process

Consider system of ordinary differential equations $$ \begin{align} \frac{dx}{dt}&=\sigma(y-x)\\ \frac{dy}{dt}&=\rho x-y-xz\\ \frac{dz}{dt}&=xy-\beta z \end{align} $$ with $\sigma=10$, $\...
Midess's user avatar
  • 11
1 vote
1 answer
90 views

Solving basic barystochrone problem in python

I am trying to solve $\frac{u''}{1+u'^2} - \frac{1}{2(1-u)} = 0$ subject to $u(0)=1, u(1)=0$. If I understand how to do this properly, I first do the variable substitutions: $u = y$, $y_1 = y; y_2 = y'...
Makogan's user avatar
  • 263
0 votes
0 answers
27 views

Consering numerical implementation of gradient based method for control system

I'm trying to reproduce the results in Optimal consensus control of the Cucker-Smale model by Bailo et al. The system is the following, the adjoint variables, and the algorithm, I tried to ...
waaat's user avatar
  • 1
0 votes
0 answers
52 views

Why do BVP solvers' APIs only allow "unknown" parameters in the derivative and residual functions but not "known" parameters?

I recently needed to solve a second order boundary value problem and noticed that both scipy.integrate.solve_bvp and Matlab's ...
user9794's user avatar
  • 465
1 vote
1 answer
312 views

Solving a 2nd order complex-valued matrix differential equation in Python

I am trying to solve the following complex-valued matrix differential equation backwards (i.e. not starting at $r=0$, but rather at $r > 0$): $F'' = 2ikF' + VF$. Here $F=F(r)$ and $V=V(r)$ are 2x2 ...
Martin C.'s user avatar
  • 229
0 votes
0 answers
648 views

ValueError: array must not contain infs or NaNs; When using solve_ivp in the scipy library

I am solving an initial value problem using solve_ivp. The problem consists of computing the concentration profile of a set of reactions over time, given the initial concentrations and some of the ...
HWIK's user avatar
  • 23
0 votes
0 answers
66 views

accelerating solutions of ODEs with close by parameters

Suppose $\mathbf{u}^1\in\mathbb{R}^n$ is an unknown and $\mu^1\in\mathbb{R}$ is a known parameter. Suppose we have solved the non-linear system of equation for $\mathbf{u}^1$ using Newton's iterations....
NNN's user avatar
  • 668
3 votes
1 answer
228 views

Convergence-test for ODE approximates wrong limit

I am trying to numerically solve a differential equation but I am having trouble getting the convergence test to run properly. The problem is as follows: Consider an ODE $$y'(t) \enspace = \enspace f(...
Octavius's user avatar
  • 185
2 votes
2 answers
677 views

Using backward and forward Euler method to solve a certain stiff ODE

When using the backward and forward Euler methods to solve a certain stiff differential equation, what criteria does one look at before drawing the conclusion that one is more stable than the other?
Simon's user avatar
  • 23
3 votes
1 answer
105 views

Scipy solve_ivp sensitivity to random phase shifts

I am trying to solve a coupled system of ODE's using the solve_ivp function from scipy. The general form of the equation is given via $$\dot{y}(t) = M(t)y(t).$$ The time dependence of matrix is ...
raeel's user avatar
  • 31
2 votes
1 answer
474 views

How to extract intermediate calculation results from an SciPy ODE function in python?

I have a bit lengthier ODE function which was simulated by using Scipy solve_ivp function. During this simulation I calculated many parameters but as the output, I am taking out put only some other ...
Nis's user avatar
  • 21
0 votes
1 answer
133 views

Solve discontinuous ODE with lsode

I am trying to solve a discontinuous ODE using the lsode solver. I tried setting the t_crit parameter to specify the time where the discontinuity is present, but it ...
Bruno's user avatar
  • 101
0 votes
1 answer
142 views

solve_ivp not giving out any output and no error while souple 3 coupled 2nd order ODES

Please, someone tell me what is wrong in my code it does not give any outputs ( No plot nor print). The code is as below: ...
Lunthang Peter's user avatar
2 votes
1 answer
1k views

scipy.optimize.root not converging and RuntimeWarning

I am trying to solve the following problem: $$ \frac{d^2y}{dx^2}=\sinh(y) $$ Where the boundary conditions are: $y(0)=-1$, and $ \frac{dy(x\rightarrow \infty)}{dx}=0 $. Through central difference ...
HWIK's user avatar
  • 23
0 votes
1 answer
308 views

Passing additional arguments to `odeint` from `torchdiffeq` to solve an IVP

In Python I use the package torchdiffeq (as provided here) to solve initial value problems. Given an arbitrary function ...
eldorado's user avatar
2 votes
1 answer
64 views

Solving constrained odes's using inbuilt solvers in Matlab/Octave

I would like to solve a set of coupled second order differential equations using inbuilt Matlab/Octave subroutines. These equations arise when trying to model sliding of mass ($m_2$) over a wedge of ...
Salil S. Kulkarni's user avatar
8 votes
2 answers
524 views

Are stiffness and instability equivalent?

To the best of my knowledge, stiffness of ordinary differential equations is difficult to capture but can be roughly described as problems where explicit methods don't work while implicit ones do. ...
Marten's user avatar
  • 231
0 votes
0 answers
57 views

Ratio of error norms or norm of error ratio in adaptive step size control?

Step size controllers for ODE solvers with adaptive step size usually track an error estimate $y_{\mathrm{err}}$ and compare it to the current state $y_\mathrm{current}$ to decide if a step can be ...
Marten's user avatar
  • 231
3 votes
2 answers
1k views

Inaccurate results of integration using scipy solve_ivp

I am trying to use solve_ivp to solve the following 1st order ODE: $$ \frac{d \rho}{d z} = \frac{m \theta}{(1+\theta z)} \, \rho, $$ subject to $\rho(z=0)=1$, where ...
Fryderyk's user avatar
3 votes
2 answers
122 views

Solving detailed combustion kinetics in CFD, where to start?

I have some experience solving single- and multicomponent Euler equations for modeling of gas flows, including combustible ones. The code (variations of finite-difference WENO methods) is written with ...
omican's user avatar
  • 337
9 votes
6 answers
905 views

What are good particle dynamics ODEs for an introductory scientific computing course?

I'm teaching an introductory course on scientific computing (programming in C/C++) and am looking for application problems which the assignments can be centered around. I'm thinking of ODEs for ...
Jesse Chan's user avatar
  • 3,102
1 vote
1 answer
135 views

Electric circuit model ODE leads to ODEintWarning: Excess work done on this call (perhaps wrong Dfun type)

I am trying to numerically solve the following ODE's of an electric circuit which models the battery of a vehicle: $\dot{u_{1}} = \frac{-u_{1}}{R_1C_1}+\frac{I(t)}{C_{1}}$ $\dot{u_{2}} = \frac{-u_{2}}{...
Pedro Dias Longhitano's user avatar
2 votes
2 answers
345 views

ODEs that are jointly stiffer than they are individually

I am looking for an example of a certain pair of ODEs. Consider two independent ODEs $$ \frac{\partial x}{\partial t} = f(x)\ \text{and}\ \frac{\partial y}{\partial t} = g(y) $$ where $x \in \mathbb{R}...
Marten's user avatar
  • 231
3 votes
1 answer
824 views

Solving nonlinear PDE in Python with LSODA

I am attempting to solve a nonlinear diffusion equation of the form $\partial_t u = \partial_x (\kappa(u) \partial_x u)$, where the conductivity function $\kappa(u)$ is a power law $\kappa = u^{5/2}$, ...
Maxim Umansky's user avatar
1 vote
0 answers
44 views

stable solutions for Large-scale ODEs under boundary value problem

I'm doing FEM and have a problem about getting numerically stable solution for ODEs problems like: $$ \frac{\mathrm{d}}{\mathrm{d}x}\mathbf{Y} = \mathbf{AY}, x\in[x_1,x_2]$$ in which $\mathbf{Y}$ ...
Jiaqing Jiang's user avatar
7 votes
1 answer
303 views

How does non-dimensionalization improve the behavior of ODE solvers?

I have a set of coupled ODEs that I'm solving numerically. The independent variable is time and runs from values of $10^{15}$ to $10^{17}$ in units of seconds. The state variables in their usual ...
quantumflash's user avatar
2 votes
0 answers
155 views

Numerical solution to the Tolman-Oppenheimer-Volkoff equations for any equation of state (numerical or analytical)

I've been working on a code to solve the Tolman-Oppenheimer-Volkoff (TOV) equations for a while and recently I've got it right but only for one specific equation of state, the bag model, which is not ...
Felipe Flores's user avatar
1 vote
0 answers
31 views

How to classify ODE equilibria that are stable but slowly changing in value with time?

I'm numerically solving a system of coupled ODEs where time is the independent variable. At each time, I can solve for the equilibrium values of my state variables where their respective derivatives ...
quantumflash's user avatar
2 votes
0 answers
216 views

Can someone explain why RK4 is less accurate for very small timesteps?

I am currently working on a project where I have used an RK4 integrator to attempt to solve the three-body problem. An interesting result that I found, was that decreasing the size of the time steps ...
DaSquire's user avatar
1 vote
1 answer
95 views

Accurately solving system of differential equations

So I am trying to solve two equations simultaneously. The goal is to find values for $\frac{de}{dt}$ and $\frac{d}{dt}$ which are the rates of change of the variables $a$ and $e$. I am then ...
Peter Smith's user avatar

1
2 3 4 5
11