Skip to main content

All Questions

Filter by
Sorted by
Tagged with
51 votes
2 answers
14k views

What does "symplectic" mean in reference to numerical integrators, and does SciPy's odeint use them?

In this comment I wrote: ...default SciPy integrator, which I'm assuming only uses symplectic methods. in which I am refering to SciPy's odeint, which uses ...
uhoh's user avatar
  • 1,088
1 vote
1 answer
15k views

Python Finite Difference Schemes for 1D Heat Equation: How to express for loop using numpy expression

Hello all, I've recently been introduced to Python and Numpy, and am still a beginner in applying it for numerical methods. I've been performing simple 1D diffusion computations. I suppose my ...
Leonardo Parra García's user avatar
13 votes
2 answers
8k views

Numerical computation of Lyapunov exponent

I'm trying to compute the Lyapunov exponent for a smooth continuous time dynamical system(say, $\dot{\bar{x}} = f(\bar x)$). I using the QR decomposition method. Here are the steps that I follow. ...
sbp's user avatar
  • 263
10 votes
3 answers
2k views

Numerical integration of ODEs: Why does higher accuracy and precision not lead to convergence?

I'm trying to integrate numerically a non-linear ODE that, on paper, is simple (just the damped, forced pendulum), but that, as well known, its dynamics displays a chaotic behavior and is very ...
Mark's user avatar
  • 233
7 votes
2 answers
16k views

Solving coupled differential equations in Python, 2nd order

I have a system of coupled differential equations, one of which is second-order. I am looking for a way to solve them in Python. I would be extremely grateful for any advice on how can I do that! $k$...
poisonedivy's user avatar
6 votes
3 answers
727 views

Finite difference for 1D wave equation: why the spike initial data results in a noisy output?

I am using a second-order finite difference in space and time approximation for the 1D wave equation. No source but initial data: $I(x)=\mathrm{e}^{-400 (x-0.5)^2}$. Velocity $c=1$, $nx=501$, $nt=...
Herman Jaramillo's user avatar
4 votes
1 answer
534 views

Fast and free server for computing

I have to calculate a huge differential equation. With my laptop, it's going to be computed for several days. Is there a free (I need just for 3 days) fast server for scientific calculations? My ...
Leeloo's user avatar
  • 143
4 votes
3 answers
1k views

How can I numerically integrate the Kepler problem?

I tried to solve a simple Kepler problem numerically. I have discrete time steps, a starting position $(x_0,y_0)$ and starting velocity $(u_0, v_0)$. I used this iteration by calculating the forces ...
MichaelW's user avatar
  • 151
3 votes
1 answer
1k views

Boundary value problem with singularity and boundary condition at infinity

I'm trying to solve the following boundary value problem on $[0,\infty]$: $$f^{\prime \prime}=-\frac{1}{r} f^{\prime}+\frac{1}{r^{2}} f+m^{2} f+2 \lambda f^{3}$$ $$f(0)=0 \ ; f(\infty)=\sqrt{-m^2/(2\...
math_lover's user avatar
2 votes
1 answer
417 views

MATLAB's ode45 not dealing with initial conditions well [RESOLVED]

