28 votes

Nonlinear differential equation: numerical solution

Introduction I think there are several questions on this site about ODEs of the form $$(x-a)^2 u''(x) = F(x,u,u')$$ with an initial condition at $x=a$. There is no general guarantee that solutions ...
Michael E2's user avatar
  • 234k
23 votes
Accepted

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

I've waited for this question for a long time :) Fully NDSolve-based Numerical Solution There actually exist 2 issues here: NDSolve can't handle unsmooth i.c. ...
xzczd's user avatar
  • 63.8k
20 votes

How to solve ODE with boundary at infinity

Spectral methods I present two general ways to approach a second-order linear BVP of the form $$\gamma(x)\, y''(x) + \beta(x)\, y'(x) + \alpha(x)\, y(x) + \varphi(x) = 0,\ y(0) = y_1,\ y(\infty) = ...
Michael E2's user avatar
  • 234k
16 votes

Why does NDSolve blow up when given my ODE but bvp4c in Matlab does not?

First, there is a mistake in the sign k. And secondly, for such tasks we use a special method that expands the possibilities of the shooting method. I will ...
Alex Trounev's user avatar
15 votes

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

Here is a FEM-based solution: ...
user21's user avatar
  • 39.1k
15 votes
Accepted

${\frac {\partial^{2} u}{\partial {x}^{2}}} +{\frac {\partial ^{2} u}{\partial {y}^{2}}} =0$ with one boundary at infinity

Using the symbolic boundary condition u[t, y] == 0 instead of the infinite one, and then taking the limit $$ t \to \infty,$$ inside the sum seems to do the trick ...
ZufolgeWeierstrass's user avatar
14 votes

Where is the numerical solving breaking down?

Some experimentation shows that the NDSolve problem is associated exclusively with z with no feedback to ...
bbgodfrey's user avatar
  • 60.8k
12 votes

Numerical solution of coupled ODEs with boundary conditions

This is the most difficult of the nearly two dozen nonlinear ODE separatrix computations that I have encountered on Mathematica.SE. Nonetheless, it can be can be solved by a systematically refined ...
bbgodfrey's user avatar
  • 60.8k
12 votes
Accepted

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

The problem is with the default starting initial conditions used by the shooting method in NDSolve. The shooting method is where ...
Michael E2's user avatar
  • 234k
12 votes
Accepted

Numerical solutions of active 1D wave equations

This problem can be solved with method of lines and with FDM as well. Using NDSolve we have ...
Alex Trounev's user avatar
11 votes
Accepted

Frequency domain Maxwell equations with PML boundary conditions

I'm not that familiar with electromagnetism, either, but I think there're at least 4 issues in your solving process: There's no need to "consider only the magnetic field", because electric ...
xzczd's user avatar
  • 63.8k
11 votes

Boundary Condition for Schrödinger Equation in Infinite Range

Let's remember Schrodinger's equation: $i\hbar\frac{\partial}{\partial t} \Psi(\mathbf{r},t) = \left [ \frac{-\hbar^2}{2\mu}\nabla^2 + V(\mathbf{r},t)\right ] \Psi(\mathbf{r},t)$ For the harmonic ...
tsuresuregusa's user avatar
11 votes

Solving stiff boundary value problem

Relaxation solution Your ODE is $$ k \frac{d^2 T}{dx^2} - T^4 = 0, \qquad T(0) = 0.9, \qquad T(1) = 1 $$ where $T$ is a function of $x$. We attempt instead to solve the related PDE $$ k \frac{\...
Michael Seifert's user avatar
10 votes
Accepted

Using DSolve with a boundary condition at -Infinity

This is the solution of your equation without the boundary conditions: ...
Alexei Boulbitch's user avatar
10 votes
Accepted

Boundary Condition for Schrödinger Equation in Infinite Range

Since OP has found this interesting post, let me try to implement the exterior complex scaling method mentioned there. First, make the transform $x= \left\{\begin{array}{cc} & \begin{array}{cc}...
xzczd's user avatar
  • 63.8k
10 votes
Accepted

Error when solving 't Hooft-Polyakov radial equations using NDSolve

Once again, compared to "Shooting" method that is the default and currently the only available method for solving nonlinear boundary value problem (BVP) ...
xzczd's user avatar
  • 63.8k
10 votes

An ODE system easily polluted with spurious eigenvalues

NDEigenValues handles the pair of first-order equations in the question much more accurately, when it is converted into a single second-order equation. ...
bbgodfrey's user avatar
  • 60.8k
10 votes
Accepted

An ODE system easily polluted with spurious eigenvalues

The additional problem added to the end of the question can be solved in a similar manner. Begin with ...
bbgodfrey's user avatar
  • 60.8k
10 votes
Accepted

Where is the numerical solving breaking down?

For this problem, you must specify a solution method. Since the system of equations is nonlinear and the equation for y does not contain derivatives with respect to ...
Alex Trounev's user avatar
10 votes

Where is the numerical solving breaking down?

Fully NDSolve-based Solution Adjustion for spatial step size together with temporal step size helps. I've used parameters mentioned in the comment for testing: <...
xzczd's user avatar
  • 63.8k
10 votes

Numerical solutions of active 1D wave equations

NDSolve-based Solution ...
xzczd's user avatar
  • 63.8k
9 votes

Nonlinear differential equation: numerical solution

This question seeks the separatrix of a nonlinear ODE over the range {0, Infinity}. As noted by Michael E2, many such problems have been presented on this site. (...
bbgodfrey's user avatar
  • 60.8k
9 votes
Accepted

Numerical solution of nonlinear boundary value problem

This system of second-order nonlinear ODEs, like many others in this site, is difficult to solve numerically, because the desired asymptotic solution is a separatrix. As a consequence, infinitesimal ...
bbgodfrey's user avatar
  • 60.8k
9 votes
Accepted

Instability, Courant Condition and Robustness about solving 2D+1 PDE

OK, since neither of the default difference scheme nor the fix function works properly on this PDE, let's discretize the spatial derivative all by ourselves in a ...
xzczd's user avatar
  • 63.8k
9 votes
Accepted

Step size is effectively zero

I think that ODE systems with $\| X'\| \sim O(\| X \|^2)$ tend to be unstable, that is, a small rounding error has a chance to cause a solution to blow up. First, boundary-value problems (BVPs) are ...
Michael E2's user avatar
  • 234k
9 votes

Methods of Numerically Finding Function Minimizing Functional

I'd typically go for "discretize and optimize". Here is a quick and dirty implementation of this strategy that avoids all symbolic computation and that utilizes Sobolev gradient descent with ...
Henrik Schumacher's user avatar
8 votes
Accepted

Trouble with shooting method for a 4th-order differential equation

Interesting equation. It seems to be necessary to use the asymptotic solution as the boundary at $x=x_0$ if you want to solve the equation correctly. Thanks to this answer, we can easily get the ...
xzczd's user avatar
  • 63.8k
8 votes

Setting Up Boundary Conditions for Magnetostatic PDE

Well, I'm not quite familiar with electromagnetism and it's not immediately clear to me how to compare the numeric solution with the analytic solution, but I've circumvented the ...
xzczd's user avatar
  • 63.8k
8 votes
Accepted

Handling "ill-conditioned" system of ODE's with NDSolve

Because the homogeneous ODE is singular at its endpoints, begin by determining the asymptotic solution at one of them, here u == 1. ...
bbgodfrey's user avatar
  • 60.8k
8 votes
Accepted

How to solve this 2nd-order ODE with singularity?

The ODE itself can be solved symbolically. For generality, assume that k and b are undefined and that ...
bbgodfrey's user avatar
  • 60.8k

Only top scored, non community-wiki answers of a minimum length are eligible