numerical-methods

Different results when computing integral analytically/with scipy VS approximating integral

Different results when computing integral analytically/with scipy VS approximating integral Question: I’m trying to calculate the integral of a variant of the Hill Equation shown here. When I try implementing this with the integrate function in SciPy, I get the following: from scipy import integrate Top = 0.9015038230670139 Bottom = 0.5972679490151096 ic50 = 17561.998143066336 Coef …

Total answers: 1

Solving system of three differential equations using Runge-Kutta 4 in python

Solving system of three differential equations using Runge-Kutta 4 in python Question: I wrote code for Runge-Kutta 4 for solving system of 3 ODEs I think that it does not work fine for because I solved the system with Euler’s method and I had have the following results But with the RK4’s code attached I …

Total answers: 2

Solving a large (150 variable) system of linear, ordinary differential equations; running into floating point rounding and/or stiffness problems

Solving a large (150 variable) system of linear, ordinary differential equations; running into floating point rounding and/or stiffness problems Question: EDIT: Original post too vague. I am looking for an algorithm to solve a large-system, solvable, linear IVP that can handle very small floating point values. Solving for the eigenvectors and eigenvalues is impossible with …

Total answers: 1

Solving a tridiagonal matrix in python

Solving a tridiagonal matrix in python Question: I have been looking at numerical methods to solve differential equations for chemical reactions. Usually I put the differential equation into a tridiagonal matrix using finite difference method, and then using a column vector for the boundary conditions. Once I have the matrix and vector I use scipy’s …

Total answers: 1

Bifurcation diagram of dynamical system

Bifurcation diagram of dynamical system Question: TL:DR How can one implement a bifurcation diagram of a seasonally forced epidemiological model such as SEIR (susceptible, exposed, infected, recovered) in Python? I already know how to implement the model itself and display a sampled time series (see this stackoverflow question), but I am struggling with reproducing a …

Total answers: 1

Unable to reproduce simple figure from textbook (possible numerical instability)

Unable to reproduce simple figure from textbook (possible numerical instability) Question: I am trying to reproduce figure 5.6 (attached) from the textbook "Modeling Infectious Diseases in Humans and Animals (official code repo)" (Keeling 2008) to verify whether my implementation of a seasonally forced SEIR (epidemiological model) is correct. An official program from the textbook that …

Total answers: 1

Python implementation of n-body problem issue

Python implementation of n-body problem issue Question: I am currently trying to implement the N-body problem using Euler’s method for solving differential equations. However, the graphical outputs do not seem correct, and I’m not sure where the issue in my code is after a while of testing. I’m currently using approximate values for Alpha Centauri …

Total answers: 1

Runge Kutta constants diverging for Lorenz system?

Runge Kutta constants diverging for Lorenz system? Question: I’m trying to solve the Lorenz system using the 4th order Runge Kutta method, where dx/dt=a*(y-x) dy/dt=x(b-z)-y dx/dt=x*y-c*z Since this system doesn’t depend explicity on time, it’s possibly to ignore that part in the iteration, so I just have dX=F(x,y,z) def func(x0): a=10 b=38.63 c=8/3 fx=a*(x0[1]-x0[0]) fy=x0[0]*(b-x0[2])-x0[1] …

Total answers: 3