Questions tagged [differential-equations]

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

Filter by
Sorted by
Tagged with
16
votes
4answers
836 views

Understanding PeriodicBoundaryConditions

Every thing works fine in a simple example with periodic boundary condition u[ 2,y]==u[0,y] from documentation of ...
16
votes
3answers
3k views

Particles bouncing in a 3D box

I made this Manipulate code which shows a pack of particles randomly moving inside a box. It has a huge performance issue. What should be the best way in doing "...
16
votes
1answer
3k views

Solving and Animating Three Body Problem

I am attempting to solve a three-body problem using the Lagrange formalism, with a 1/r potential. I started off by defining T and U (kinetic and potential energy) as follows: ...
16
votes
2answers
685 views

Solution diverges in periodic PDE

Problem introduced in 11.0.1 and persisting through 11.3 Mathematica version 11 introduces PeriodicBoundaryCondition which is very useful in solving periodic PDE ...
16
votes
1answer
688 views

How to guarantee that NDSolve correctly detects abrupt changes in parameters?

When using NDSolve, I often have parameters that, in most of their domain, have a constant or null variation, but that suffer from abrupt variations on a very small ...
16
votes
3answers
1k views

Could Mathematica solve a differential equation asymptotically?

Is there any possibility that Mathematica could give asymptotic behavior(s) of a differential equation as it independent variable tends to a certain value? Because I didn't know how to decompose this ...
16
votes
2answers
738 views

Conservation of area solving a PDE via finite difference scheme

I have two PDEs that describe the movement of fluid: $h_t + [h^3(1-h)^3((1+\varepsilon h)\sin \theta - \varepsilon h_\theta \cos \theta]_\theta$ = 0 $h_t - [h^3(1-h)^3 \varepsilon h_\theta]_\theta$ = ...
16
votes
2answers
3k views

Neumann boundary conditions in NDSolve over nontrivial region

The problem I would like to solve involves diffusion in the following region ...
16
votes
1answer
618 views

Plotting the eigenmodes of a cylindrical shell

There are many examples of eigenmodes computations for surfaces with Mathematica, such as: https://www.wolfram.com/mathematica/new-in-10/pdes-and-finite-elements/solve-a-wave-equation-in-2d.html, ...
16
votes
2answers
910 views

Heat convection differential equations from 1952 - Mathematica "fails to converge"

I am trying to solve a fundamental problem in analytical convective heat transfer: laminar free convection flow and heat transfer from a flat plate parallel to the direction of the generating body ...
16
votes
0answers
246 views

3D stable fluids algorithm to simulate transition from laminar to turbulent flow

This algorithm is 3D extension of our 2D algorithm published on this page and here. We suppose that with this code we can simulate transition from laminar to turbulent flow. In this example we compute ...
15
votes
2answers
453 views

Tennis Racket theorem

Torque-free Euler equations experiment seen in low gravity of Russian spacecraft is modelled here with a view to see its tumbling motion around the intermediate axis $\omega_2$ rotation. However its ...
15
votes
3answers
3k views

Solve Laplace equation in Cylindrical - Polar Coordinates

Hey mathematica stackexchange!! I've got a (possibly stupid) problem. I've tried many things to no avail, and I've read every post I've found on Laplace's equation. Background: I'm trying to find the ...
15
votes
4answers
784 views

FEM: Why are the numerical solutions of field equations with D and Inactive[Div] and Inactive[Grad] different?

Bug introduced in 12.1.1 or earlier - Fixed in Version: 12.2.0 Suppose you have the DE $$ \frac{d}{dx} \left( c(x) \left[\frac{d}{dx}u(x)\right] \right) + n(x) = 0 $$ and you want to solve for $u(x)$ ...
15
votes
2answers
2k views

Finite difference method not converging to correct steady state or conserving area?

I am working with the following PDE, which is an advection-diffusion type equation. It describes the movement of a fluid-fluid interface inside an annulus of inner radius $R_1$ and outer $R_2$ under ...
15
votes
5answers
4k views

How can you compute Itō Integrals with Mathematica?

How can you compute Itō Integrals with Mathematica? I tried searching through the documentations but I didn't find anything. P.S. I was not at all sure how to tag this question. I had to put in at ...
15
votes
3answers
413 views

Solving the Lotka-McKendrick model with NDSolve

The Lotka-McKendrick model is a demographic model that represents the way a population changes over time due to fertility and mortality. For an age-specific population density $ u(a, t) $, and a total ...
15
votes
4answers
989 views

NDSolve giving a wrong solution

Consider the ODE $$\frac{y'y}{1+\frac{1}{2} \sqrt{1+ y'^2}}=-x.$$ Using NDSolve[{-x==y'[x] y[x]/(1+Sqrt[1+(y'[x])^2]/2), y[0] ==3}, y, {x,-7,7}] and plotting leads ...
15
votes
1answer
2k views

