Questions tagged [differential-equations]

For questions about solving, analyzing, or creating differential equations to model some system. If possible, include specific tags about the type of differential equation (e.g. [tag:pde], [tag:ode], [tag:stochastic-ode]).

Filter by
Sorted by
Tagged with
-2 votes
0 answers
38 views

Setting up boundary conditions to solve PDEs using method of lines

Objective: To add boundary/initial conditions (BCs/ICs) to a system of ODEs I have used the method of lines to convert a system of PDEs into a system of ODEs. The ODEs themselves involve a lot of ...
user avatar
1 vote
0 answers
57 views

Implementation of integration schemes for ordinary differential equations in Python and peformance comparison

I look for a book/manual where I can find implementations of different integration schemes for ordinary differential equations (like 4-th order Runge-Kutta) in Python with Numba. To be more specific, ...
user avatar
0 votes
0 answers
69 views

How to estimate stability and stiffness of a system of coupled ODEs?

I'm running into issues with Python/Julia ODE solvers requiring prohibitively small timesteps to evolve a system of 4 coupled ODEs (the order of magnitude of the state variables and time unit span ~40-...
user avatar
2 votes
1 answer
107 views

2nd order differential equation coupled to integro-differential equation in python

I'm trying to solve the following equations numerically in python $$\begin{align} 12\pi\int_0^\infty drf(r)\phi(r)r^4&=E\\ f(r)-\frac{1}{2\mu}\bigg(\frac{d^2\phi(r)}{dr^2}+\frac{2}{r}\frac{d\phi(r)...
user avatar
2 votes
1 answer
93 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\...
user avatar
0 votes
1 answer
78 views

How to deal with solving coupled ODE systems where variables are updated multiple times within each timestep?

I'm solving a system of coupled ODEs using Euler integration for simplicity. To make this concrete, please see the (extremely simplified) minimal working example below in Python. Imagine we have a box ...
user avatar
2 votes
0 answers
49 views

Implementation of Jeffery equation in FVM solver

I am trying to implement the Jeffery equation in a Finite Volume Method solver: The equation reads: $$ \frac{\mathrm{d} \mathbf{A}}{\mathrm{d} t} = \mathbf{W} \cdot \mathbf{A} - \mathbf{A} \cdot \...
user avatar
1 vote
0 answers
71 views

Well-conditioned pseudospectral for computing eigenvalues to (partial) differential equations

I am working on writing a Chebyshev pseudospectral method (see for example "Chebsyhev and Fourier spectral methods" by John Boyd) to solve for the eigenvalues of differential equations of ...
user avatar
0 votes
0 answers
18 views

Transparent Boundary Conditions relationship with intermediate BCs in ADI-PR method

I have read some materials about ADI - PR method with the aim to understand how to put boundary conditions in my 2D scheme which solves the Time-Dependent Schrodinger Equation. All the theory I read ...
user avatar
  • 131
0 votes
0 answers
69 views

Finite difference solver for the 2D Poisson's equation with an integral boundary condition

I wanted to attempt an implementation of a finite-difference-based solver for the 2D elctrostatic Poisson equation when metallic objects are present. Also, I hope to take as input, the location of ...
user avatar
1 vote
1 answer
67 views

solving a Algebraic Differential Equation in Julia using modelingToolKit.JL

