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 from 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 coorperates with many other libraries.

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

459 questions
20
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
  • 255
  • 2
  • 8
12
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
  • 223
  • 3
  • 11
10
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
  • 562
  • 4
  • 11
6
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
  • 301
  • 3
  • 12
6
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
  • 63
  • 1
  • 4
6
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,250
  • 7
  • 22
  • 48
5
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
  • 115
  • 6
5
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,168
  • 4
  • 26
  • 78
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

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
  • 827
  • 4
  • 15
4
votes
1 answer

Do controlled error steppers in boost odeint support complex data types?

I encountered a problem with the odeint library using a controlled error stepper together with a complex state type. The code from the example with the complex stuart landau equation, I modified such that it includes an adaptive integrator. The code…
Schnarco
  • 173
  • 4
4
votes
1 answer

How to solve a differential equation for different initial conditions

I want to solve a differential equation continuously by changing the initial conditions only. I have tried a lot but didn't find any suitable process to do that properly. Can anyone please share any idea about that. For your kind consideration I'm…
Photon
  • 167
  • 2
  • 10
4
votes
1 answer

Solution for differential equation is completly different in boost::odeint and scipy.integrate

I am trying to port my rapid prototyping from python to C++. I try to test the notation with a simple differential equation, but the results are very different for starting value [2,0]. Python is declining, while the C++ solution is rising…
atec01
  • 43
  • 2
4
votes
1 answer

Can I integrate with scipy's odeint until a local max is found?

This is my first question on here, so please go easy on me. I'm wondering if there is a way to integrate an ODE system only until a local max of a specified variable is found. Here is some more detail: Let's call our ODE system dX/dt = F(X) where…
JBOT
  • 41
  • 4
1
2 3
30 31