### Developers Club geek daily blog

1 year, 5 months ago

Transfer of a post of Devendra Kapadia "New in the Wolfram Language: Symbolic PDEs".
The code given in article can be downloaded here.
I express huge gratitude to Kirill Guzenko of KirillGuzenko for the help in transfer and preparation of the publication
.
Partial equations (UrChP) play very important role in mathematics and its applications. They can be used for modeling of the real phenomena, such as fluctuations of the tense string, distribution of a heat flow in a rod, in financial areas. The purpose of this article — to slightly open a veil to the world of UrChP (who else is not familiar to those with it) and to acquaint the reader with how it is possible to solve effectively UrChP in Wolfram Language, using new functionality for a solution of boundary value problems in DSolve, and also new DEigensystem function which appeared in version 10.3.

History UrChP goes back to works of the famous mathematicians of the eighteenth century — Euler,Dalambera,Laplace, however development of this area in the last three centuries did not stop. And therefore I will provide both classical, and modern examples of UrChP in article that will allow to consider this knowledge domain under different corners.

Let's begin with consideration of fluctuations of the tense string with a length π, fixed on both ends. Fluctuations of a string can be simulated by means of the one-dimensional wave equation given below. Here u (x, t) — vertical shift of a point of a string with coordinate x in t timepoint:

Then we set edge conditions, having specified by that that the ends of a string at fluctuations save the provisions.

Let's set initial conditions for the movement of a string now, having specified shifts and speeds of different points of a string in t=0 timepoint:

Now we can use DSolve for a solution of wave equation with initial and edge conditions:

As it is stated above, the solution is the infinite sum of trigonometric functions. The sum returns in not calculated form (Inactive) as each certain member of decomposition has physical interpretation, and often even a small amount of members can be good approach. For example, we can take the first four members for receipt of approximate solution of asol (x, t)

Each member in the sum represents standing wave which can be provided to следующим in the way:

And all these standing waves develop together, forming a smooth curve, as shown in animation below:

Wave equation belongs to the class of the linear hyperbolic partial equations describing distribution of signals with final speeds. UrChP represents a convenient method for modeling of fluctuations in a string or in some other deformirumy body, however it plays even more important role in modern physics and engineering applications since it describes distribution of light and electromagnetic waves.

Let's simulate a heat flow in the rod of unit length isolated since both ends by means of the heat conductivity equation given below now:

As the rod is isolated since both ends, through them there passes the zero heat flow that can be expressed as edge conditions of a type x = 0 and x = 1:

Now it is necessary to specify initial temperature distribution in a rod. In this example we will use the linear function given below. In the left end (x = 0) initial temperature — 20 degrees, in right (x = 1) — 100:

And now we can solve the heat conductivity equation with the set conditions:

As well as in the example given above with wave equation, we can retrieve several members of the sum and receive approximate solution:

The first member of approximate solution — 60 — an average from temperatures on rod borders, and she is stationary temperature for this rod. As shown in temperature function graph from length given below rod temperature quickly reaches stationary value in 60 degrees:

The equation of heat conductivity belongs to the class of linear parabolic partial equations which describe diffusion processes. This the equation simple by sight can often be met in the most different, and sometimes and very unexpected areas. Further in article we will review two examples of this phenomenon.

Let's consider now Laplace's equation which is used for modeling of a steady state of systems, i.e. behavior after some time-dependent already finished transition processes. In a two-dimensional case this equation can be provided as follows:

Let's limit coordinates x and at rectangular area Ω, as shown below:

The classical Dirichlet problem — to find function u (x, y), satisfying to Laplace's equation in area Ω with the set Dirikhle's (DirichletCondition) the condition which defines values on area borders Ω, as shown below:

The Dirichlet problem can be solved with the help of the DSolve function, very gracefully having set at the same time area:

As well as in examples earlier, we can retrieve a quantity of members (we will tell, 100) from the sum and to visualize a solution:

It is necessary to notice that a solution u (x, y) Dirichlet problems it is represented smooth in Ω in spite of the fact that edge conditions have sharp lines. In addition, u (x, y) reaches extreme values on borders while in the center of a rectangle there is a saddle point. These lines are characteristic of linear elliptical equations — a class of partial equations to which Laplace's equation belongs.

