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
28
votes
1answer
3k views

Stress calculations using finite elements

A standard engineering problem is to calculate stresses in a structure due to applied forces. With the inclusion of the finite element method in version 10 this question attempts to investigate how ...
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 ...
9
votes
1answer
737 views

Finding Eigenvalues for a boundary value problem

I have a 10x10 linearized BVP which I can write as $$\mathbf{y}'(x) = \mathbf{A}(\omega) \mathbf{y}(x)$$ subject to boundary conditions $$\mathbf{B} \cdot \mathbf{y} = \mathbf{0}, \quad x=0 \\ \mathbf{...
5
votes
1answer
473 views

Variation of heat equation with guessed initial condition

Hi I am trying to solve a variation of the heat equation with interaction terms and external source -- actually it's the Schrödinger-Newton equation if that's more familiar to you. \begin{align} i \...
13
votes
2answers
716 views

Boundary Condition for Schrödinger Equation in Infinite Range

I am trying to simulate the movement of a coherent state in a quantum harmonic oscilator, but for some reason the answer diverges and there is a warning about not enought boundary conditions. Also, ...
7
votes
1answer
781 views

Free Convective Heat Transfer of Non-Newtonian Power Law Fluids from a Vertical Plate

I am trying to solve a set of PDEs mentioned in this paper with NDSolve but facing quite a few issues. The PDE system is: ...
7
votes
2answers
1k views

NDSolve with vector function

(Possible duplicate yet I still can't understand.) Basic 2D revolving around origin: ...
2
votes
3answers
1k views

Derivative of function solved from NDSolve can't be plotted

I have used NDSolve to solve for a function (an angle of a triple pendulum), and now I wish to plot the derivative of that function (the angular velocity). ...
10
votes
3answers
2k views

How to solve the differential equation with Duhamel's integral?

How do I solve a differential equation with Duhamel's integral? I tried to solve it with NDSolve, but failed: ...
26
votes
1answer
5k views

How to numerically solve a 1-d time-independent Schrödinger equation?

The point is to solve the eigensystem of the given Hamiltonian. I tried ParametricNDSolve combined with FindRoot to search for ...
17
votes
3answers
10k 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 ...
28
votes
3answers
4k views

Programming a numerical method in the functional style

I am new to Mathematica and I would like to learn a bit more about functional programming. At the moment I have assignments like programming different numerical methods (for integration: ...
21
votes
2answers
6k 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 ...
26
votes
2answers
2k views

Phase portrait on a cylinder

It is very nice and very easy to make a sketch of a phase portrait with StreamPlot. For example, for the classical pendulum, defined by \begin{eqnarray*} \dot x&...
17
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 ...
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]...
18
votes
1answer
614 views

Inconsistent behavior of WhenEvent[ ]

Consider the following simple example: ...
11
votes
2answers
2k views

PDE with Stefan Conditions, a.k.a variable boundary

I want to solve the one-dimensional one-phase Stefan problem, but I don't know how to make Mathematica understand the conditions. If you are not familiar with what I'm asking please refer to this ...
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 ...
12
votes
2answers
800 views

How to draw the image of a circle under the action of a transformation of the phase flow?

How to draw the image of a circle $x^2+(y-1)^2<1/4$ under the action of a transformation of the phase flow for the equation $\dot{x}=y,\ \dot{y}=-\sin x$? Here $\dot{x}$ means $dx/dt$. Any help or ...
15
votes
4answers
672 views

Understanding PeriodicBoundaryConditions

Every thing works fine in a simple example with periodic boundary condition u[ 2,y]==u[0,y] from documentation of ...
10
votes
1answer
837 views

Circumvent NDSolve::bdord: error for 1-D Euler Equations

I attempted to use NDSolve for the 1-D isentropic unsteady flow equations with low subsonic inflow velocity and prescribed inflow total enthalpy; along with a non-...
16
votes
4answers
722 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) = ...
12
votes
3answers
950 views

Solving an integro-differential equation with Mathematica

I try to solve a nonlinear integro-differential equation with this code. Here i used a periodic condition. ...
16
votes
2answers
687 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$ = ...
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、...
8
votes
1answer
447 views

How to solve a system of PDEs with zip condition?

I have a system of PDEs in the following form, $$\frac{\partial T_1}{\partial t}=\frac{\partial^2 T_1}{\partial x^2},\,\,0<x<S(t)$$ with $T_1(x,0)=-10,\,\,T_1(0,t)=-10,\,\, T_1(S(t),t)=10$, and ...
6
votes
5answers
2k views

Problems with NDSolve and stiffness

I am trying to solve an ODE in chemical kinetics: $$\begin{align*} \frac{\mathrm d[x]}{\mathrm dt} &= -k_1 [x][y]\\ \frac{\mathrm d[y]}{\mathrm dt} &= k_1 [x][y] - k_3[y] \end{align*}$$ My ...
5
votes
3answers
1k views