Solve a PDE on a domain $\Omega$ with given boundary conditions

I'm starting to study the behavior of some PDEs and I would like to run simulations in mathematica to help me visualize solutions. For example, a prime example that I would like to study is $$ \left\{...
15
votes
2answers
1k views

The only usage for the option InterpolationOrder in NDSolve is to be set to All?

We know that changing the option InterpolationOrder in ListLinePlotListPlot3D、...
15
votes
1answer
2k views

Poisson solver using Mathematica

I am looking for some help with a Poisson solver I am writing in Mathematica. The code is quite long with Arrays plugged in, so the full details can be found at http://pastebin.com/uSrSDcW6 I am ...
15
votes
1answer
618 views

WhenEvent and partial derivatives

Can WhenEvent be used to reset the conditions on a PDE at a given time? How would the syntax of that be? This is the code I`m using ...
15
votes
1answer
518 views

"ParametricSensitivity" in ParametricNDSolve

"ParametricSensitivity" is listed as a Method in the documentation for ParametricNDSolve, ...
15
votes
1answer
266 views

Are compound matrices implemented in mathematica?

Compound matrices are matrices whose entries are all the minors of a given size of another matrix. https://en.wikipedia.org/wiki/Compound_matrix https://www.researchgate.net/profile/James-Muldowney-2/...
15
votes
3answers
1k views

How to perturb a Dynamic System?

I'm trying to model a basic feedback system with delayed feedback. I've done the initial setup and now want to add a few more advanced features to my system. Currently, it's just a simple delayed-...
15
votes
1answer
661 views

Numerically solving a system of many coupled non-linear ODEs efficiently?

I'm studying a fairly typical problem: a chain of $n$ coupled, non-linear oscillators. Since I want to look at open boundary conditions, the equations of motion for the position of the first and the ...
15
votes
1answer
2k views

Solving Navier-Stokes equations for a steady-state compressible viscous flow in a 2D axisymmetric step

Note: you may apply or follow the edits on the code here in this GitHub Gist I'm trying to follow this post to solve Navier-Stokes equations for a compressible viscous flow in a 2D axisymmetric step. ...
15
votes
1answer
1k views

Speed up NDSolve compared to Python (calls to LSODA)

I migrated a numerical model code from Python to Mathematica and am surprised how much faster the Python version runs. Profiling of the Python version tells me that it is about 100 times faster (120 ...
15
votes
1answer
607 views

Mathematica9: NDSolve slows down after repeated calls

Bug introduced in 9.0 and persisting through 11.0.1 I have noted that in Mathematica 9 my code, which involves a lot of calls to NDSolve, slows down considerably ...
15
votes
1answer
525 views

How to specify PDE Boundary condition on a B-spline?

Context I would like to solve a PDE on a boundary which is parametrized as a BSpline. I am trying to solve the force-free Grad-Shafranov equation on a boundary ...
15
votes
1answer
374 views

Possible bug with FourierTransform linearity

Each component is easily transformed but the sum is not: FourierTransform[f''[x], x, k] FourierTransform[f'[x], x, k] ...
15
votes
0answers
1k 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 ...
14
votes
3answers
3k views

Determine frequency of oscillations

I am wondering how I could determine the frequency of oscillations of a differential model equation? How could I find the frequency from this example given in Mathematica Documentation: ...
14
votes
3answers
924 views

Solving Stefan's solidification problem - for the case of 3 regions

This question heavily related to this question, where the case of two PDE's are solved along with a zipping condition that is a function of time. Using the link in the code I have solved this set of ...
14
votes
4answers
464 views

Where is the numerical solving breaking down?

I am working with a set of three coupled reaction-diffusion PDEs, and for some parameter values I am getting some not so great solutions. I have been searching documentation and tutorials, and I have ...
14
votes
2answers
2k views

Boundary condition with spatial derivative is ignored by NDSolve

Consider the following differential equation: $$\begin{align*}&\rho C_p\left(\frac{\partial T}{\partial t}\right)=k\left[\frac{\partial^2 T}{\partial x^2}\right]+\dot{q}\\ &\text{at }x=0,\;\...
14
votes
3answers
188 views

Error when using NDSolve for $\epsilon y'' - y' + y^2 = 1$

Error when using NDSolve for $\epsilon y'' - y' + y^2 = 1$ with $0<x<1$ and $y(0) = \frac{1}{3}$, $y(1)=1$ My attempt: ...
14
votes
3answers
5k views

NDSolve with vectors

I'm stumped. I'm trying to write this using vectors, but the 2nd derivative isn't being expanded like I expected it to be. This is a system of equations for a projectile with quadratic drag and ...
14
votes
4answers
1k views

Analytic solution to Newtonian gravity differential equation

I was told that I could obtain an analytic solution to a particle falling under the influence of Newtonian gravity by using DSolveValue. What I am given $G = M = ...
14
votes
3answers
5k views

help to plot Poincaré section for double pendulum

I am reading a book about classical mechanics. In the chapter about chaos, it gives the simplified and scaled equations for double pendulum as $$ \frac{d}{dt}\left[ \begin{matrix} \alpha \\[3mm] ...
14
votes
2answers
543 views

Can Mathematica provide a reliable estimate of the numerical error from NDSolve?

In the Details section of the Mathematica documentation for PrecisionGoal, one is told that Even though you may specify ...
14
votes
2answers
1k views

Solving a discontinuous differential-algebraic equation system for plasticity behaviour

I need to solve a discontinuous equation which is typical in theory of plasticity. For a simple case I get the following equation system (reformulated for numerical implementation): $$\begin{align*} ...
14
votes
2answers
2k views

How to create subregions for the NDSolve FEM Solver

I am trying to create a 2d region consisting of two subregions. The inner region has several holes, where boundary conditions are applied. The figure shows the idea. I have tried to create this ...
14
votes
1answer
841 views

Non Standard Eigenfunction Plots of the Laplacian Over the Unit Square

I have recently been plotting eigenfunctions of the laplacian over the unit square using the NDEigensystem command. However, I have noticed something in the plots ...
14
votes
1answer
660 views

NDSolve`FiniteDifferenceDerivative gives wrong result when the precision is not MachinePrecision

