# Coding and Presenting the Shrodinger Equation

## Presentation Mathematical Markup Language – Part 6

Foreword: In this part of the series, we code the Shrodinger equation, for the web.

By: Chrysanthus Date Published: 20 Feb 2016

### Introduction

This is part 6 of my series, Presentation Mathematical Markup Language. The Shrodinger equation is the most complicated equation I can remember, now. However, it is not complicated to code and present on the web: identify the expressions, nest them and join them using the relevant MathML tags. In this part of the series, we code the Shrodinger equation, for the web. You should have read the previous parts of the series before coming here, as this is a continuation. You will save the file you create in this part of the series as UTF-8 encoding instead of ANSI, otherwise the Ψ and ω characters may not be displayed.

The Equation
The equation is:

$\frac{{\partial }^{2}A{e}^{i\left(kx-\omega t\right)}}{\partial {x}^{2}}+\frac{8{\pi }^{2}m}{{h}^{2}}\left(E-V\right)A{e}^{i\left(kx-\omega t\right)}=0$

The equation is actually more complicated this, but I will not talk about such details.

Two Basic Expressions
The physicists (scientists) themselves present this equation as two basic expressions. That makes our work easy, because our work is to identify all the expressions in the main equation and use relevant MathML tags and code the equation. With two basic equations, we identify the expressions in the basic equations, build the basic equations, and then nest one basic equation in the other.

The two basic expressions are:

$\frac{{\partial }^{2}\Psi }{\partial {x}^{2}}+\frac{8{\pi }^{2}m}{{h}^{2}}\left(E-V\right)\Psi =0$

and

$\Psi =A{e}^{i\left(kx-\omega t\right)}$

The second expression will substitute $\Psi$ in the first expression.
Analyzing the First Expression
The first expression is the addition of two expressions. The first expression of this addition is the partial second derivative, with the Unicode symbol. The second expression in this addition has a parentheses expression, nested in a bigger expression; the bigger expression also has the Unicode symbol. The details of the two expressions in this addition have been explained in the previous parts of the series.

Analyzing the Second Expression
The second expression begins with the variable, A, followed by an invisible times and then an msupscript expression. A parentheses expression is nested in the script (index) expression. The details of this expression have been explained in the previous parts of the series.

The code for the first expression (equation) is (read it):

[itex]
<mfrac>
<mrow>
<msup>
<mo>&#x2202;</mo> <!--PARTIAL DIFFERENTIAL-->
<mn>2</mn>
</msup>
<mi>Ψ</mi>
</mrow>
<mrow>
<mo>&#x2202;</mo> <!--PARTIAL DIFFERENTIAL-->
<msup>
<mi>x</mi>
<mn>2</mn>
</msup>
</mrow>
</mfrac>
<mo>+</mo>
<mrow>
<mfrac>
<mrow>
<mn>8</mn>
<msup>
<mi>&#x3C0;</mi> <!--GREEK SMALL LETTER PI-->
<mn>2</mn>
</msup>
<mi>m</mi>
</mrow>
<msup>
<mi>h</mi>
<mo>2</mo>
</msup>
</mfrac>
<mo>&#x2062;</mo> <!--INVISIBLE TIMES-->
<mrow>
<mo>(</mo>
<mrow>
<mi>E</mi>
<mo>-</mo>
<mi>V</mi>
</mrow>
<mo>)</mo>
</mrow>
<mo>&#x2062;</mo> <!--INVISIBLE TIMES-->
<mi>Ψ</mi>
</mrow>
<mo>=</mo>
<mn>0</mn>
[/itex]

The code for the second expression is (read it):

[itex]
<mi>Ψ</mi>
<mo>=</mo>
<mrow>
<mi>A</mi>
<mo>&#x2062;</mo> <!--INVISIBLE TIMES-->
<msup>
<mi>e</mi>
<mrow>
<mi>i</mi>
<mo>&#x2062;</mo> <!--INVISIBLE TIMES-->
<mrow>
<mo>(</mo>
<mrow>
<mi>k</mi>
<mo>&#x2062;</mo> <!--INVISIBLE TIMES-->
<mi>x</mi>
<mo>-</mo>
<mi>ω</mi>
<mo>&#x2062;</mo> <!--INVISIBLE TIMES-->
<mi>t</mi>
</mrow>
<mo>)</mo>
</mrow>
</mrow>
</msup>
</mrow>
[/itex]

All you have to do from here is nest the code for the second expression (without the math tags) to substitute the Unicode symbol (MathML element) in the two places it occurs in the first expression. The complete code is (read it):

