%%
%% 5.2 Quantization and Schrödinger equation (Computational example)
%

clear all
syms hbar m b V_HJG V_WG x t positive
syms psi(x,t) S(x,t) R(x,t) rho(x,t)
Par=[m==1 hbar==1 b==1]

%
%% 1 Hamilton-Jacobi Equation (HJE)
% The HJE expresses the energy by the concept of action S and thus has a clear physical meaning:
% HJE:  {\partial \over\partial t}S(x,t)+
% {1\over 2m}
% \left({{\partial \over\partial x}S(x,t)}\right)^2+
% V_{HGJ}(x)=0
% this results in the time evolution of the action: {\partial\over\partial t} S(x,t)=...

diff(S(x,t),t)+diff(S(x,t),x)^2/2/m+V_HJG==0
e1=isolate(ans,diff(S(x,t),t))

%
%% 2 Continuity equation (CE)
% The CE describes the conservation of density \rho. As the density in a region changes(\dot \rho \ne 0), a corresponding current \vec j=\rho\vec v=\rho \vec\nabla S/m flows through the surface of the region. Therefore, the CE also has a clear physical meaning.
% CE:  \dot\rho(x,t)+
% \vec\nabla\cdot\left({\rho(x,t){\vec\nabla S(x,t)\over m}}\right)=0
% From this follows the time evolution of the density root R = \sqrt \rho:   {\partial\over\partial t} R(x,t)=...

diff(R(x,t)^2,t)==-diff(R(x,t)^2*diff(S(x,t),x)/m,x);
e2=isolate(ans,diff(R(x,t),t))

%
%% 3 Wave function (WF)
% The density describes the physical content, the action describes the dynamics. Both can be combined in one WF:
% WF: \psi(x,t)=R(x,t)exp\left({iS(x,t)\over\hbar}\right).

e3=psi(x,t)==R(x,t)*exp(1i*S(x,t)/hbar)

%
%% 4 Wave equation (WE)
% We consider the wave equation
% WE: -{\hbar\over i}\,{\partial\over \partial t}\psi(x,t)=
% -{\hbar^2\over 2m}\, {\partial^2\over \partial x^2}\psi(x,t)+V_{WG}(x)\psi(x,t)
% The WE can be expressed via the WF through S(x,t) and R(x,t):

e4=-hbar/1i*diff(psi(x,t),t)==-hbar^2*diff(psi(x,t),x,2)/2/m+V_WG*psi(x,t)
sube(e4,[e3,e2,e1]);
eq4=expand(isolate(ans,V_WG))

%
%% 5 Classical interpretation
% Choosing V_{WG} according to 4, the WE is mathematically equivalent to the coupled system of HJE and CE.
% WE5: -{\hbar\over i}\,{\partial\over \partial t}\psi(x,t)=
% -{\hbar^2\over 2m}\, {\partial^2\over \partial x^2}\psi(x,t)+
% \left({
% V_{HJG}(x)+
% {\hbar^2\over 2m}\, {1\over R(x,t)}\,
% {\partial^2\over\partial x^2}R(x,t)
% }\right) \psi(x,t)
% The density \rho
%  describes the statistical distribution of particles. WE5 is an
% equation of classical, statistical physics.

sube(e4,eq4)

%
%% 6 Quantization
% In addition to the WF \ \psi(x,t), WE5 also contains the density root R(x,t). The unification of action and density (or dynamics and content) is incomplete.
% The Schrödinger equation or the quantum mechanics are obtained by eliminating (omitting) the R-term inWE5:
% Schrödinger equation SG\sim WE6:
% WE6:  -{\hbar\over i}\,{\partial\over \partial t}\psi(x,t)=
% -{\hbar^2\over 2m}\, {\partial^2\over \partial x^2}\psi(x,t)+V_{HJG}(x)\psi(x,t)
% This elimination of the R term is called quantization.
% Usually, the quantization is conceived a little differently: namely, by replacing certain terms in the  energy function by operators. This also eliminates the R term.
% The quantization changes the HJG. ThereV_{HJG} becomes

sube(V_WG,eq4)

% The energy E=-\, {\partial \over \partial x}S(x,t) therefore depends on the root density R(x,t)=\sqrt{\rho(x,t)}.

sube(e1,V_HJG==ans)

% The Newtonian separation of content and dynamics is thus cancelled out. The density \rho can no longer be interpreted as particle density. It becomes the probability for the response of a detector.
% Starting from the classical description of absolute and objective world contents, quantization is a transition to the description of contents that appear exclusively in the observation and in relation to it.
% Quantization is the basis of our modern technologies such as information processing or telecommunications.