Questions tagged [ode]

An ODE (ordinary differential equation, in contrast to partial differential equation) is a differential equation containing a function or functions of exactly one independent variable.

An ODE (ordinary differential equation, in contrast to partial differential equation) is a differential equation containing a function or functions of exactly one independent variable. Equations of this type can be solved numerically or analytically.

1902 questions
4
votes
1 answer

Solve ODEs with discontinuous input/forcing data

I'm trying to solve a system of coupled, first-order ODEs in Python. I'm new to this, but the Zombie Apocalypse example from SciPy.org has been a great help so far. An important difference in my case is that the input data used to "drive" my system…
JamesS
  • 310
  • 3
  • 10
4
votes
0 answers

Why are non-integer exponents causing nan's to show up in Python?

I am trying to numerically solve the Lane-Emden equation in Python using the scipy.integrate.ode class. For some reason, my code works for integer values of n (the polytropic index) such as 3, but not for non-integer values such as 2.9 and 3.1. I…
user112829
  • 491
  • 1
  • 4
  • 7
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
4
votes
1 answer

Simulating electron motion - differential equation with adaptive step size in python

I am trying to simulate how the oscillating electric field of an intense laser will push around an electron that is near the Coulomb potential of a +1 ion. The laser field is E = Eo sin(wt), in the y direction. and the Coulomb potential is F = ke…
DanHickstein
  • 6,588
  • 13
  • 54
  • 90
4
votes
1 answer

solving ODEs on networks with PyDSTool

After using scipy.integrate for a while I am at the point where I need more functions like bifurcation analysis or parameter estimation. This is why im interested in using the PyDSTool, but from the documentation I can't figure out how to work with…
olga.bio
  • 281
  • 3
  • 15
4
votes
2 answers

Emulating MATLAB's ode15s in Python

I am working on translating a model from MATLAB to Python. The crux of the model lies in MATLAB's ode15s. In the MATLAB execution, the ode15s has standard options: options = odeset() [t P] = ode15s(@MODELfun, tspan, y0, options, params) For…
user3780330
  • 71
  • 1
  • 5
4
votes
1 answer

Understanding matlabFunction

I have been using matlabFunction rather extensively in my computational physics class, and I was hoping someone could help me understand what exactly is going on with this command (is matlabFunction a command?). I have read what the MathWorks…
Mack
  • 665
  • 2
  • 11
  • 20
4
votes
1 answer

scipy 0.11.0 to 0.12.0 changes a linear scipy.interpolate.interp1d, breaks my constantly updated interpolator

I have been playing around with a package that uses a linear scipy.interpolate.interp1d to create a history function for the ode solver in scipy, described here. The relevant bit of code goes something like def update(self, ti, Y): """ Add…
Ben
  • 433
  • 4
  • 6
4
votes
2 answers

Matlab: if statements and abs() function in variable-step ODE solvers

I was reading this post online where the person mentioned that using "if statements" and "abs()" functions can have negative repercussions in MATLAB's variable-step ODE solvers (like ODE45). According to the OP, it can significantly affect time-step…
Kimusubi
  • 155
  • 1
  • 8
4
votes
1 answer

Matlab: CVODE interface that takes normal Matlab ODE arguments

CVODE is one of two ODE solvers that are part of the popular SUNDIALS package. There is a Matlab interface provided, but the usage is not the same as the standard Matlab ode* interface. One has to init the solver, then step through each time point…
drhagen
  • 8,331
  • 8
  • 53
  • 82
3
votes
1 answer

complex ODE systems in scipy

I am having trouble sovling the optical bloch equation, which is a first order ODE system with complex values. I have found scipy may solve such system, but their webpage offers too little information and I can hardly understand it. I have 8 coupled…
user1233157
  • 345
  • 3
  • 5
  • 11
3
votes
2 answers

Why does my deSolve model in R stop integrating when I incorporate a conditional source of mortality in my population model?

I have constructed a population model in R to identify the efficacy of potential control strategies for the cockroach population in my apartment. I have introduced a term that will add an additional source of mortality to the adult cockroach…
3
votes
1 answer

Issues with complex numbers when solving ode in python

I have the following code: import numpy as np from matplotlib import pyplot as plt from scipy.integrate import odeint exp = np.exp pi = np.pi def func(y, t, W, omega, delta, omega_Rabi): c_up, c_down = y dydt =…
JohnDoe122
  • 638
  • 9
  • 23
3
votes
1 answer

Python GEKKO ODE unexpected results

I've been trying to implement an ODE model for simulation of the insulin signaling pathway, as it is presented in the supplementary material of this paper, using python's GEKKO. The model variation implemented was the ‘Md3’, with the following…
nefeli
  • 53
  • 4
3
votes
2 answers

Running LSODA.jl examples on Apple M1

I am trying to run some code in Julia that solves ODEs using LSODA on my M1 macbook pro. Everything works fine on my linux machine, but despite a lot of googling I cannot figure out how to solve this on my mac. The issue already appears trying to…
Vanessa
  • 41
  • 2