Questions tagged [differential-equations]
The differential-equations tag has no usage guidance.
116
questions
7
votes
1answer
135 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')...
-1
votes
1answer
34 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:
...
2
votes
0answers
49 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 ...
1
vote
1answer
63 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 ...
2
votes
0answers
73 views
How to derive the adjoint sensitivity equations for a least squares objective function gradient
The Problem
I would like to determine the gradient of a least squares objective function which depends on a vector of 40 parameters $p$, and the solution of a system of 32 differential equations. In ...
1
vote
1answer
47 views
Solution of Coupled Differential equation for a 2d linear flow using RK4 method in python 3
I want to study the dynamics of a 2d linear flow, whose dynamical equation is- $\begin{pmatrix} \dot{x_1}\\ \dot{x_2}\\ \end{pmatrix}=\begin{pmatrix} 1 & 1\\ 4 & -2\\ \end{pmatrix}\begin{...
1
vote
1answer
52 views
2-DOF Robotic Manipulator Trajectory Tracking Simulation
I am trying to simulate a 2-DOF planar robotic manipulator (have its joints follow a predefined trajectory) that's described by its dynamic model:
$$ M(q)\ddot{q}+C(q,\dot{q})\dot{q}+G(q) = \tau $$
...
1
vote
1answer
116 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
...
1
vote
1answer
140 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 ...
0
votes
1answer
56 views
Odeint error for nonlineal differential equations
I receive the following error when I run the code.
ODEintWarning: Excess work done on this call (perhaps wrong Dfun
type). Run with full_output = 1 to get quantitative information. warnings.warn(...
7
votes
1answer
175 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.
...
3
votes
1answer
137 views
How to get a more accurate cancelation
I shall try to get to the point, so let me know if there is something left and you need more details.
I am solving a couple of equations that are not coupled explicitly, but their corresponding ...
2
votes
1answer
115 views
A problem with Poisson equation
I'm computing the Hartree potentials of atoms by solving the Poisson equation and I use hydrogen atom as a test case. The Poisson equation for hydrogen atom in atomic units is given by
$$\nabla^2 V_H =...
0
votes
0answers
28 views
Set of integrators do not consistently solve an equation in Python
I must solve the following second order differential equation:
$\delta \phi^{''}_{\mathbf{k}}+(3-\epsilon)\delta \phi^{'}_{\mathbf{k}}+\left(\frac{k^2}{a^2 H^2}+\frac{V_{,\phi\phi}}{H^2}-6\epsilon +4\...
3
votes
1answer
311 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 ...
2
votes
0answers
39 views
How to increase the stability of a DAE solver?
I am trying to solve a set of linear PDEs of the form
$$F\left(\vec{y},\frac{\partial \vec{y}}{\partial x},\frac{\partial^2 \vec{y}}{\partial x^2},\frac{\partial \vec{y}}{\partial t}\right)=0.$$
To ...
2
votes
0answers
37 views
Discretization formula for a system of two differential equations. “Solution to one of these is the initial condition of the other”. In which sense?
Consider the following stochastic differential equation
\begin{equation}
dy=\left(A-\left(A+B\right)y\right)dt+C\sqrt{y\left(1-y\right)}dW\tag{1}
\end{equation}
where $A$, $B$ and $C$ are parameters ...
2
votes
2answers
74 views
Methods for solving discrete PDEs using algorithmic differentiation results
I'm looking for a method to solve a 20000 variable, 20000 residual non-linear PDE with a Galerkin method.
I have Fortran subroutines for:
The residuals: $\vec{r}(\vec{x})$;
Their Jacobian multiplied ...
0
votes
0answers
52 views
Solver for large dense BVP system in python
I have a large system of boundary value problems of the form
$$ \frac{d^2 y }{dt^2} = C(t) y + b(t), $$
where the variable $y$ is a vector that has anywhere from 50 to around 500 components, $C$ is a ...
3
votes
2answers
208 views
Finite difference method having a discontinuity
I am trying to understand the FDM which is a widely used method solving differential equations by using approximation below.
$$\dfrac{\partial u}{\partial x}=\dfrac{u(i+1)-u(i-1)}{2\Delta x}$$
How can ...
0
votes
1answer
96 views
Two RK4 method in one program
I want to solve this integral using RK4 by coding in Fortran:
$$R=ā«1/a(t) dt ā dR/dt=1/a(t) =f(t)$$
Initial point: t=0 (or a=0.001) and R=0
And I have to get a(t) by solving another ...
0
votes
0answers
31 views
Simulating the response of nonlinear system with stiff differential equations
I want to simulate the response of a nonlinear system given in the following form:
$$ \dot{x_1} = f_1(\bar{x_1})+g_1(\bar{x_1})x_2, \ x_1(0) = 0.2 $$
$$ \dot{x_2} = f_2(\bar{x_2})+g_2(\bar{x_2})x_3, \...
1
vote
1answer
100 views
Partial differential equation FEM application
I have a PDE which looks like Helmholtz wave equation on one dimensional domain.
$$\dfrac{d^2u(x)}{dx^2}+\pi^2u(x)=f(x)$$
where $-\infty <x<\infty $
Also, $f(x)= 1$ for $-0.25<x<0.25$, I ...
1
vote
1answer
127 views
How to write a code of 2D ADI method in matlab?
I tried to write a code for the alternating direction implicit (ADI) method in 2D, but I got stuck.
My equation is:
$$\frac{\partial U(t,x,y)}{\partial t} = 2\Delta U(t,x,y) -10(\frac{\partial U(t,x,y)...
0
votes
1answer
40 views
MATLAB ode45 doesn't start at initial conditions
I wrote a code in MATLAB to solve a system of differential equations, but my solution doesn't seem to take into consideration the initial conditions I specified. I am not sure how to interpret this ...
1
vote
3answers
138 views
Runge-Kutta method for an ODE with initial value which is root of denominator
I wrote a code in Fortran to solve this differential equation using RK4 method:
$$
\frac{dy}{dx}=A\sqrt{\frac{B}{y}+\frac{C}{y^2}}
$$
$A$, $B$, and $C$ are some known constants. The problem is that ...
0
votes
0answers
71 views
Applying boundary Conditions on FEM
I have a partial differential equatons as shown below.
$$\dfrac{d}{dx}((1+x)\dfrac{du(x)}{dx})=0$$
With the following boundary conditions.
$$u(0)=0, u(3)=10$$
To solve it using FEM, I multiplied the ...
0
votes
0answers
12 views
Differential parameterized inequalities
Let $H$ be an Hamiltonian and denote $\vec{H}$ the associated Hamiltonian vector field.
I am interested in solving numerically the following problem
$$
\dot z(t) = \vec{H}(z(s),t_1,\ldots, t_p) \...
2
votes
0answers
71 views
Numerical method for harmonic oscillator with jumping constant
Let $k_1 \neq k_2$ be positive reals, $t_0 > 0$ and consider the following Cauchy problem in $[0,+\infty)$:
\begin{cases}
y(t) + k(t)y''(t) = 0 \newline
y(0) = 1/\sqrt{k_1} \newline
y'(0) = 0,
\end{...
2
votes
1answer
139 views
Solving numerically a linear ODE
I start by saying that I do not have a strong background in numerical analysis, so I may miss some basic things or make trivial mistakes.
Motivated by some problems in digital signal processing, I ...
2
votes
1answer
239 views
Lambdifying a symbolic matrix in Julia
If I have a symbolic matrix defined as T below, is there any way to lambdify this as function of variables, say Ļ..., and return ...
2
votes
0answers
51 views
Modelling of Stefan Maxwell equation
I am trying to solve Maxwell Stefan's equation over a membrane to get the transient mole fraction distribution over the membrane thickness 'z'. But somehow I am not able to code it using ODE45, more ...
0
votes
0answers
55 views
How to solve odd-order differential equations in FEM? Petrov-Galerkin?
I've recently learned about using weighted residuals with the Galerkin method to numerically approximate even-order differential equations (for linear elements, I'm still a beginner). It seems for odd-...
1
vote
0answers
25 views
Optimality conditions for optimal control: BVP - DAE
I am solving an optimal control problem of the form
$$
\min_u \qquad\int_0^T \langle u(t), u(t) \rangle \, \mathrm{d}t \\
s.t. \quad \dot{x} = \tilde{f}(x) + u, \quad x(0)=x_0 \\
\qquad \tilde{\Phi}(...
4
votes
2answers
72 views
MInimizing cost function using iterative search for a minimum method
I want to estimated the parameters $\ \hat{\theta} $ of a model using an iterative search for the minimum of a cost function. The cost function is defined as follows:
$$ V_N(\hat{\theta}) = \frac{1}{...
1
vote
2answers
113 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 ...
3
votes
1answer
93 views
Using Implicit Euler with second order differential equations
We can numerically integrate first order differential equations using Euler method like this:
$$y_{n+1} = y_n + hf(t_n, y_n)$$
And with Implicit Euler like this:
$$y_{n+1} = y_n + hf(t_{n+1},y _{n+...
1
vote
1answer
49 views
How to properly compute weights for Weighted Least Squares (WLS)?
I want to apply the weighted least squares method in order to identify parameters of a dynamic process. The process is described by a second order differential equation of the form:
$$ \ddot{y}+a_1\...
2
votes
0answers
53 views
Numerical errors due to terms of the form $\frac{1}{r}$ (r goes to 0 at the boundary) while using finite difference method
I am trying to solve a system of differential equations using finite difference method.
There are few terms of the form $\frac{A(r)}{r}$, both $A(r)$ and r go to zero at the boundary. Analytically ...
1
vote
0answers
63 views
Are linear, CTCS codes always stable?
I would like to solve some equations which basically look like this
$$\frac{\partial u}{\partial x}=F\left(v,\frac{\partial v}{\partial y},\frac{\partial^2 v}{\partial y^2}\right),$$
$$\frac{\partial ...
6
votes
2answers
3k 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$...
1
vote
1answer
54 views
Dealing with boundary conditions using Fourier spectral methods
I am currently working on a project where I need to use Fourier spectral methods to solve the KS equation. I found this code which is using the Fourier spectral methods to solve the classic 1D heat ...
1
vote
0answers
572 views
Numerically solving a partial differential equation in python with Runge Kutta 4
I'm supposed to solve the following partial differential equation in python using Runge-Kutta 4 method in time.
$$
\frac{\partial}{\partial t}v(y,t)=Lv(t,y)
$$
where $L$ is the following linear ...
2
votes
1answer
591 views
Numerical Solution to Rayleigh Plesset Equation in Python
I have been trying to numerically solve the Rayleigh-Plesset equation for a sonoluminescence bubble in Python. You can read about this phenomenon here: https://iopscience.iop.org/article/10.1088/0143-...
1
vote
0answers
55 views
Stably solve transport equation with source term
I am trying to solve a transport equation of the form for the variable $\psi(t,r)$
\begin{equation}
\partial_t\psi-\alpha(r)\partial_r\psi-\beta(r)^2\psi-f(t,r)=0
,
\end{equation}
where I am solving ...
1
vote
0answers
20 views
Using nondimensionalization to solve an ode in MATLAB [duplicate]
I am trying to solve an ode that uses some extremely large numbers and some extremely small numbers, namely
$$
e = 1.6\times 10^{-19}\\
E = 10^6\\
\tau = 6\times 10^{-24}\\
m = 9.1\times 10^{-31}\\
c ...
2
votes
1answer
123 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( \...
1
vote
1answer
122 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 ...
1
vote
1answer
129 views
Numerical integration in 2D
I would like to solve the following problem
$$
\vec{v}(x,y)= k\, \nabla \theta(x,y)
$$
with respect to the unknown function $\theta$. Parameter $k$ is just a real constant quantity.
I have two ...
3
votes
1answer
197 views
Solving an SDE with time-dependent parameter in R
I am trying to solve a system of SDEs in R using the Diffeqr package.
Let's reduce the system to a simple ODE:
...