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.

3
votes
1answer
86 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
25 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
102 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 ...
1
vote
0answers
59 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
96 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
90 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
92 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
31 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
76 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} &...
3
votes
1answer
67 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
57 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
116 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
81 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 ...
0
votes
0answers
63 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
73 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
61 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
64 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
91 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
41 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
0answers
66 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
51 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 ...
22
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
93 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
67 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
61 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
63 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
168 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
66 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
213 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
3answers
185 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
123 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
121 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
95 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
251 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 ...
0
votes
0answers
47 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
162 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
116 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
218 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
213 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
124 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
148 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 ...
0
votes
1answer
78 views

Solving systems of nonlinear ODEs in epidemiology

I have a 9 systems of nonlinear ODEs to solve. I want to determine the endemic equilibrium points. How do I go about it? I tried manual calculation but it becomes cumbersome. Can software be used ...
0
votes
2answers
96 views

implicit odes solution using fdm

I am solving a non linear second order implicit initial value problem using finite difference method, but my results do not converge. Please guide me with an example, how we can apply finite ...
1
vote
1answer
63 views

Calculation of integration curve

Consider the unit circle $x^2 + y^2 = 1$, it also represents the solution to the ODE $$ x + y \frac{dy}{dx} = 0; y(0) = 1 $$ Suppose we don't know how to solve the above equation analytically (there ...
0
votes
0answers
52 views

Solving Non-linear System with Boudanries at both ends and a boundary function of the solution

This is my first thread in this forum. I have not a deep understanding of Computational Science, but I want to improve. I am developing a One Dimensional CFD model for by Bachelor's Degree Thesis and ...
-1
votes
1answer
407 views

Using scipy.odeint to solve coupled equations [closed]

I have a set of three coupled autonomous equations: ${y_{1}}\prime = y_{1}(\frac{\Omega_{m}}{y_{1}^3} + \frac{y_{3}^2}{6.0} + \frac{V(y_{2})}{2.H_{0}^2})$ $y_{2}\prime = y_{3}$ $y_{3}\prime = -3\frac{...
0
votes
1answer
39 views

Can RK5 be considered as part of Predictor–corrector method?

It seems that the 5th order is the corrector and the 4th order is the predictor. Can RK5 be considered as part of Predictor–corrector method?
6
votes
3answers
936 views

4th order Runge-Kutta for $y' = y$

My question is quite simple, but the more I look at it, the less content I am. My question is how to do a RK4 method for $y'=y$. At first I would assume the following: $$k_1=y_n$$ $$k_2=y_n+\frac{...
1
vote
0answers
38 views

Solve ODE with two unknown functions

I want to solve a diffusion-convection problem numerically. I start from a PDE of the form $$\partial_t f(x,t) = \partial_x(K(x)\;f(x,t))+\partial_{xx}\;f(x,t)^{m}\;.$$ It is possible to calculate a ...