The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
5
votes
1answer
62 views

Solving an ODE while maintaining weak positivity and weak monotonicity

I have a system of $N$ ODEs of the form, $$ M(z,F(z)) \cdot F'(z) = \Phi(z,F(z)) $$ where the mass matrix is $M(z,F): R\times R^N \to R^{N\times N}$ and $\Phi(z,F):R\times R^N \to R^N$ is (potentially)...
3
votes
0answers
188 views

Spectral Collocation (or Weighted Residual) Methods to solve Stiff ODEs?

I have a system of ODEs which is (at least moderately) stiff. Consider the class of spectral collocation methods https://en.wikipedia.org/wiki/Spectral_method or the related class of weighted ...
2
votes
0answers
77 views

How can I use ODE events in MATLAB? [closed]

I need to have a better understanding about how to define ODE events. What I know is that if I have my ODE defined as ...
1
vote
1answer
232 views

Algorithm to Compute Separatrix of Nonlinear ODE

The solution space of a nonlinear ordinary differential equation (ODE) often includes a separatrix that is unstable in the sense that nearby solutions depart exponentially from it. The nonlinear ...
3
votes
2answers
1k views

Adaptive ODE algorithm in Python

I want to integrate a particle path in 2D using the integrate.ode module. Things that are a bit different in my case are that, I only want to integrate up to a ...
1
vote
2answers
1k views

How can one describe the accuracy of a Runge-Kutta method?

I am solving a nonlinear ODE with a regular singularity using MATLAB ODE45 or ODE113. I am wondering what precision and accuracy they have and what one can say about the numerical error. The idea ...
3
votes
2answers
108 views

PDEs appropriate for adaptive time stepping algorithms

I'm looking for some physical phenomena for which an adaptive time stepping algorithm would be ideal. A PDE or ODE that showed very large gradients in time at a small period of time and smoother ...
2
votes
0answers
211 views

ODE events to switch between 5 equations (friction model)

