Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
20 views

Solving a system of ODEs and one PDE with bvp4c

knowing that bvp4c is based on Finite Differences, would it be possible to solve a system of ODEs containing also one PDE? Thank you.
0
votes
0answers
36 views

Implementing Danckwert’s boundary condition for the PDE

This is a follow-up to my previous question posted here. I was suggested to use the pdepe function in MATLAB to solve the PDE, $ \frac{\partial C}{\partial t} = -v\...
3
votes
1answer
85 views

ODE: should Euler implicit be more accurate than Euler explicit for a given computational step?

I am aware than Euler explicit is conditionally stable, and Euler implicit is unconditionally stable. And I am aware that it is probably pointless to use Euler implicit with a small computational step ...
5
votes
0answers
68 views

Numerical solution of two coupled nonlinear eigenvalue problems

I would like to numerically solve the following system of coupled nonlinear differential equations: $$ -\frac{\hbar^2}{2m_a} \frac{\partial^2}{\partial x^2}\psi_a + V_{ext}\psi_a + \left( g_a |...
2
votes
1answer
166 views

Step-size selection for an Trapezoidal Method ODE solver (ode23t)

I was reading the documentation of the MatLab ODE solver ode23t, and I've seen that the trapezoidal rule is used. Moreover, the error is estimated by ...
1
vote
0answers
75 views

How to solve an implicit ODE with forward Euler?

Consider the implicit ODE $$ M(y)\dot{y} = F(t,y) $$ If $M$ is non-singular for all $y$ How to use the forward-Euler method to numerically solve for $y$ without inverting $M(y)$? I only came out ...
2
votes
3answers
126 views

How well do explicit Runge-Kutta “tableau” methods compare to the state of the art ODE solvers and when do they fail?

How well do explicit Runge-Kutta "tableau" methods compare to the state of the art ODE solvers and when do they fail? I've been reading Butcher's ODE book and he does a good job at introducing ...
2
votes
1answer
83 views

Euler Method Instability. Why?

I am currently enjoying writing computational codes as a hobby. Right now I've worked out an Euler method and results are pretty good with up to $x=1$. Over $x=1$, instability starts to kick in. May I ...
3
votes
1answer
90 views

Ordinary differenial equation with numerical right hand side

I'm interested in solving a differential equation in which I don't know the analytical form of the right hand side, I only know its numerical value for a finite set of values of the independent ...
0
votes
1answer
27 views

How do I find the default ODE solver tolerances in Matlab?

You can set the Absolute or Relative ODE solver tolerances in Matlab with the options structure from an odeset command. But how do I find the default values for the ...
1
vote
0answers
106 views

Integrating direct dynamics form more than 1 second does not give back the correct result

I am trying to simulate a robot manipulator dynamics in SciLab. Basically, I generated a step function that has constant acceleration for half of the time and then the same acceleration but negative ...
2
votes
0answers
65 views

How to solve Hamiltonian problems in Julia?

Unfortunately, I have not fountd any comprehensive example for Julia's 1.0 DiffEq.jl Hamiltonian problems. I am trying this: ...
9
votes
0answers
102 views

Are there shortcuts for numerically approximating systems of ordinary differential equations when autonomous?

Existing algorithms for solving ODEs handle functions $\frac{dy}{dt} = f(y, t)$, where $y \in \mathbb R^n$. But in many physical systems, the differential equation is autonomous, so $\frac{dy}{dt} = f(...
4
votes
2answers
103 views

Estimating error at mid timesteps for Runge-Kutta methods

When a timestep $h$ is rejected using a Runge-Kutta pair, such as Dormand–Prince, the algorithm resumes from the same initial point $t$ with a smaller timestep. A different idea is to resume at an ...
1
vote
1answer
119 views

Can a second-order ODE be “inconsistent” with its boundary conditions?

I am trying to solve a set of coupled, nonlinear ODEs. The only dependent variable is a 1-dimensional spatial coordinate, let's call it $x$. For now, I've managed to approximate away some of the ...
0
votes
0answers
34 views

On and off boundary condition

Hi I want to solve this problem using ode15s solver. Only issue I am not getting that is; this problem has a on and off boundary condition for specific time each day. To make it more specific say ...
2
votes
0answers
78 views

Solving an ODE from many starting points

I have a situation where I'm interested in solving the same ODE many times, from different initial locations. More precisely, I'm interested in solving an ODE of the form \begin{align} \frac{dx}{dt} &...
4
votes
1answer
93 views

Solving for a set of coupled ODEs to get correct variable values

My question is about how I can solve a coupled system of ODE's, and print out the variables in a plot. I am solving for an q value and an e value, seen in this set of coupled ODE's below: $$ \begin{...
1
vote
1answer
59 views

Numerical solution for eigenvectors and eigenvalues of a Sturm-Liouville problem

I have to deal with the following problem in my research: $$\left[\frac{1}{D}F_{x}\right]_{x} + \frac{f D_{x}}{c D^{2}}F = 0$$ with boundary conditions $$F(0) = 0$$ $$F_{x}(L) = 0$$ where $f$ is ...
5
votes
2answers
119 views

Methods for precise solution of an ODE whose solution terminates at a singularity

I'm working on a fun open-source project to calculate the trajectories of objects near black holes. This is obviously not the first time anyone has done this sort of thing, but I have some design ...
3
votes
2answers
83 views

Error control and sequence acceleration at the same time

In a posteriori error control for solving ODEs, one typically computes two different approximate solutions, one of which being "more accurate" and one of which being "less accurate". If $y_q^{n+1}$ is ...
1
vote
0answers
117 views

Which solvers for BVP in python are the best? Is there something better that scipy.integrate.solve_bvp?

I am trying to solve a boundary value problem with Python. I have been using scipy.integrate.solve_bvp but the result that it is giving me is completely wrong. Basically my code is as follows: ...
3
votes
0answers
78 views

Avoiding divergent solutions with `odeint`? shooting method

I am trying to solve an equation in Python. Basically what I want to do is to solve the equation: $$ \frac{1}{x^2}\frac{d}{dx}\left(Gam \frac{dL}{dx}\right)+L\left(\frac{a^2x^2}{Gam}-m^2\right)=0 $$ ...
1
vote
1answer
64 views

Parallel integration of dynamical systems

I need to solve the following problem: $$ \begin{cases} \dot{\vec{x(t)}} = A\vec{x(t)} + u(t)D\vec{x(t)} + u(t)\vec{b}, & x \in (0, T), \\ \vec{x(0)} = \vec{0}, \end{cases}$$ where $u(t)$ is known ...
0
votes
1answer
81 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
2answers
98 views

ODE system with discontinuous right-hand-side

I have a 1st order ODE system. One of the equations is piecewise function of 2 of the dependent variables. I try to solve it in Python environment. \begin{align}\dot x_1 &= x_2 - x_3\\ \dot x_2 &...
1
vote
1answer
46 views

System of ordinary differential equations - time complexity of initial value problem

I am interested in knowing what the time complexity is (in Big-$\mathcal O$ notation) for solving system of $N$ differential equations? I am using ode15s in ...
1
vote
1answer
95 views

Scipy odeint Unexpected Results

I am attempting to numerically integrate the equation $$\frac{\mathrm{dP} }{\mathrm{d} r}=-\left ( P+\rho\left ( r \right ) \right )\frac{m\left ( r \right )+4\pi r^{3}P}{r\left [ r-2m\left ( r \...
2
votes
0answers
54 views

Finite differenced eigenvalue prob. of inhomogeneous boundary conditions?

I am basically asking about eigenvalue problems of differential equations using some finite difference method (FDM). Usually the system is subject to some boundary conditions (BC), e.g., Dirichlet or ...
23
votes
2answers
1k views

What does “symplectic” mean in reference to numerical integrators, and does SciPy's odeint use them?

In this comment I wrote: ...default SciPy integrator, which I'm assuming only uses symplectic methods. in which I am refering to SciPy's odeint, which uses ...
4
votes
0answers
95 views

How to account for the interface between two different phases in a discretized diffusion model?

I have tried to set up a model for the diffusion of a gas into a liquid. The two media are next to each other and the geometry is spherical because the system should simulate the diffusion out of a ...
2
votes
1answer
69 views

Implementation details for high order IMEX methods by Kennedy and Carpenter

This question is a continuation of Fourth order IMEX Runge-Kutta method, concerning the implementation. Is seems to me that the first implicit stage value involves a direct evaluation, rather than ...
0
votes
1answer
70 views

Runge-Kutta timestep in atomic units

I'm using 4th order RK to solve the schroedinger equation in atomic units. Say I want to simulate 400fs in intervals of h=10fs, then in atomic units this is h=413a.u and 400fs=16500a.u. 4RK involves ...
0
votes
2answers
64 views

Finite difference for 2nd order ode $y'^2+y y''+\frac{2}{x} y y' -0.1 y^2=0$ with $y'(1)=0$ and $y(1)=1$

How to solve second order non-linear ODE $$y'^2+y y''+\frac{2}{x} y y' -0.1 y^2=0$$ subject to $y'(1)=0$ and $y(1)=1$ over the interval $0 < x \le 1$. I turned the equation to a PDE $y'^2+y y''+\...
5
votes
2answers
175 views

Do there exist low-storage Runge–Kutta methods with an order larger than four?

I’m trying to find a Runge–Kutta integrator that only requires the absolute minimum of storage, i.e. it fulfills one of the following three, presumably equivalent criteria: Each evaluation of the ...
0
votes
1answer
68 views

Is the time step size of a Rosenbrock method for stiff systems iteratively calculated?

I have an ODE system of the general form y' = k(y)(x) + q(z)(x) x' = a(z)(x) + b(x)(x) where k,q,a and b are also dependent on the states x and y. The ...
3
votes
1answer
234 views

Comparing Algorithmic complexity, ODE Solvers (Big O)

I am currently using the following three methods to solve differential equations: 4th order Runge Kutta Method Euler Method Internal scipy methods: ...
6
votes
2answers
187 views

Why naively chopped finite difference matrix works for different ODE boundary conditions

We know finite difference method (FDM) can replace $y''(x)$ as $\frac{1}{h^2}[y(x+h)+y(x-h)-2y(x)]$ or so. One naive way to write down the matrix of the differential operator is like the following, ...
6
votes
2answers
125 views

Algorithm for finding initial conditions of differential equations given trajectory

Let's say I'm given a system of three first-order differential equations in three variables, where all of the equations are known, and we additionally know the trajectory of two of the variables at a ...
9
votes
0answers
129 views

Inverse problem in linear ODE

I have a linear ordinary differential equation (ODE) with a system matrix with constant coefficients: $$\dot{y}(t) = \mathcal{A}\; y(t), \quad y(0) = y_0$$ with $y(t) \in \mathbb{R}^{n \times 1}$ and $...
1
vote
1answer
98 views

Bulirsch-Stoer algorithm to solve simple chemistry. Spanning long time intervals after stationarity

Hi all and thank you in advance. I am working on a time-dependent transport-chemistry model to study the composition of planetary atmospheres. The equations are the following $$\frac{\partial n(z,t)}...
0
votes
1answer
334 views

4th order runge-kutta and harmonic oscillator [closed]

I am trying to solve equations of motion for an harmonic oscillator using 4th order runge kutta method, but as a result I get almost constant velocity and position; I feel that the problem is that I ...
1
vote
0answers
49 views

Detecting stability in solutions to coupled nonlinear equations in aerodynamics,

I'm studying a quasi-steady force model (published in a fluid dynamics journal) that consists of coupled, nonlinear ODEs that describe unsteady aerodynamics -- recently, my advisor and I have found ...
1
vote
1answer
164 views

Method to solve linear, first order ODE of generalized matrix matrix form

The equation and its meaning: Consider two sets $(A)_{l=0,...,m_a},$,$(B)_{l=0,...,m_b}$ of hermitian matrices and a set of positive semidefinite matrices $(C)_{l=0,...,m_c}$. Each matrix has the ...
1
vote
2answers
119 views

Learning differential equations: a textbook

I am a Computational Biology master's student and I would like to study differential equations (both ODEs and PDEs). I tried to have a look at the available textbooks but what I found is either too ...
0
votes
1answer
267 views

Speeding up ODEINT stiff example [closed]

I am trying the implement the following odeint solver example but my differential equations are different. https://github.com/headmyshoulder/odeint-v2/blob/master/examples/stiff_system.cpp The ...
3
votes
1answer
39 views

Verifying that ODE integration generates Theoretical Stationary distribution

I am trying to simulate an ODE, like $ \dot{x} = \xi(x) $ that should have a stationary distribution (a la Stat Mech). Assuming that my ODE algorithm generates time samples of my system state $ x $ ...
1
vote
0answers
254 views

One Dimensional Schrodinger's Equation solution using Numerov Method

I have been trying to solve Time Independent Schrodinger's equation in one dimension using Numerov Method as discussed in this excellent lecture notes I found on net. The Numerov method can solve an ...
0
votes
1answer
126 views

Parameter identification for first order ODE

I have two arrays $f(z)$ and $z$ both indexed by k and I want to solve $\frac{df}{dz}=\mu(1-f)$ to find $\mu(z)$ What would be the best numerical method to solve this equation?
0
votes
1answer
177 views

``scipy.odeint`` giving different answer than analytical

I was using scipy.integrate.odeint function , the ode is $$\frac{y\ dx - x\ dy}{(x+y)^2} + dy = dx$$ with solution $$y^2 - x^2 - y = c (x + y)\ .$$ Solving it ...