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
3
votes
3 answers

using scipy odeint on equations with a phase shifted variable

Basically... I need a way to include a phase shift in my differential equations. That is, I have in the definition of my system function which returns dY/dt something like Y(t-3). Like this differential equation: dY/dt = a*Y(t) + b*Y(t-tau) Now if…
7yl4r
  • 4,788
  • 4
  • 34
  • 46
2
votes
0 answers

Changing an ODE inside the function with ODEINT and python

This is my first question here on the forum, so I hope I'm doing evrything right. My problem is, I am supposed to solve an ODE with python. The ODE describes the movement of an electron inside of a "bubble" (a bubble is something that occurs in…
GhastM4n
  • 21
  • 2
2
votes
2 answers

boost odeint gives very different values from Python3 scipy

I am trying to integrate a very simple ODE using boost odeint. For some cases, the values are the same (or very similar) to Python's scipy odeint function. But for other initial conditions, the values are vastly different. The function is: d(uhat)…
Madeleine P. Vincent
  • 3,361
  • 5
  • 25
  • 30
2
votes
1 answer

Differences between Rs deSolve and Pythons odeint

I'm currently exploring the Lorenz system with Python and R and have noticed subtle differences in the ode packages. odeint from Python and ode both say they use lsoda to calculate their derivatives. However, using the lsoda command for both seems…
AW27
  • 481
  • 3
  • 15
2
votes
0 answers

finding amplitude from displacement graph

I have been trying to model a problem of forced driven oscillator and plotting the graph for displacement vs time period for various parameter values using scipy.integrate module odeint. here is the code %matplotlib notebook import numpy as…
2
votes
1 answer

How to include time as a variable in Python Gekko?

I need to include time in my model for the solution of a complex set of differential equations. Here is a simple problem that demonstrates the issue with constant k=0.1 and initial condition y(0)=10. I tried it in Python Gekko but can't figure out…
TexasEngineer
  • 684
  • 6
  • 15
2
votes
1 answer

Using python built-in functions for coupled ODEs

THIS PART IS JUST BACKGROUND IF YOU NEED IT I am developing a numerical solver for the Second-Order Kuramoto Model. The functions I use to find the derivatives of theta and omega are given below. # n-dimensional change in omega def d_theta(omega): …
2
votes
0 answers

Solve the same ODE for different initial condition in odeint (C++)

I want to solve the same ODE but with several different initial conditions. I can solve with one fixed initial condition, for instance, in the example I have chosen x[0]=x[1]=x[2]=10.0. How could I create a while loop to solve the ODE for…
Ninpou
  • 33
  • 3
2
votes
0 answers

How to Animate a 3D graph on Python

I'm looking to animate my graph (below) and I'm not sure where or how to start since I have no experience animating. I'm not sure how it works or what the structure of the code should be, so if someone can offer a pseudo-code or an algorithm, I…
theheretic
  • 57
  • 6
2
votes
1 answer

choose stepper in odeint through if statement

I want to choose integration scheme through a if statement like this: //stepper_type steppr; ?? if (integration_scheme == "euler") { [auto] stepper = euler{}; } else { [auto] stepper = runge_kutta4{}; } but stepper…
Abolfazl
  • 1,047
  • 2
  • 12
  • 29
2
votes
1 answer

Why does odeint fail with the newer versions of odeint?

I was struggling with the new version of boost. I am using odeint with mupltiprecision. The following piece of code can be successfully compiled with boost version 1.67.0. However, since version 1.68.0 and newer, I can no longer compile. In version…
Schnarco
  • 183
  • 4
2
votes
1 answer

How to go through exact points with solve_ivp?

I have a system of ODE, and I want to change the value of the variables when the solver reaches an exact point in time. What I'm trying to do is similar to this example in Julia What I've tried is to do is using else and if to check if the time t…
Eiem Lupus
  • 23
  • 3
2
votes
1 answer

Dymension error on code for solving first order coupled ODE with odeint

I've written this code for a first order ODE system, but apparently python understands 'y' as an integer when I meant it to be a list. Can someone see the mistake? I simply don't know where it is. import matplotlib.pyplot as plt from scipy.integrate…
Rebeca
  • 35
  • 5
2
votes
1 answer

Is there a way to force ODEINT to use a specific algorithm in Python?

From what I have seen, odeint seems to automatically decide what sort of algorithm it wants to use. However, the math that I am using is sufficiently finicky in converging that I want to have more control over which algorithm gets used. I've tried…
2
votes
1 answer

How to graph the second derivatives of coupled non-linear second order ODEs in Python?

I am very new to Python and have written this code to model the motion of a spring pendulum: import numpy as np from scipy.integrate import odeint from numpy import sin, cos, pi, array import matplotlib.pyplot as plt init = array([0,pi/18,0,0])…