Questions tagged [differential-equations]

Questions on the symbolic (DSolve, DifferentialRoot) and numerical (NDSolve) solutions of differential equations in Mathematica.

1,417 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
16 votes
0 answers
2k views

Solving Maxwell's Equations in Mathematica

For the sake of demonstration (for my students) and practice, I wanted to numerically calculate the electric and magnetic field (3D) for a sphere of uniform density moving slightly to the right and ...
Andre Reis Guimaraes's user avatar
12 votes
0 answers
378 views

DSolve breaks when the ordering of independent variables aren't proper?

Bug introduced in 3.0 or earlier and persisting through 13.2 I encountered this when trying to solve this problem with DSolve: ...
xzczd's user avatar
  • 63.8k
11 votes
0 answers
175 views

How to modify NDSolve`StateData without crashing the kernel?

Probably a hard question, but it's better to cry out loud. Reminded by Chris K, I noticed my fix function has been broken since v11.3. After some checking, I ...
xzczd's user avatar
  • 63.8k
11 votes
0 answers
1k views

DSolve returns an answer that is not a solution

Investigating DSolve misses a solution of a differential equation, I came across this odd behavior of DSolve. The following DSolve command returns an answer to the ...
Michael E2's user avatar
  • 234k
10 votes
0 answers
710 views

benchmark of Mathematica's FEM?

Does anyone have any numbers on how mathematica compares to other commercial (eg ANSYS) or free FEM softwares (eg. FreeFEM++, FEniCS, elmer)? If this is too vague say solving the diffusion equation in ...
tsuresuregusa's user avatar
10 votes
0 answers
6k views

Precision and accuracy in NDSolve and NMinimize

I use NDSolve quite a lot and have noticed that setting values for AccuracyGoal and ...
indigoblue's user avatar
10 votes
0 answers
1k views

Modelling Hysteresis with a Differential Equation

I want to implement the bulk ferromagnetic hysteresis model (mostly the Jiles-Atherton Model), see http://drum.lib.umd.edu/bitstream/1903/6043/1/PhD_99-1.pdf page 44 equation (30). The needed ...
John's user avatar
  • 273
9 votes
0 answers
490 views

Spurious Error Messages from NDSolve when Using WhenEvent with Time Delays

Bug introduced between versions 10.1 and 10.4, and resolved in 11.3. Using either 11.2 or 10.4 on Windows 10 (64 bit), I am unable to reproduce the answer by March to question 99576. Specifically, ...
bbgodfrey's user avatar
  • 60.8k
9 votes
0 answers
852 views

Symbolic Weak Form

Usually I write the weak form by hand for my FEM code, but it's a little annoying and mechanic sometimes. So, I wonder, is there any way to generate the symbolic weak form in Mathematica? For ...
senseiwa's user avatar
  • 515
8 votes
0 answers
301 views

Shortest Distance between two points on a 2D surface

I am working on an interesting problem, that consists of trying to compute the shortest distance between two points on a 2D surface. This 2D surface can be represented in a 3D space by the function $f(...
Matt's user avatar
  • 407
8 votes
0 answers
232 views

How can we improve transonic flow visualization?

With this code we can make 2D FEM simulation of transonic flow around airfoil NACA 0012 at Mach number of 0.925. It takes about 5 minutes on the XENIA-15 laptop of 32 GB memory with processor Intel ...
Alex Trounev's user avatar
8 votes
0 answers
665 views

Numeric Solution Hydrogen Atom

I'm trying to solve the Schrödinger equation for the hydrogen atom without made the variable separation of the polar and radial coordinate. It is my test code to extrapolate to another system with its ...
Jorge Castaño's user avatar
8 votes
0 answers
341 views

DEigenvalues and NDEigenvalues return different values

In the following example, DEigenvalues and NDEigenvalues return different results despite having identical arguments. Does anyone know why? (I use Mathematica 11.3) ...
banone's user avatar
  • 728
8 votes
0 answers
683 views

Solving ODE with assumption that solution is bounded at boundaries?

For a HW problem, this ODE had boundary conditions given that are not the normal boundary conditions, instead the problem says that solution $u(t)$ is bounded at the left and right ends of the domain. ...
Nasser's user avatar
  • 137k
8 votes
0 answers
276 views

Spurious DSolve Solution

Bug introduced in 8.0.4 or earlier, persisting through 13.2. DSolve quickly returns solutions to the following PDE (which is the homogeneous portion of the PDE in ...
bbgodfrey's user avatar
  • 60.8k
7 votes
0 answers
130 views

GreenFunction for Helmholtz equation in arbitrary Rectangle region doesn't evaluate

Bug persists through V13.0.0 or later Here is a basic example found in the documentation of GreenFunction: ...
Ulrich Neumann's user avatar
7 votes
0 answers
174 views

Where is 1/0 coming from in this call to DSolve?

Bug introduced in 11.3 or earlier and persisting through 13.1 or later Report to WRI [CASE:4246236] This is using 11.3 on windows 10. This is a pde from Handbook of first order partial differential ...
Nasser's user avatar
  • 137k
7 votes
0 answers
181 views

Higher order Laplacian flows

Given disjoint surfaces $q_i$ in 3D and their 1D boundary curves $\partial q_i = \gamma_i$, I seek a surface $p$ that joins the $q_i$, where $p \cup q_i$ forms a (piecewise) $C^k$ surface that ...
Greg Hurst's user avatar
  • 35.5k
7 votes
0 answers
84 views

why DSolve gives different looking solution when using u vs. u[x,t] in the call?

Should the answer by DSolve be different when calling it as DSolve[ode,u,{x,t}] vs. ...
Nasser's user avatar
  • 137k
7 votes
0 answers
798 views

Mathematica packages for numerically solving the Klein-Gordon and Dirac equations?

The book "Advanced Visual Quantum Mechanics" by Thaller includes Mathematica software packages for the numerical solution of the Klein-Gordon equation and the Dirac equation (subject to user-defined ...
Michael B. Heaney's user avatar
7 votes
0 answers
78 views

EventLocator in NDSolve seemingly hogs memory in Windows, but not Mac

I have written a function (ftest in my code) which does the following: Takes a vector {x,vx,vy} as input Numerically solves (with high precision) a specific system ...
Erik Satie's user avatar
7 votes
0 answers
396 views

Applying method of dominant balance directly to an equation

The non-linear equation $y''(x) = \sin k x y$ for $k\in \mathbb R$ cannot be solved analytically to yield a closed form solution. However, by applying the method of dominant balance one may obtain ...
user1997744's user avatar
6 votes
0 answers
110 views

Does current Mathematica capability allow solving PDEs (e.g. reaction diffusion equation) over surface of a mesh or surfaces

I came across this nice paper (https://arxiv.org/pdf/1605.01583.pdf) where the authors simulated a reaction diffusion system over the surface of a gecko, primarily to understand how various patterns ...
Ali Hashmi's user avatar
  • 8,910
6 votes
0 answers
226 views

System of coupled nonlinear pdes with FEM (magneto-hydrodynamic mass transfer)

EDIT 01 See end of post for an update. Original Question I'm trying to reproduce the magneto-hydrodynamic flow studied here using the nonlinear FEM functionality, and have been having trouble ...
George Varnavides's user avatar
6 votes
0 answers
130 views

ParametricNDSolveValue causes kernel to crash

Bug introduced in 12.1.1 and persisting through 13.2.0. In the course of answering question 228693, I found that ...
bbgodfrey's user avatar
  • 60.8k
6 votes
0 answers
91 views

Why Mathematica gives this second solution to this first order linear PDE $w_t+3 t w_x=w$?

This is using V12 on windows 10. I was trying to verify my hand solution with Mathematica. DSolve gives two solutions instead of one, which I do not understand ...
Nasser's user avatar
  • 137k
6 votes
0 answers
145 views

Details of NDSolve calling LSODA

Inspired by my question regarding the computation time of NDSolve using the LSODA backend I was wondering how NDSolve is actually calling LSODA (what arguments are sent to LSODA), i.e. what are the ...
Markus Roellig's user avatar
6 votes
0 answers
226 views

DSolve Returns Incorrect Solutions for First-Order ODE

Bug introduced in 10.4 or earlier and persisting through 11.3. Reported to Wolfram Technical Support as CASE:4150361. Fifty-one DSolve questions on this site are ...
bbgodfrey's user avatar
  • 60.8k
6 votes
0 answers
323 views

Using NDSolve on the Painlevé equations

In an earlier question of mine, I was looking for a way to handle certain kinds of singularities (poles) when using NDSolve. Michael E2's answer, which relied on ...
user1337's user avatar
  • 1,068
6 votes
0 answers
122 views

Tricky ODE with strange B.C. NDSolve vs. DSolve

This is a tricky ODE. First order. $$ y'(x)=y^2(x)-2 y(x)+1 $$ This is easily solved by hand, since separable. But the trick is with the boundary conditions. It is $y(1)=1$. When solving it by hand,...
Nasser's user avatar
  • 137k
6 votes
0 answers
983 views

Alternatives to FiniteElement as Spatial Discretization Method for NDSolve

Finite Element Programming: [...] It is possible to skip this section and continue with the discretization stage and make use of the initialized data structures ...
unlikely's user avatar
  • 7,063
6 votes
0 answers
2k views

Numerically solving system of partial differential equation

I am trying to solve a system of partial differential equation with boundary conditions. But I got an error message saying NDSolve::icfail: Unable to find ...
user1058051's user avatar
6 votes
0 answers
138 views

Modify NDSolve`StateData (if possible)