I'm trying to solve a differential algebraic equation in Julia's modelingTookKit.JL, where the vector field has the form f(X) = 0. I found an example of a DAE in the below link modelingToolkit.JL DAE](...
user avatar
2 votes
1 answer
111 views

DG method for solving Hyperbolic Partial Differential Equation with Dirichlet Boundary Conditions

Consider the following partial differential equation \begin{align} \frac{\partial u}{\partial t}+\frac{\partial f}{\partial x} &= g(x,t), \ \ x\in \Omega = [x_{L},x_{R}] \\ u(x,0) &= u_{0}(x) ...
user avatar
3 votes
1 answer
121 views

How to solve a BVP with known parameters?

I need to solve a boundary value problem (BVP) of second order, where the equation depends on several know parameters, which are geometric parameters and material constants. I would like to solve this ...
user avatar
3 votes
1 answer
117 views

Solving DAE in Julia using GPUs

I'm trying to solve a Differential Algebraic Equation (DAE) in Julia which is very computationally expensive using GPUs. I'm brand new to Julia and don't have much experience coding with GPUs. The ...
user avatar
0 votes
0 answers
71 views

Solving an apparently tricky geodesic BVP in Matlab

I want to be able to solve the BVP $$\ddot \mu_k = -\frac{\mu_k}{2} \left ( \sum_{i=1}^n \frac{\dot \mu_i^2}{\mu_i} - \frac{\dot \mu_k^2}{\mu_k^2} + \frac{ \left [ \sum_{i=1}^n \dot \mu_i \right ]^2}{\...
user avatar
0 votes
0 answers
56 views

Solve simultaneous differential equations with embedded functions and a parameter estimation

The aim is to solve the below equations and plot $m$ with time, i.e. $\frac{dm}{dt}$ $k$ is unknown and needs to be estimated. For the parameter estimation, the below values in the table for m versus ...
user avatar
3 votes
2 answers
185 views

Is there a Python version of the ODE tool pplane?

This is the same question as this one, except for Python instead of Mathematica. Basically, the MATLAB software PPLANE is a staple in ODE courses. Is there a Python equivalent? I don't know much about ...
user avatar
2 votes
1 answer
85 views

Implicit integrator for ODE with quadratic right-hand side

I have an ODE for an unknown $x(t):[0,\infty)\to\mathbb R^n$ of the following form: $$ x_i'(t)=a_i^\top x(t) + x(t)^\top Q_i x(t), $$ for $i\in\{1,\ldots,n\}$. Here, the vectors $a_i\in\mathbb R^n$ ...
user avatar
1 vote
2 answers
373 views

Recommendations for ODE solvers for stiff equations

I'm continuing the research of a former Ph.D. student in my group requiring the solution of a system of ODEs. On a technical note, they wrote: The system of Boltzmann equations behaves numerically ...
user avatar
2 votes
0 answers
112 views

Floquet theory for periodic delay differential equations: current numerical routines

I would like to determine the stability of a system of periodic delay differential equations (a seasonal host-parasite model). I've tried to implement the method described in Lemma 2.5 in this paper: ...
user avatar
  • 21
1 vote
1 answer
586 views

solve_ivp from scipy does not integrate the whole range of tspan

I'm trying to use solve_ivp from scipy in Python to solve an IVP. I specified the tspan ...
user avatar
0 votes
1 answer
59 views

Logistic growth curve using scipy is not quite right

I'm trying to fit a simple logistic growth model to dummy data using Python's Scipy package. The code is shown below, along with the output that I get. The correct ...
user avatar
9 votes
1 answer
631 views

How to solve a second order differential equation (diffusion) with boundary conditions using Python

I am having trouble implementing a model from a publication. Huang, K-L.; Holsen, T.M.; Selman, J.R. Ind. Eng. Chem. Res. 2003, 42, 15, 3620–3625 scihub link: https://sci-hub.se/10.1021/ie030109q I ...
user avatar
3 votes
4 answers
172 views

Solving the eigenvalue from a set of coupled second order differential equation numerically

I met a problem in solving a set of coupled differential equation, as shown below: $$A_1\psi_1(z)+A_2\frac{d^2\psi_1(z)}{dz^2}+A_3\frac{d\psi_2(z)}{dz}=\lambda\psi_1(z)$$ $$A_4\psi_2(z)+A_5\frac{d^2\...
user avatar
3 votes
0 answers
88 views

Numerical Soultion to Background equations of cosmology

I am trying to solve the background equations of cosmology numerically using Runge-Kutta Dormand Prince method with simplified assumption $8\pi G=1$ and $c=1$. The equations are $$\ddot a = - \frac{1}{...
user avatar
  • 39
0 votes
0 answers
29 views

How to solve nonlinear second order ODE in Matlab? [duplicate]

I am working on simulating a car suspension system using Matlab. Specifically, I have to derive equation of motion using the Lagrange method and then use ode 45 to solve it. However, while using ...
user avatar
7 votes
0 answers
155 views

Is there a graphical interpretation or explanation of automatic differentiation compared to numerical differentiation

I have been looking at automatic differentiation for solving differential equations lately. I understand the basic ideas of using Dual numbers and such for finding derivatives, etc. However, I feel ...
user avatar
  • 245
0 votes
1 answer
39 views

How to decrease error in (FTCS) forward time centered space method?

I am using the FTCS method for solving differential equations. I know that the condition for stable output is $$ \frac{\alpha \Delta t}{\Delta x ^2} < \frac{1}{2} $$ But when I use the distance ...
user avatar
4 votes
1 answer
90 views

Finite Volume on Cubed Sphere

The US weather model uses an uncommon (?) discretization called 'Finite Volume on Cubed Sphere'. To avoid the singularities that occur at the poles when using lat/lon discretization, they instead ...
user avatar
  • 43
0 votes
0 answers
23 views

Why does this Non-Standard FDTD implementation lead to infinite increase in the magnitude of an EM pulse?

I have been working on a Particle-In-Cell Framework in Python and have noticed an issue where the magnitude of a EM pulse increasing infinitely as the simulation updates. Currently, I am using the Non-...
user avatar
5 votes
2 answers
589 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 ...
user avatar
  • 581
3 votes
1 answer
514 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} ...
user avatar
4 votes
1 answer
88 views

Geometric integrators besides midpoint/Crank-Nicolson?

I have a first-order ODE $$ \dot{x} = a(t) \times x, \quad x(0) \in\mathbb{R}^3. $$ with $\|a(t)\| = 1 \;\forall t$. Consequently, $\|x(t)\|=\|x(0)\|$ for all $t>0$. I would like this to be ...
user avatar
3 votes
2 answers
340 views

How to solve second order coupled non linear differential equations

For a project I am doing, I have to solve the following system of differential equations numerically using my own code: $$ x^2K'' = KH^2 + K(K^2-1) $$ and, $$ x^2H'' = 2K^2H + \alpha H(H^2-x^2) $$ ...
user avatar
  • 41
1 vote
1 answer
98 views

Numerical integrator for $a'(t)=e^{-a(t)}f(t)$

Suppose I know a function $f(t)$ and all its derivatives in $t$ in closed form. Given $a(0)$ and some $t_0>0$, I'm looking for an explicit integrator that can estimate $a(t_0)$, where $a(\cdot)$ ...
user avatar
1 vote
1 answer
239 views

Finite Element Method for 1D Poisson Equation with Inhomogeneous Boundary Conditions

Im trying to solve the Poisson equation in 1D: $$-u_{xx} = f(x), \hspace{6mm} u(a) = d1, \hspace{2mm} u(b) = d2$$Assuming a uniform partition such that $x_n = a + nh$, where $h = (b-a)/N$ and $n \in [...
user avatar
  • 123
2 votes
0 answers
137 views

Find time step for Euler method in numerical solving of a system of non linear differential equations

I have a system of non linear differential equations in the form : $$\frac{dy_i}{dt}=\sum_j a_{ij} y_i y_j $$. I first tried to solve it with Python suing ...
user avatar
  • 171
0 votes
1 answer
73 views

2 point BVP solver: how to compute errors

Background I am working with chapter 2 in LeVeque's book: https://faculty.washington.edu/rjl/fdmbook/ I have build my own solver in Python to solve the 2 point BVP: $$ \epsilon u''+u(u'-1) =0 , \\ u(0)...
user avatar
  • 255
1 vote
0 answers
102 views

Stochastic differential equation system (SDE) : overflow encountered in double-scalars

I'm trying to integrate the following SDE system from Dekker et al. [1] $$\begin{cases} \frac{dx}{dt}=a_1x^3+a_2x+\phi+\zeta_x\\ \frac{dy}{dt}=b_1z+b_2(\kappa(x)-(y^2+z^2))y+\zeta_y\\ \frac{dz}{dt}=...
user avatar
4 votes
2 answers
1k 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-...
user avatar
3 votes
0 answers
70 views

Difference between wave vector and density matrix in numerical calculation of Schrödinger equation

I solved Schrödinger equation for a following tow-level time-dependent Hamiltonian numerically in two ways: ...
user avatar
  • 31
0 votes
0 answers
365 views

Numerov method for solving Schrödinger equation

I have just begun learning computer science to apply it to Physics and I am trying to write a code for solving Schrödinger's equation of the harmonic oscillator (setting $V=\frac{x^2}{2}$) in one ...
user avatar
-2 votes
1 answer
64 views

Solving differential equation by setting vectorization `on` in MATLAB

This is a follow up to my previous question posted here. I've set up an ode system in MATLAB and I'm trying to vectorize the code to increase the speed of computation. The follow is the code for my ...
user avatar
  • 581
1 vote
1 answer
60 views

solving differential equations with jacobian pattern

I'm trying to compare the simulation time for solving a system of differential equations with and without jacobian pattern for a toy model using ode15s in MATLAB. ...
user avatar
  • 581
2 votes
0 answers
74 views

Linearising Nonlinear Coupled Partial Differential Equations - Alfvénic Diffusion

I am trying to solve the following coupled partial differential equations with a finite difference scheme: $$\partial_tf+v\partial_zf+\partial_z\frac{1}{W}\partial_zf=0$$ $$\partial_tW+v\partial_zW-\...
user avatar
0 votes
2 answers
875 views

Solve a system of coupled differential equations in Python

I have a system of two coupled differential equations, one is a third-order and the second is second-order. I am looking for a way to solve it in Python. I would be extremely grateful for any advice ...
user avatar
  • 33
7 votes
1 answer
160 views

Which finite difference better approximates $uu'$?

I want to approximate $uu'$ with a finite difference. On the one hand, it seems to be $$(uu')_i=u_i\frac{u_{i+1}-u_{i-1}}{2\Delta t}=\frac{u_iu_{i+1}-u_iu_{i-1}}{2\Delta t}$$ On the other hand, $$(uu')...
user avatar
-1 votes
1 answer
2k views

ODEintWarning: Excess work done on this call (perhaps wrong Dfun type)

I was messing around with some numerical integration functions. I wrote an arbitrary differential equation to test my understanding, the code is as follows: ...
user avatar
1 vote
0 answers
69 views

Book recommendation on numerical methods for solving Integro-Differential equations

I was wondering if anyone could recommend a good book or resource on numerical methods for solving integro-differential equations? Of course I am familiar with the methods for solving ODEs and PDEs ...
user avatar
  • 245
1 vote
1 answer
538 views

Trouble with backwards time integration in Python

I am struggling with a rather basic numerical integration task: Using Python's scipy.integrate.solve_ivp module to integrate an ODE sytem backwards in time. As a test, I am using the following ODE ...
user avatar
  • 143