*Concern highlighted in yellow *Solution at bottom I have a differential equation to solve for the motion of an electron: $$ \frac{d^2v}{dt^2} = \frac{1}{\gamma^6}\left( \frac{eE}{\tau m} - \left( \...
MurderOfCrows's user avatar
1 vote
2 answers
1k views

How to set up the differential equation system to speed up computation?

I've set up a system of differential equations, obtained after discretizing pde, in the following way ...
Natasha's user avatar
  • 433
0 votes
2 answers
503 views

Can the Crank-Nicolson Method Be used to Solve The Schrodinger Equation with a Time Varying Potential?

I have been following an excellent article about how to use the Crank-Nicolson method to solve the Schrodinger equation. In the article, it starts with a $V(x, y, t)$ but the potential seems to become ...
cgbsu's user avatar
  • 33
5 votes
2 answers
3k views

CUDA & Python for numerical integration and solving differential equations

Can anyone please suggest some libraries which allow use CUDA in Python for numerical integration and/or solving of differential equations? My goal is to solve large (~1000 equations) of coupled non-...
Artem Alexandrov's user avatar
5 votes
2 answers
775 views

Specifying ode solver options to speed up compute time

I'm specifying the 'JPattern', sparsity_pattern in the ode options to speed up the compute time of my actual system. I am sharing a sample code below to show how I ...
Natasha's user avatar
  • 433
3 votes
1 answer
2k views

Solving the heat diffusion equation with source term

I am trying to solve the 1-D heat equation numerically with a variable source term. The system is basically a tank containing styrene in which it polymerizes to liberate heat. I have assumed that the ...
Nishant Kumar Gupta's user avatar
3 votes
2 answers
928 views

Python bifurcation diagram of seasonally forced epidemiological models

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 ...
Jared Frazier's user avatar
3 votes
2 answers
2k views

Solving numerically the 1D Kuramoto-Sivashinsky Equation using spectral methods

Lately, I've been trying to solve numerically the 1D Kuramoto-Sivashinsky Equation using spectral methods. Let $\nu$ be the viscosity and $[0,L]$ the domain. The 1D equation is, $$ u_t + uu_x + u_{xx} ...
Mathieu Rousseau's user avatar
3 votes
2 answers
523 views

Runge Kutta and Milstein – system of second-order coupled differential equations with noise

I would like to solve a system of second-order differential equations to describe the dynamics of a system of particles. Two Newton-like forces are responsible for the motion of each particle $i$: A ...
user25195's user avatar
2 votes
1 answer
411 views

Where am I making a mistake in solving the heat equation using the spectral method (Chebyshev's differentiation matrix)?

I would like to numerically solve the following heat equation problem: $$ u_t = \Bigg(2{a \over l}\Bigg)^2 u_{xx} \tag 1$$ $$ x \in [ -1, 1 ] \tag 2$$ $$ u(x, 0) = 0 \tag 3$$ $$ u(1, t) = A \sin \Bigg(...
FriendlyNeighborhoodEngineer's user avatar
2 votes
1 answer
424 views

Numerical computation of Lyapunov exponents: how to find convergence or non-convergence efficiently?

I am wondering what are the standards for convergence of Lyapunov exponents (and Kaplan-Yorke dimension)? For example, I have a MATLAB code to calculate Lyapunov exponents for the classic Lorenz ...
Axel Wang's user avatar
  • 307
2 votes
3 answers
195 views

Numerically finding constants of motion

Given a set of ODE's $ \dot{z} = f(z) $ (or discrete time $ z_{t+1} = f(z_t) $), is there a way to numerically find constants of motion? For $ f(z_t) \approx M z_t $, diagonalizing the matrix $ M $ ...
user avatar
1 vote
1 answer
2k views

How to solve heat equation in spherical coordinates with finite differences?

I have a problem dealing with heat transfer which is spherically symmetrical. I was thinking it should be possible to solve this as a 1d problem in spherical coordinates using the radius only. ...
Alex I's user avatar
  • 111
1 vote
1 answer
2k views

scipy odeint: excess work done on this call and very sensitive to initial value

I am trying out odeint and received the error 'Excess work done on this call (perhaps wrong Dfun type).'. The values returned are also super sensitive to small ...
b-dog's user avatar
  • 13
1 vote
1 answer
349 views

Crank-Nicholson for diffusion-advection vs diffusion equation

Let's consider the following 1D diffusion equation: $\frac{\partial u}{\partial t} = xk \frac{\partial}{\partial x}(\frac{1}{x}\frac{\partial u}{\partial x})$ where we assume that the diffusion ...
mfnx's user avatar
  • 172
1 vote
2 answers
194 views

Solving a parameter estimation problem using trajectory optimization

This is a follow-up to my previous question here I've the following system of equations for studying information flow in the below graph, $$ \frac{d \phi}{dt} = -M^TDM\phi + \text{noise ...
Natasha's user avatar
  • 433
0 votes
2 answers
647 views

Why is this scipy.root code not converging?

I'm running a test problem to set up larger problems. Solving the simple unsteady heat equation via finite differences: $$ \frac{\partial T}{\partial t} = \alpha \frac{\partial^2T}{\partial x^2}$$ $\...
Klaus3's user avatar
  • 133