I am trying to solve a PDE that needs to be scaled constantly (refer to this). @andre suggests I modify NDSolve`StateData. Now, the problem is, I'm not used to ...
wdg's user avatar
  • 1,189
5 votes
0 answers
180 views

Resolving singularity in convection-diffusion equation using pdetoode

Building on the system of equations in this post, I attempted to solve an additional convection-diffusion equation describing the concentration of solute in the lens, which affects its spreading. ...
FLP's user avatar
  • 475
5 votes
2 answers
523 views

Spherical harmonics and Laplace operator

The spherical harmonic function $Y_l^m(\theta,\phi)$ is defined to be an eigenfunction of the angular part of the Laplace operator with eigenvalue $-l(l+1)$. In other words, it solves the PDE: $$\...
Patrick.B's user avatar
  • 1,359
5 votes
0 answers
58 views

What are the valid options for the "ParametricCaching" option in ParametricNDSolve?

I am using ParametricNDSolve as part of the calculation of an objective function for an optimization, so I am trying to strike a balance between memory usage and ...
Michael Seifert's user avatar
5 votes
0 answers
161 views

DSolve returns wrong result

I tried to solve a nonlinear, partial differential equation for the function Y[h, x] by using the following code: ...
user2966584's user avatar
5 votes
0 answers
161 views

Is there a Mathematica CUDA ode solver?

I have a system of ODEs which I'd like to solve with many (thousands) different initial conditions. In the net there are articles that CUDA can speed up such computations, but I haven't found ...
Andrew's user avatar
  • 2,513
5 votes
0 answers
232 views

Incorrect result by DSolve

For real $x$ consider the trivial equation $$|y'(x)|=-|x|.$$ Since the left side is always positive and the right always negative, there is no solution. Let's try ...
JHT's user avatar
  • 1,005
5 votes
0 answers
354 views

Help implementing Magnus Expansion

The Magnus expansion is a tool to approximate solutions to first-order linear differential equations (the Wikipedia page is quite instructive and concise) - it's particularly useful because all orders ...
KHAAAAAAAAN's user avatar
5 votes
0 answers
187 views

StiffSystem or Singularity - a system of second order ODEs in the problem of geodesics

I would be extremely grateful for any help regarding the following code I wrote and the errors it produces. In this code I am investigating the behaviour of a massive particle trapped in the vicinity ...
K.T.'s user avatar
  • 151
5 votes
0 answers
315 views

Spectral problem for differential vector operator (calculation of EM field in a cavity)

I know that mathematica has a DEigensystem and NDEigensystem which allow one to find eigenfunction and ...
Peter's user avatar
  • 205
5 votes
0 answers
545 views

Convergence of approximate solutions to obstacle problem for the heat equation

Consider the problem $$(P) \qquad \begin{cases} \min\{\partial_t u - \Delta u, u -\varphi \} = 0 & \text{ in } (0,T)\times \mathbb{R}^N \\ u(0,\cdot) = \varphi(0,\cdot) & \text{ in } \mathbb{...
user avatar
5 votes
0 answers
268 views

Change Branch Cut for DifferentialRoot

The differential equation eqn = (16 + q) g[q] + 4 q (-3 + q^2) g'[q] - 4 q^2 (-1 + q^2) g''[q] == 0 is singular at {-1,0,1}. ...
bbgodfrey's user avatar
  • 60.8k
5 votes
0 answers
348 views

what are the limitation on current Mathematica's ability to solving a Sturm-Liouville ODE?

Update fyi. CASE:3855831 (thanks to bbgodfrey reporting it) Mathematica 11 is supposed to be able to solve basic S-L ODE according to this page And it works ...
Nasser's user avatar
  • 137k
5 votes
0 answers
183 views

APPCRASH of Kernel.exe. running Murphy ODE collection

Since I am getting many KERNEL crashes running Murphy ODE collection, I thought to use this post and collect each crash here instead of making separate post for each one, as there might be too many ...
Nasser's user avatar
  • 137k
5 votes
0 answers
136 views

1/0 encountured solving Murphy ODE #116

This is another case of DSolve getting 1/0 internally. Could someone explain why this happens? Is this a bug? does it happen on other platforms? I am using windows 7, 64 bit. This is a non-linear ...
Nasser's user avatar
  • 137k
5 votes
0 answers
1k views

Solving a system of differential algebraic equations (DAE)

I am trying to solve a system of 8 differential algebraic equations, where equations 3 and 5 are differential equations and the rest are constraints which need to be satisfied. Also I only know the ...
Branka's user avatar
  • 51
5 votes
0 answers
189 views

Naive question on ODE numerical solving and periodic initial conditions

I have a second-order nonlinear ODE for which I would like to find a numerical solution, with periodic initial (boundary) conditions. Can this be done directly with ...
Cedric H.'s user avatar
  • 696
5 votes
0 answers
182 views

NDsolve memory leak

Every time I run NDsolve it uses some memory that I am not able to free later. The following is an example code based on the spring equation (Hooke's law) that ...
Mike B.'s user avatar
  • 51

1
2 3 4 5
29