Questions tagged [odeint]

Odeint is a modern C++ library for numerically solving Ordinary Differential Equations.

Odeint is designed in a very flexible way such that the algorithms are completely independent of the underlying containers and even from the basic algebraic computations. That means odeint works not only with the standard containers like vector< double > or array< double , N > but also nicely cooperates with many other libraries.

Odeint can solve ODEs on GPUs by using nVidia's CUDA technology.

512 questions
22
votes
6 answers

Pass args for solve_ivp (new SciPy ODE API)

For solving simple ODEs using SciPy, I used to use the odeint function, with form: scipy.integrate.odeint(func, y0, t, args=(), Dfun=None, col_deriv=0, full_output=0, ml=None, mu=None, rtol=None, atol=None, tcrit=None, h0=0.0, hmax=0.0, hmin=0.0,…
sharkmas
  • 285
  • 1
  • 2
  • 8
13
votes
2 answers

Multiple scipy.integrate.ode instances

I would like to use scipy.integrate.ode (or scipy.integrate.odeint) instances in multiple threads (one for each CPU core) in order to solve multiple IVPs at a time. However the documentation says: "This integrator is not re-entrant. You cannot have…
Matthias
  • 263
  • 4
  • 11
11
votes
1 answer

Why isn't the Dfun(gradient) called while using integrate.odeint in SciPy?

Can anyone provide an example of providing a Jacobian to a integrate.odeint function in SciPy?. I try to run this code from SciPy tutorial odeint example but seems that Dfun() (the Jacobian function) is never called. from numpy import * # added from…
lumartor
  • 719
  • 5
  • 11
10
votes
1 answer

Scipy odeint giving lsoda warning

I am totally new to coding and I want to solve these 5 differential equations numerically. I took a python template and applied it to my case. Here's the simplified version of what I wrote: import numpy as np from math import * from matplotlib…
Caeiro
  • 103
  • 1
  • 5
9
votes
1 answer

How to specify numba jitclass when the class's attribute contains another class instance?

I'm trying to use numba to boost the python performance of scipy.integrate.odeint. To this end, I have to use @nb.jit(nopython=True) for the function defining the ODE system. However, this function has to take another python-class instance as an…
hopeso
  • 155
  • 6
8
votes
1 answer

How to solve differential equation using Python builtin function odeint?

I want to solve this differential equations with the given initial conditions: (3x-1)y''-(3x+2)y'+(6x-8)y=0, y(0)=2, y'(0)=3 the ans should be y=2*exp(2*x)-x*exp(-x) here is my code: def g(y,x): y0 = y[0] y1 = y[1] y2 =…
Physicist
  • 2,848
  • 8
  • 33
  • 62
7
votes
2 answers

Using numba.jit with scipy.integrate.ode

Using numba.jit to speed up right-hand-side calculations for odeint from scipy.integrate works fine: from scipy.integrate import ode, odeint from numba import jit @jit def rhs(t, X): return 1 X = odeint(rhs, 0, np.linspace(0, 1, 11)) However…
germannp
  • 197
  • 4
  • 15
6
votes
1 answer

How to get SciPy.integrate.odeint to stop when path is closed?

edit: It's been five years, has SciPy.integrate.odeint learned to stop yet? The script below integrates magnetic field lines around closed paths and stops when it returns to original value within some tolerance, using Runge-Kutta RK4 in Python. I…
uhoh
  • 3,713
  • 6
  • 42
  • 95
5
votes
3 answers

How to monitor the process of SciPy.odeint?

SciPy can solve ode equations by scipy.integrate.odeint or other packages, but it gives result after the function has been solved completely. However, if the ode function is very complex, the program will take a lot of time(one or two days) to give…
袁子奕
  • 51
  • 2
5
votes
1 answer

Differences between two ODE solvers

I am wondering, what are the differences between ODEINT and solve_ivp for solving a differential equation. What could be advantages and disadvantages between them? f1 = solve_ivp(f, [0,1], y0) #y0 is the initial point f2 = odeint(f, y0, [0, 1],…
Ma Y
  • 696
  • 8
  • 19
5
votes
1 answer

ODE solver from Lagrangian/Variational Methods in C++

I have a general question which I will phrase in the context of a more concrete situation. If one wants to find the dynamics of a double pendulum, one can mathematically derive the equations of motions, rewrite the ODEs to have a special form useful…
Heidar
  • 159
  • 1
5
votes
1 answer

Using openmp with odeint and adaptative step sizes

I am trying to use openmp to parallelize my code. Everything works just fine when I use constant step sizes, however when I run the same code using an adaptative stepper I get errors that I don't understand. Here are the essential parts of the code…
user5006513
5
votes
1 answer

Solving Matrix Differential Equation in Python using Scipy/Numpy- NDSolve equivalent?

I have two numpy arrays: 9x9 and 9x1. I'd like to solve the differential equation at discrete time points, but am having trouble getting ODEInt to work. I do am unsure if I'm even doing the right thing. With Mathematica, the equation is: Solution =…
StuckOnDiffyQ
  • 129
  • 1
  • 1
  • 5
5
votes
1 answer

How to pass a vector to the constructor of a thrust-based odeint observer, such that it can be read within the functor

I am extending the parameter study example from boost's odeint used with thrust, and I do not know how to pass a vector of values to the constructor of the observer, such that those values can be accessed (read-only) from within the observer's…
weemattisnot
  • 889
  • 5
  • 16
5
votes
2 answers

scipy odeint with complex initial values

I need to solve a complex-domain-defined ODE system, with complex initial values. scipy.integrate.odeint does not work on complex systems. I rod about cutting my system in real and imaginary part and solve separately, but my ODE system's rhs…
fmonegaglia
  • 2,749
  • 2
  • 24
  • 34
1
2 3
34 35