[itex]
<mfrac>
<mrow>
<msup>
<mo>&#x2202;</mo> <!--PARTIAL DIFFERENTIAL-->
<mn>2</mn>
</msup>

<mrow>
<mi>A</mi>
<mo>&#x2062;</mo> <!--INVISIBLE TIMES-->
<msup>
<mi>e</mi>
<mrow>
<mi>i</mi>
<mo>&#x2062;</mo> <!--INVISIBLE TIMES-->
<mrow>
<mo>(</mo>
<mrow>
<mi>k</mi>
<mo>&#x2062;</mo> <!--INVISIBLE TIMES-->
<mi>x</mi>
<mo>-</mo>
<mi>ω</mi>
<mo>&#x2062;</mo> <!--INVISIBLE TIMES-->
<mi>t</mi>
</mrow>
<mo>)</mo>
</mrow>
</mrow>
</msup>
</mrow>

</mrow>
<mrow>
<mo>&#x2202;</mo> <!--PARTIAL DIFFERENTIAL-->
<msup>
<mi>x</mi>
<mn>2</mn>
</msup>
</mrow>
</mfrac>
<mo>+</mo>
<mrow>
<mfrac>
<mrow>
<mn>8</mn>
<msup>
<mi>&#x3C0;</mi> <!--GREEK SMALL LETTER PI-->
<mn>2</mn>
</msup>
<mi>m</mi>
</mrow>
<msup>
<mi>h</mi>
<mo>2</mo>
</msup>
</mfrac>
<mo>&#x2062;</mo> <!--INVISIBLE TIMES-->
<mrow>
<mo>(</mo>
<mrow>
<mi>E</mi>
<mo>-</mo>
<mi>V</mi>
</mrow>
<mo>)</mo>
</mrow>
<mo>&#x2062;</mo> <!--INVISIBLE TIMES-->

<mrow>
<mi>A</mi>
<mo>&#x2062;</mo> <!--INVISIBLE TIMES-->
<msup>
<mi>e</mi>
<mrow>
<mi>i</mi>
<mo>&#x2062;</mo> <!--INVISIBLE TIMES-->
<mrow>
<mo>(</mo>
<mrow>
<mi>k</mi>
<mo>&#x2062;</mo> <!--INVISIBLE TIMES-->
<mi>x</mi>
<mo>-</mo>
<mi>ω</mi>
<mo>&#x2062;</mo> <!--INVISIBLE TIMES-->
<mi>t</mi>
</mrow>
<mo>)</mo>
</mrow>
</mrow>
</msup>
</mrow>

</mrow>
<mo>=</mo>
<mn>0</mn>
[/itex]

Try the complete code.
I discovered last year that mathematics can be separated into two features: expressions and evaluation. I was very happy with this discovery until I had to celebrate. We have all benefited from this discovery; and so, no more use of scanned image for math expressions (formulas and statements).

As you can see from all the parts of this series, coding mathematics is not difficult. You need to identify the expressions, and then use the relevant MathML elements for the expressions.

Legal Issues
In a mathematical expression, the slightest change in number or script, or the using of a wrong identifier, or the omission of an operator, or parentheses, gives wrong result. In fact the slightest error gives wrong result. Before you publish any mathematics production, make sure the math author (scientist) proofreads it first. Otherwise charges may be levied against you by the users (readers).

Mathematics and the Author
I will not end this series without talking about mathematics as a discipline.

I see mathematics as quantized logic; logic that deals with quantities: numbers, speed, length, area, volume, dimensions, etc. The logic in court may be considered as one kind of logic. Programming may be considered as another kind of logic. At the end of the day, logic is logic, but mathematics stands out; and I say, “Mathematics is quantized logic”.

Do not confuse between the word, “quantized “here and the word as used in quantum physics. In my opinion, a more appropriate word to use in quantum physics is “discrete”, because quantum refers to particles that are not continuous (joined).

I hope you appreciated the series.

Chrys

### Related Links

Basics of HTML 5
Basics of ECMAScript
HTML DOM Basics
CSS Basics
Text Elements in HTML
Grouping Content
Microsyntax Dates and Times in HTML
Sectioning Content
Common Idioms without Dedicated Elements
HTML Embedded Content
HTML Insecurities and Prevention
Presentation Mathematical Markup Language
More Related Links
PurePerl MySQL API
Major in Website Design
Perl Course - Optimized
Web Development Course

BACK