How to input Robin boundary conditions for nonstandard Laplace equation?

What is the correct way to input these boundary conditions for the following nonstandard Laplace equation, whose coefficients of $\frac{\partial^2 u}{\partial x^2}$ and $\frac{\partial^2 u}{\partial y^...
4
votes
2answers
1k views

How to visualize slope fields of differential equations without vectors?

I'm looking to visualize slope fields of differential equations for my differential equations course. Every example I see draws them as vectors, adding unnecessary "arrows" that, to me, are visually ...
4
votes
1answer
557 views

Stopping NDSolver at time of error

I am using NDSolver and WhenEvent to solve a system of differential equations. I get this message: ...
2
votes
2answers
372 views

Unstable solution of 2D+1 time PDE with periodic boundary condition

Now I am trying to solve the following 2D+1 type of PDE: $\partial_t u(t,x,y)=-y\partial_{x}u+\partial_{y}\left[a y+b sin(x)u+c\partial_{y}u\right]$ with $u(0,x,y)=\frac{1}{2\pi}e^{-((x-\pi/4)^2+y^2)...
52
votes
2answers
3k views

Numerically solving Helmholtz equation in 3D for arbitrary shapes

Context While studying manifold Learning I got interested in finding the eigenvectors of the Laplacian. (also in connection to this problem of solving the heat equation) Following this and that ...
40
votes
2answers
2k views

Variable naming changes everything

Bug fixed in 10.0.0 I am having a rather unusual problem I do not understand with Mathematica where renaming one of the variables of my function causes the function to stop "working". Here is the ...
18
votes
3answers
8k 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 ...
19
votes
4answers
950 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 ...
12
votes
2answers
2k views

StreamPlot for Bifurcation Diagram

When we do a StreamPlot, I want to show the bifurcation when $a = 0$ transitions to $a >0$, but do not see a better way to do this than the following. ...
14
votes
3answers
833 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 ...
10
votes
3answers
506 views

Reduce ODE into 1st order

I have an explicit set of differential equations: $ \ddot{x}=f(x,\dot{x})$ I would like to reduce it in the following way: $ \dot{y} = g(y)$ by substitutions as shown here: wikipedia. I have done ...
15
votes
3answers
2k 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 ...
13
votes
1answer
1k views

NDSolveValue - Heat flux continuity

I'm having some problems with NDSolve and the problem of conduction of heat. Specifically I'm having problems with the continuity of heat flux. First, let me ...
8
votes
2answers
415 views

Working with a system of differential equations that cannot be solved explicitly

I have to work a lot with three functions $\;o_1(t), o_2(t), o_3(t)\;$ that are solutions to a certain system of differential equations: ...
7
votes
3answers
964 views

How to implement Einstein summation convention with differential operators

Statement of this problem: In the textbook, the following differential equilibrium equations can be expressed by tensors: Using Einstein's summation convention, the formula in the figure above can be ...
8
votes
1answer
3k views

Rosenzweig-MacArthur predator-prey model [duplicate]

The predator-prey model is governed by the following system of ode's. \begin{eqnarray} &&\displaystyle{\frac{dx}{dt}=r x\left(1 - \frac{x}{K}\right) - \frac{s y x}{1 + s \tau x}},\\[0.1cm] &...
6
votes
1answer
452 views

Controlling dynamic time step size in NDSolveValue

Statement of problem I'm writing a script to calculate the temperature of a 2D system with time-dependent heat deposition. The heat deposition is a square wave pulse of duration w = 10^-6 seconds, ...
9
votes
2answers
766 views

Initial time as parameter in ParametricNDSolve

I need a help with the function ParametricNDSolve. My goal is solve the equation \begin{array} &&\dot{x}(t) = y(t) \\ &\dot{y}(t) = x(t)-1-\varepsilon Cos(\omega t) \\ &x(t_0) = x_0\\ ...
5
votes
2answers
889 views

NDSolve in Mathematica won't use all the cores avaiable

When I solve a system of differential equations in MATLAB, the task manager shows that all the CPU cores are in use. This is not true when I solve the same system in Mathematica. I have six cores. ...
11
votes
1answer
1k views

How to tell mathematica not to resolve stiffness issues

Very often I solve partial differential equations that are nonlinear and could be up to 4th order. In these cases, it is usual for the solution determined by NDSolve...
7
votes
1answer
724 views

Numerical solution of IVP for linear ODE with variable coefficient runs wild soon

Cross posted in scicomp.SE. A friend of mine showed me this initial value problem (IVP) for a linear ordinary differential equation (ODE) with variable coefficient: $$y''(x)=\left(x^2-1\right) y(x)$$...
5
votes
1answer
1k views

How can I deal with a non-numerical value for a derivative at $t = 0$ when using NDSolve?

I want to solve two coupled equations with NDSolve, ...

1
2
3 4 5
25