Wave equation, the heat conductivity equation, Laplace's equation — the most known examples of classical UrChP. Now we will review three examples of typical modern UrChP, the first among which will be Byurgers's equation for a viscous liquid which can be provided as follows:

This nonlinear UrChP was entered by Johannes Byurgers in the forties as simple model for turbulent flows (parameter ϵ in the equation represents viscosity of liquid). However, ten years later, E. Hopf and D. Cole showed that Byurgers's equation is reduced to the heat conductivity equation, and it means that this equation cannot show chaotic behavior. Cole-Hopfa's conversion allows to solve Byurgers's equations in the closed form for the initial condition set, for example, so:

In this example we will use the DSolveValue function which returns only expression for a solution. Members with function of errors (Erf) in a formula arise from a solution of the corresponding boundary problem of the thermal equation below:

The diagram given below shows change in time of a hypothetical one-dimensional field of flow rates. The solution is represented smooth for positive ϵ, thus that initial condition is kusochno given function:

As it is possible to notice on the diagrams below, the solution aims to discontinuous at a viscosity sremleniye ϵ at zero. Similar solutions with sharp transition (shock solutions) — the known feature of the equations of Byurgers for nonviscous (ϵ = 0) Wednesdays.

As the second example of modern UrChP we will consider Bleka-Shoulz's equation used in financial calculations. This equation was provided for the first time by Fischer Blek and Myron Shoulz in 1973 as model for determination of the theoretical price of the European options, and it is formulated as follows:

where:
with — the option price as function from a value of the stock of s and time of t,
r — an interest rate without risk,
σ — volatility of events.

In their epoch-making article (which was quoted more than 28000 times), Black and Shoulz noted that their equations by means of conversion of variables can be reduced to the heat conductivity equation. This sharp simplification leads to the well-known formula of Bleka-Shoulz for the European options with the final conditions based on the price of execution (strike price) k of an asset in t= T timepoint:

Having armed with this formula, we can calculate values of financial options for typical values of parameters:

The answer will be approved with the value received by means of the embedded function of FinancialDerivative:

As the third example of modern UrChP we will consider Schrodinger equation for an electron in a one-dimensional potential hole with depth of d and the corresponding initial condition. The equation and conditions can be formulated as follows:

This example has an elementary decision which makes imaginary values because of presence of I in Schrodinger equation:

Probability density function for an electron ρ = Ψ Ψ, with use of suitable values of parameters in a task, can be calculated as follows:

We can create animation of change of probability density in time which shows that "center" of an electron in a hole moves here and there:

Own values and own functions play an important role both in a Schrodinger equation solution, and in other UrChP. In particular, they provide "construction blocks" for solutions of wave equations and the equations of heat conductivity in the form of the infinite sums which were given in article earlier. Therefore, as our last example we will consider a task about finding of nine smallest own values and own functions for the operator Laplace with a homogeneous (zero) condition of Dirikhle for three-dimensional spherical area. Let's find nine smallest values λ and the functions corresponding to them ϕ, satisfying Λϕ = λ ϕ which are defined as follows:

The new DEigensystem function in version 10.3 allows to calculate required own values and functions as follows:

Own values in this task are expressed through BesselJZero. There is an example:

Own values can be visualized by means of the DensityPlot3D function which returns beautiful diagrams, as shown below:

UrChP are the important tool in many branches of science and technicians, in statistics and finance. At more fundamental level they provide accurate mathematical statements of some deepest and delicate questions about our Universe, say, about a possibility of existence of naked singularities. By my experience, studying of UrChP awards with a rare combination from practical ideas and intellectual satisfaction.

I recommend to study documentation on DSolve, NDSolve, DEigensystem, NDEigensystem and the finite-element method to learn more about different approaches to solution UrChP in Wolfram Language.

UrChP in a character form are supported in Wolfram Mathematica and Wolfram Language from version 10.3, and soon will be provided also in all other Wolfram software products.