Bug introduced in 8 or earlier and persisting through 11.0.1, fixed in 11.3 or earlier. I want to get a pseudospectral differentiation matrix by ...
14
votes
2answers
16k views

How to solve a system of partial differential equations?

Edit: since the upgrade to Mathematica 10, this problem seems solved I just want to solve a system of partial differential equations, for example: $$ \left\{ \begin{array}{l} \frac{\...
14
votes
2answers
565 views

Memory leak with NDSolve

Bug solved in 11.2 Bug introduced in 10.3 or earlier and persists through 11.0 Edit The technical team confirms the memory leak in NDSolve and has forwarded an ...
14
votes
1answer
2k views

Frequency domain Maxwell equations with PML boundary conditions

I'm trying to solve a full-vectorial wave equation for an arbitrarily shaped wave guide, by using NDSolve and perfectly matched layer (PML) conditions. The PML ...
14
votes
2answers
4k views

How to correctly use DSolve when the force is an impulse (dirac delta) and initial conditions are not zero

DSolve (and NDSolve) return different and unexpected solution to differential equation when the input is an impulse. This is ...
14
votes
1answer
231 views

Ito Process sourced by Gaussian Process?

Question Is it possible to extend the function ItoProcess so that it takes correlated noise? I.e would like to be able to write ...