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
22
votes
4answers
9k views

Lyapunov Exponent

Does anyone know a (simple) Mathematica code for computing the Lyuponov Exponent for the Rossler System? Thank you Rossler System: ...
22
votes
4answers
2k views

Only final result from NDSolve

Finally, I started to play with differential equations in Mathematica. And I have faced the problem, which seems to me so basic that I'm afraid this question is going to be closed soon. However, I'...
22
votes
2answers
6k views

Basins of Attraction

How does one shade the basin(s) of attraction of a phase plot in Mathematica? I have been trying to do this using the system $$\begin{align*} \dot x &= y\\ \dot y &= -9\sin(x) - 0.20y \end{...
22
votes
4answers
1k views

What is the definition of Curl in Mathematica?

I have a usual mathematical background in vector and tensor calculus. I was trying to use the differential operators of Mathematica, namely Grad, ...
22
votes
2answers
963 views

NDSolve uses different difference order for different spatial derivative when solving PDE

I found something this tutorial for method of line doesn't tell us. Consider the following toy example: ...
22
votes
2answers
802 views

Getting rid of spikes in the PDE solution

Bug introduced in 10.0 and fixed in 10.3 Note: In 10.0, Rationalize[fd, 0] was needed or mesh generation would fail. Preamble: I am solving a PDE in a domain ...
22
votes
1answer
501 views

29 Differential equations hang/not solved in version 11 compared to 10.4, looking for cause

I run Kamke differential equations in version 11 and compared the result to version 10.4. Found 29 differential equations that ...
21
votes
4answers
5k views

How do I solve a PDE with a strange boundary condition?

How do I solve the PDE with boundary value like this $$u(t,x,y)=0, \textrm{when } F(x,y)=0$$ using DSolve? As a specific example, I want to solve heat equation $$\frac{\partial u}{\partial t}=\...
21
votes
3answers
6k views

How to discretize a nonlinear PDE fast?

I wish to numerically solve the following PDE. Although there are some complete discussions for solving PDEs in tutorial/NDSolvePDE, there is no hint for the nonlinear case by discretization. Thus, I ...
21
votes
2answers
7k views

Elegant way of obtaining the envelope of oscillating function [duplicate]

I am solving a differential equation numerically and the output is an oscillating function with the amplitude of the oscillation decaying in time. I would like to extract the power law governing this ...
21
votes
2answers
1k views

Least effort to handle a point source inside the domain of PDE(s)

By point source I mean a constrained condition at one point inside the domain of PDE(s). For example: $$\frac{\partial ^2u(t,x,y)}{\partial t^2}=\frac{\partial ^2u(t,x,y)}{\partial x^2}+\frac{\...
21
votes
3answers
3k views

Wrong answer from DSolve when solving a differential equation

Bug introduced in 12.0.0, fixed in 12.1.1. I was trying to solve the following differential equation: $$\frac{dy}{dx}=x^2+y^2-1 \quad \text{and} \quad y(0)=1$$ and I used the code below: ...
21
votes
2answers
5k views

Plotting separatrices for nonlinear system

Consider the system: \begin{align*} x'&=(1-x-y)x\\ y'&=(4-7x-3y)y \end{align*} The system has a saddle point at (1/4,3/4). How can I plot the separatrices on the phase portrait having domain ...
21
votes
2answers
910 views

Partial Differential Equation in Parallel

is there any native way to implement multi-core parallel solving of PDE in Wolfram Mathematica? WM 10 now supports Finite Elements Method, but it is actually useless without parallelization. Usually ...
21
votes
1answer
1k views

Eigenfunctions of the Laplacian on an arbitrary mesh

So, I've constructed a mesh over which I'd like to find eigenfunctions of Laplace's equation with a free boundary (a zero Neumann boundary condition along the edge). Mostly because I figured an ...
20
votes
3answers
17k views

NDSolve with Euler method

I want to solve this equation with NDSolve[] using the Euler method: x'[t] == 0.5*x[t]-0.04*(x[t])^2 with initial condition ...
20
votes
2answers
16k views

Integral equation numerical solution with NDSolve

I'm trying to solve something like: f[x] == Integrate[f[x]*g[x]] where g[x] is known and f[x]...
20
votes
1answer
1k views

Couple a PDE and ODE in NDSolve

I would like to solve an example of non-stationary heat transfer with a coupled PDE and ODE. Let's assume that we have 1 dimensional bar of length $L$ with uniform initial temperature. The right end ...
20
votes
3answers
510 views

Inverting differential equation using finite element methods

tl;dr; How to use FEM tools to extract models needed to invert PDEs. Context In astrophysics, one is interested in so-called 'cosmic archeology' which involves recovering the origin of a given ...
20
votes
1answer
839 views

These PDE's no longer evaluate in version 12.2 as they did under 12.1. What can be done to make them evaluate under 12.2?

These 399 PDE's no longer produce result under Version 12.2 on windows. DSolve now returns unevaluated. These all evaluated under version 12.1. Why is that? And ...
19
votes
3answers
2k views

Numerically solve the initial value problem for the 1-D wave equation

I want to solve the standard 1-dimensional wave equation $y_{xx}=y_{tt}$ using NDSolve (for $y(x,t)$) with the following conditions: ...
19
votes
4answers
1k views

How to apply different equations to different parts of a geometry in PDE?

I want to solve two coupled partial differential equations on two dimension. There are two variables v and m. The geometry is a ...
19
votes
2answers
6k views

Is it possible to do vector calculus in Mathematica?

I am trying to rearrange and manipulate some vector differential equations in Mathematica. As far as I understand you have to tell Mathematica that a variable is a vector by specifying the components ...
19
votes
1answer
3k views

How to solve a stiff nonlinear second-order ode?

I want to solve a nonlinear second order ODE as an initial value problem (IVP). Unfortunately, for certain values of first derivative at starting point I get a stiff-problem. I tried to overtake this ...
19
votes
1answer
439 views

How can I reliably plot ellipse-field streamlines?

I am trying to replicate some standard structures in the study of ellipse fields in Mathematica, and I'm having much more trouble than is really reasonable, so I'd like to put this on the floor here ...
18
votes
3answers
9k views

Creating a 3D List Line Plot From Discrete Points

Given the following Runge-Kutta ODE solver and the graphical output below, how do I get a 3D line plot instead of a 3D point plot? I see that there is no ListLinePlot3D function, so I thought it might ...
18
votes
2answers
7k views

Solve Laplace equation using NDSolve

I am new to Mathematica, a friend recommended this software and started using it, in fact download the trial version to know. I recently did a program in C to calculate numerically the solution to ...
18
votes
5answers
3k views

periodic boundary conditions and NDEigensystem

Mathematica 10 has a splendid new function, NDEigensystem, that makes it possible to solve Sturm-Liouville problems numerically in a single step. I have not however been able to find a way to get it ...
18
votes
2answers
3k views

Solve differential equation using a integral form boundary condition

I have a second order differential equation and I want to solve it analytically (DSolve) and numerically (NDSolve) with ...
18
votes
2answers
573 views

Large deformation of solids

Link to notebook with this question and code I'd like to understand how large deformations of solid mechanics work and how they are implemented. For this am looking at the following reference problem: ...
18
votes
1answer
1k views

Solver for unsteady flow with the use of the Navier-Stokes and Mathematica FEM

There are many commercial and open code for solving the problems of unsteady flows. We are interested in the possibility of solving these problems using Mathematica FEM. Previously proposed solvers ...
18
votes
1answer
658 views

Inconsistent behavior of WhenEvent[ ]

Consider the following simple example: ...
18
votes
1answer
365 views

Violin with f-holes and FEM simulation of Helmholtz resonance in 3D

This question is about FEM simulation of violin vibration modes in 3D. There are several problem around. One of them is Helmholtz resonance. Air inside the violin body has own frequencies dependent ...
17
votes
2answers
2k views

How to improve this plot?

In general, the quality of Mathematica graphics is beyond praise. However, the output of Plot3D command is somewhat unexpected in the following code. Let's solve the Dirichlet problem for the ...
17
votes
3answers
11k views

Solving a time-dependent Schrödinger equation

I want to solve the time-dependent Schrödinger equation: $$ i\partial_t \psi(t) = H(t)\psi(t)$$ for matrix, time-dependent $H(t)$ and vector $\psi$. What is an efficient way of doing this so that ...
17
votes
4answers
2k views

Symmetry-finding packages

Where can I find the most up-to-date or whatever you consider to be the most useful symmetry-finding package for differential equations? I do not intend to restrict to, but would like to include those,...
17
votes
2answers
3k views

What's behind Method -> {"EquationSimplification" -> "Residual"}

In order to solve a quite large system of differential equations, I have the habit to use the NDSolve command without changing any options. As I wanted more ...
17
votes
4answers
892 views

Piecewise imposes internal boundaries in NDSolve - is this expected?

In the following code I used True as the predicate for DirichletCondition and found that the boundary condition was applied not ...
17
votes
3answers
833 views

Gravitational potential created by a thin disc using FEM and NDSolve

Context I would like to compute the torque that a (thin) disc applies onto a ring. I.e. I would like to try to understand what is the impact of this outer ring on the inner disc in the simulation ...
17
votes
1answer
2k views

Simulating a partial differential equation - reaction-diffusion systems and Turing patterns

I want simulate a reaction-diffusion system described by a PDE called the FitzHugh–Nagumo equation. The system that has been proposed by Alan Turing as a model of animal coat pattern formation and is ...
17
votes
1answer
2k views

How to solve the tsunami model and animate the shallow water wave?

Backslide introduced in 9.0, persisting through 11.3. Recently when I was learning differential equations, I noticed there is a shallow water wave equation to model the tsunami propagation. How to ...
17
votes
1answer
378 views

When does NDSolve parallelize ODE system solving?

I've long believed that NDSolve cannot make use of multiple cores to solve ODE system, but things seem to be different at least since v12. Consider the following ...
17
votes
2answers
1k views

What can one do with extremely stiff problem in NDSolve?

Consider the following illustrative problem: $$ \frac {\partial f} {\partial t} = \frac {\partial} {\partial x}(x f) + \frac {\partial} {\partial x}(f \frac {\partial f} {\partial x}) $$ This is ...
17
votes
3answers
1k views

Vector form using NDSolve

Michael E2 wrote a wonderful solution for my question. Now I am considering the system: $$ \begin{align*} x'&=x^2 y,\ x(0)=1\\ y'&=-x y^2,\ y(0)=1 \end{align*} $$ I am wondering how I can ...
17
votes
1answer
369 views

Stable fluids code for electromagnetic mixture application

This code has been translated from the original Jos Stam code and improved with some Mathematica functions. It solves problem of viscous incompressible flow with electromagnetic force in a rectangle ...
17
votes
1answer
5k views

What method does NDSolve use for solving PDEs?

What is NDSolve's mode of operation? I use it to solve partial differential equations and never gave it too much thought. Recently, I came across this question. ...
17
votes
1answer
706 views

Solver for COVID-19 epidemic model with the Caputo fractional derivatives

As it is known in biological system with memory it would be suitable to use fractional derivatives to describe evolution of the system. In a current version of Mathematica 12.1 there is no special ...
17
votes
2answers
1k views

What boundary is added when boundary condition is not sufficient?

When insufficient boundary conditions are given to NDSolve for solving PDE, usually the warning NDSolve::bcart pops up: ...
16
votes
4answers
3k views

Plot MATLAB icon

I started to explore this on a whim and hasn't succeeded yet… Some introduction for the icon is found here and here, but I can't understand it very well. (I admit that, though playing with ...
16
votes
4answers
902 views

How to model diffusion through a membrane?

This is a follow-up on How to handle discontinuity in diffusion coefficient? Consider diffusion of $u(t,x)$ on the domain $x \in [0,2]$ with some simple boundary conditions such as $u(0) = 2, u(2) = ...