I am modelling a 1 dof spring-mass-damper system with friction. As first attempt I modelled the friction according to the simple Coulomb model (figure A here http://article.sapub.org/image/10.5923.j....
1
vote
0answers
319 views

Computing solutions with singularities using MATLAB ODE45

I am new to solving numerically ODES and thus it is difficult for me to judge the reliability/trustworthiness of the results that I have produced for the following problem: I am dealing with a 2nd ...
2
votes
0answers
318 views

Solving constrained BVP, singular Jacobian

The boundary value problem is $$ \begin{cases} \dot{x}_i = \begin{cases} (0.5D^{-1}\psi)_i, \text{ if }(0.5D^{-1}\psi)_i \le 0 \\ 0 \text{, otherwise} \end{cases} \\ \dot{\psi} = 2\Sigma x \\ x(0) =...
7
votes
1answer
1k views

Numerical solution of Geodesic differential equations with Python

I have made a solver based on the SymPy.diffgeom library, where I use Scipy.Integrate to solve the following system of second order differential equations : \begin{align} u'' &+ \Gamma^0_{00}(u')...
0
votes
1answer
152 views

What is the meaning of this error in MATLAB?

Warning: Failure at t=6.137539e-04. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.734723e-18) at time t. In ode15s (line 730) In ...
1
vote
0answers
86 views

Time dependent self-consistent equations

I am facing the following problem. I need to solve numerically a set of coupled equations $$i\frac{d}{dt}f_{n}^{(i)}(t) = \left[U\cdot n(n-1) + \mu\cdot n\right]f_{n}^{(i)}(t) - \sqrt{n+1}\Phi_i^{*}\...
1
vote
2answers
135 views

Inaccurate Derivatives from Adjoint method for ODE-constrained problem

I have this very simple ODE-contrained optimization problem: $h(x,x',p,t) = x'-A(p)x-b(p) = 0$, the constraint $g(x(0)) = x_0$, the initial condition with no parameters involved $F = \int (X-X_{obs})^...
1
vote
2answers
167 views

Solving nonlinear boundary value problem

I have an ODE of the form $$C_1 d_y u + C_2 (d_y u)^n = C_3 y + C_4$$ with boundary conditions $u(0) = 0, d_y u(L) = 0$, where $C_1 \to C_4$ are known constants, and where $0 < n \leq 1$ is a real ...
2
votes
1answer
60 views

stirred tank model; DAE versus ODE model

I do have a stirred tank reactor with two inlets and one outlet. Several components enter the reactor at inlet 0 and particles at inlet 1. All component from inlet 0 adsorb on the particles from inlet ...
4
votes
2answers
3k views

4th order Padé scheme formula derivation

I am trying to derive the formula of the 4th order Padé scheme that passes through the points $x_i$, $x_{i-1}$ and $x_{i+1}$ $$\Big(\frac{\partial\phi}{\partial x} \Big)_i = -\frac{1}{4}\Big(\frac{\...
1
vote
3answers
1k views

Unexpected results of MATLAB's ode45

Whilst working with MATLAB recently I encountered something odd that I cannot explain. I was using the ode45 solver to solve a system of two coupled second order ODEs. I wasn't convinced about the ...
1
vote
1answer
215 views

Implicit ODE solver with discontinuous derivatives

I want to implement an implicit ODE solver, but don't know what to do when the differential equations (DEs) have discontinuities of the form: More common type: $$\lim_{x\rightarrow 0}\frac{\sin(x)}{x}...
1
vote
0answers
54 views

should boundary conditions be effecting moving mesh results?

I have a question on the use of moving mesh to solve the inviscid euler equations. I have solved the following equations: $$\frac{\partial}{\partial t}\left[\begin{array}{c} \rho\\ \rho u \end{array}\...
3
votes
1answer
483 views

How to perform the sensitivity analyses of ODE with several parameters?

I have the system which is described by several ODE. The solution looks good for me. Now I need to implement the sensitivity analyses of parameters which I used in the model. Therefore, I have the ...
3
votes
1answer
302 views

linear stability analysis using spectral radius

I am analysing the stability of a series of 1D linear equations of the form \begin{equation} \frac{d}{dt} x = A x \end{equation} discretised using upwind and central finite volume methods, etc, with ...
0
votes
1answer
131 views

adjoint method package for ODE(PDE)-constrained optimization

I have this type of question (ODE-constrained optimization) to solve: $g(x,p)=0$ is the simulation, where $x$ is state variable and $p$ is parameters aimed to optimize; $f(x)$ is the objective ...
7
votes
1answer
435 views

Why are functional representations of systems important in numerical applications?

I tried asking a similar question in SE.Physics, and I got some information regarding the abstract side of this, but I figured I should post here to get more complete information about the numerical ...
3
votes
1answer
113 views

Solve implicit ODE numerically in orbit simulation

I'm trying to plot the orbit of a compact binary star system where general relativistic effects become important. I'm using post-Newtonian approximation and I want to solve the orbit numerically based ...
7
votes
1answer
207 views

Forcing an ODE solver to preserve the norm

I have an ODE of the form $$ \frac{dy}{dt} = -i H y \enspace .$$ where $y$ is a complex vector and $H$ is a time dependent Hermitian matrix. The norm of the solution $y(t)$ at any point in time ...
-2
votes
2answers
112 views

Ways to solve numerically differential equations in C [closed]

I have to solve numerically a differential equation in C. The equation is: How can I write some code to solve it? Are there some numerical methods (Runge-Kutta maybe?) to solve it? A colleague ...
-1
votes
1answer
82 views

Is iteration an efficient algorithm in this case? [closed]

My task in numerical analysis is We are interested in finding values of β0 for which z(x) = 2500. Use an efficient algorithm to determine the rays which pass through the receiver. Now I'm just ...
2
votes
0answers
131 views

Rank deficient Jacobian in discretized periodic solutions to autonomous ODE

I'm trying to numerically find periodic solutions to different systems of autonomous nonlinear ordinary differential equations. I decided to use a finite difference scheme and solve the resulting ...
8
votes
2answers
128 views

How can I numerically solve an ODE to $N$ provably correct digits?

Suppose we have an initial value problem of the form $$ \frac{\mathrm{d} \mathbf{x}}{\mathrm{d} t} = f(\mathbf{x}) \qquad \mathbf{x}(0) = \mathbf{x}_0 $$ where $\mathbf{x}_0 \in \mathbb{R}^n$ is known ...
3
votes
1answer
388 views

General heuristics for making a choice “dopri5”, and “lsoda”?

With scipy, I have the choice of using "lsoda": Real-valued Variable-coefficient Ordinary Differential Equation solver, with fixed-leading-coefficient ...
0
votes
0answers
62 views

Quick scheme for separable first-order ODE

I'm trying to integrate an incredibly simple ODE: $$ y'(x) = -f(y),\quad y(0) = y_0 \ , $$ from $x=0$ to $x=1$. This is a decay type of equation, $f$ is the (variable) decay rate and $y$ is the ...
0
votes
0answers
129 views

system of coupled nonlinear ODEs with complex coefficients

I am interested in numerically solving the following system of coupled ODEs $$\left(i-\frac{1}{2\Omega}f_{m,n}\right) \frac{d a_{m,n}(t)}{dt} =E_{m,n}^{\text{kin}}(t) + \left(\omega_{0}+V_{m,n}-\frac{...
2
votes
1answer
114 views

RK4 giving wrong result [closed]

I am trying to numerically solve a simple second order differential equation $x'' = -x$. I used a new variable $x'=v$, so I have two equations. While it seems simple, it somehow produces a result that'...
4
votes
3answers
157 views

Numerical solution of IVP for linear ODE with variable coefficient blows up

Cross posted in Mathematica.SE, I'll try to rephrase it in a more general way here. A friend of mine showed me this initial value problem (IVP) for a linear ordinary differential equation (ODE) with ...
2
votes
1answer
2k views

How can I implement the implicit Euler method for a small nonlinear system of ODEs?

I am trying to solve a system of coupled ODEs: $$ \begin{align} \frac{dn_A}{dt} & = e\left[j(t) - f\, θ_H\sinh\left(\frac{g\,n_A}{T}\right)\right] \\ \frac{dθ_H}{dt} & = a\left[bP\,(...
0
votes
2answers
784 views

Searching for periodic solutions of Mathieu equation using MATLAB's ode45 and a crude shooting algorithm

I am numerically simulating the Mathieu equation using ODE45 and I have to keep changing the parameters delta and epsilon for each simulation to get the required peiodic solution. Following is the ...
1
vote
0answers
244 views

Memory allocation error with GSL ODE solver applied to system of 4 ODEs

I am trying to solve a (large) system of ODEs with GSL solvers. When I use driver method I get an error message of could not allocate space for gsl_interp_accel, ...
7
votes
2answers
247 views

Initializing implicit linear multistep methods

A sixth order backward differentiation formula (BDF) need six (five plus initial value) previous solutions to get started. How I can get these previous solutions? I need a method accurate to sixth ...
-1
votes
1answer
176 views

How do I stop negative numbers and error message: " Failure at t=3.562559e+03. Unable to meet integration tolerances

I am using 8 ODEs in Matlab to simulate the effect of asymptomatic infections in the epidemiology of a vector borne disease. Searching the parameter space under certain settings produces negative ...
2
votes
2answers
2k views

How to solve ODEs with constraints using BVP4C?

I am using BVP4C to solve a system of ODEs which is as follows. \begin{equation} \left\{ \begin{aligned} \frac{\partial f(x,y)}{\partial x} &- \frac{d}{ds}\big(\...
0
votes
1answer
71 views

What are some tips on developing a problem-specific ODE solver?

I have a small system of stiff ODEs describing a chemical reaction. The right-hand side is quite complicated, as well as the Jacobian. This equation will be solved many times with different initial ...
1
vote
0answers
48 views

Can variational formulations be solved using series solutions?

What I specifically mean is, given some functional $F\left[\mathbf{x}\right]$ which is stationary with respect to $\dot{\mathbf{x}}=f(\mathbf{x})$ and some boundary or initial conditions, can one ...
5
votes
1answer
312 views

Quantify integration error of scipy ode / ODEPACK

I am trying to integrate a 2nd order ODE with potential several singularities using the lsoda solver wrapped in scipy.integrate.ode(). I would like to put an error bar on the solution or at least ...
1
vote
1answer
153 views

Step-wise finite element formulations: can this be done?

Given the functional: $$ F[\mathbf{x}]=\frac{1}{2}[\mathbf{x}^{\text{T}} * D(\mathbf{x})]-\frac{1}{2}[\mathbf{x}^{\text{T}} * \mathbf{Ax}]-\frac{1}{2}\mathbf{x}^{\text{T}}(0)\mathbf{x}(t) $$ Where $...
-1
votes
1answer
555 views

Dirichlet boundary condition

I am trying to solve ODEs in matlab using ode15s. Instead of specifying ODEs in the format M * dC/dt = f(C,t) where C is a function of x and t. I want ...
3
votes
2answers
7k views

scipy odeint - Excess work done on this call

I'm newbie both in calculus and Python/Scipy so I apologize if this question is too dumb. I'm trying to model flow between two pressure vessels. Let's say we have two points and a link between them ...
4
votes
0answers
75 views

Large residual when integrating 2nd order ode close to singularity with SciPy ode / ODEPACK

I am trying to integrate a 2nd order ODE with a singularity at close to the initial condition. Why do I get large residuals when I plug-in the result of my integration back into the ODE? The equation ...
5
votes
2answers
659 views

How to impose boundary conditions on eigenfunction problems?

I am trying to solve for the eigenfunctions of a (1D) differential operator using finite differences: $$A \, f(x) = \lambda f(x)$$ Here is an example in Python where $A = \partial_x^4$: ...
1
vote
1answer
82 views

methods for a peculiar BVP system

Consider the following system defined on the open interval (-1, 1): $y_1' = c y_3 \\ y_2' = c y_4 \\ y_3' = -f(y_1, y_2)y_2 \\ y_4' = f(y_1, y_2)y_1 $ given $ y_3(-1) = 0 = y_3(1) \\ ...