0% found this document useful (0 votes)
284 views

Applications of MATLAB To Problems in Quantum Mechanics For Research and Education (1995) : Dirac Notation Interpreter

The document describes Dirac notation, which is a formulation of quantum mechanics based on abstract Hilbert space. It introduces some basic replacements rules for translating between Dirac notation and matrix notation. Dirac notation uses operators like |a> to represent vectors and <u|v> to represent scalar products, making quantum mechanical concepts more intuitive. The document then presents an application of MATLAB for interpreting and evaluating expressions in Dirac notation, allowing users to enter statements in a more understandable form.

Uploaded by

Suleman Awan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
284 views

Applications of MATLAB To Problems in Quantum Mechanics For Research and Education (1995) : Dirac Notation Interpreter

The document describes Dirac notation, which is a formulation of quantum mechanics based on abstract Hilbert space. It introduces some basic replacements rules for translating between Dirac notation and matrix notation. Dirac notation uses operators like |a> to represent vectors and <u|v> to represent scalar products, making quantum mechanical concepts more intuitive. The document then presents an application of MATLAB for interpreting and evaluating expressions in Dirac notation, allowing users to enter statements in a more understandable form.

Uploaded by

Suleman Awan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

Dirac notation

Spring 2009

Version: 27.02.2009
Dirac’s formulation of Quantum Mechanics is based on abstract Hilbert space,
which for problems in matrix formulation leads to a set of simple replacements
rules.
A matrix H corresponds to an abstract operator Ĥ and a column vector a
corresponds to an abstract vector |ai. The eigenvalue equation

H11 H12 ... H1n a1 a1


    
 H21 H22 ... H2n  a2   a2 
= Ea 
    
... ... ... ... . .
   
    
Hn1 Hn2 ... Hnn an an

is written in Dirac notation as

Ĥ | a i = Ea | a i (1)

The scalar product in matrix notation

[ u∗1 u∗2 ... u∗n ] v1


 

 v2 

.
 
 
vn
becomes in Dirac notation
hu |vi (2)
Very important for quantum mechanics is the so called general matrix element,
in Dirac notation
h u | V̂ | v i (3)
is in terms of matrices and column vectors
[ u∗1 u∗2 . u∗n ] V11 V12 . V1n v1
  

 V21 V22 . V2n 
 v2 

. . . . .
  
  
Vn1 Vn2 . Vnn vn

The mathematical and physical basis of the Dirac formalism is explained in


many texts on Quantum Mechanics. Though developed for quantum mechan-
ics, it could be used in many other applications of linear algebra.
PAPER
Applications of MATLAB to Problems in
Quantum Mechanics
for Research and Education (1995): Dirac
Notation Interpreter

Ladislav Kocbach

Department of Physics, University of Bergen


Allégaten 55, N-5007 Bergen, Norway
Abstract
Applications of MATLAB to Quantum Mechanics related research and teach-
ing are described. The main application is the Dirac notation Interpreter. In
following sections the paper reviews our applications of MATLAB to problems
in atomic collision physics, formulated in terms of matrices. These sections
are of particular interest to physicists who are considering similar applications
in other fields. A special feature of general interest is a demonstration of an
easy method to write interpreters of local notations using standard MATLAB
functions.

1 Introduction
This contribution describes applications of MATLAB to quantum mechani-
cal problems which are formulated in terms of matrices. A special feature
of general interest is a demonstration that one can quite easily write small
specialized command interpreters using MATLAB’s character-string functions
and MATLAB’s command eval. In this paper, I first shortly review the Dirac
notation as used in Quantum Mechanics. Then I describe the Dirac notation
interpreter in MATLAB and discuss mostly the educational aspect of the work.
In Technical notes I discuss shortly how this interpreter works and how other
interpreters can be constructed. In order to illustrate how this idea emerged
and also for the sake of general information, a more detailed presentation of
our projects is included in this paper.
It should be well known that a large class of quantum mechanical problems
leads to matrix formulation. Our work is related to theory of atomic collisions,
but similar problems are found in parts of nuclear physics, optical physics,
quantum chemistry etc. We have used MATLAB for example for analysis of
problems with non-orthogonal basis. In course of this work, an idea emerged
to write a simple interpreter enabling us to enter the statements in easier
understandable form. Further developement of these ideas resulted in the
above mentioned interpreter package which I hope will be useful for teaching
quantum mechanics.
Turning to applications of computers to teaching natural sciences, let us remark
that the excellent abilities of the modern integrated systems (including MAT-
LAB, and e.g. Mathematica and Maple) are often difficult to exploit efficiently
in teaching. This is caused by specialized command languages and special syn-
tax rules. It takes too much time to learn the language before a simple concept
can be demonstrated. This project shows that it is possible to develop inter-
preters in the command language, which interpret a syntax presumably known
to the students. Because of MATLAB’s excellent character-string processing
repertoir, the interpreter was developed relatively easily.
We also note that the interpreter idea can be extended or adapted to other
problems, for example to define vectors (arrays) with vectors as elements (in-
dexed vectors) or multidimensional arrays. This is also shortly described.

2 Dirac Notation
Dirac’s formulation of Quantum Mechanics is based on abstract Hilbert space,
which for problems in matrix formulation leads to a set of simple replacements
rules.
A matrix H corresponds to an abstract operator Ĥ and a column vector a
corresponds to an abstract vector |ai. The eigenvalue equation

H11 H12 ... H1n a1 a1


    
 H21 H22 ... H2n  a2   a2 
= Ea 
    
... ... ... ... . .
   
    
Hn1 Hn2 ... Hnn an an

is written in Dirac notation as

Ĥ | a i = Ea | a i (4)

The scalar product in matrix notation

[ u∗1 u∗2 ... u∗n ] v1


 

 v2 

.
 
 
vn

becomes in Dirac notation


hu |vi (5)
Very important for quantum mechanics is the so called general matrix element,
in Dirac notation
h u | V̂ | v i (6)
is in terms of matrices and column vectors
[ u∗1 u∗2 . u∗n ] V11 V12 . V1n v1
  

 V21 V22 . V2n 
 v2 

. . . . .
  
  
Vn1 Vn2 . Vnn vn

The mathematical and physical basis of the Dirac formalism is explained in


many texts on Quantum Mechanics, e.g. in [1]. Though developed for quantum
mechanics, it could be used in many other applications of linear algebra.

3 The Interpreter
The Dirac interpreter enables the user to enter the Dirac expressions and
have them evaluated by normal MATLAB matrix operations. We have chosen
to show the corresponding MATLAB expression before evaluation. Having
declared and defined |a > and |b > as two dimensional vectors, we can enter e.g.
linear combinations and even assignments (the constants are c1 = 0.8; c2 = 0.6;
)

Dirac : |a>
MATLAB: --> a
a =
1
0
Dirac : |b>
MATLAB: --> b
b =
0
1
Dirac : |c> = c1 |a> + c2|b>
MATLAB: --> c=c1*a+c2*b
c =
0.8000
0.6000
Dirac : |d> = c2 |a> - c1|b>
MATLAB: --> d=c2*a-c1*b
d =
0.6000
-0.8000
Dirac : <c|d>
MATLAB: --> (c)’*d
ans =
0
Dirac : <c|c>
MATLAB: --> (c)’*c
ans =
1

Projection operators are often a difficult topic. In Dirac notation, using P =


|b >< b|

Dirac : | b > < b |


MATLAB: --> b*(b)’
ans =
0 0
0 1
We can e.g. easily demonstrate that P 2 = P

Dirac : ( | b > < b | )( | b > < b | )


MATLAB: --> (b*(b)’)*(b*(b)’)
ans =
0 0
0 1
Dirac : | b > < b| b > < b |
MATLAB: --> b*(b)’*b*(b)’
ans =
0 0
0 1

The applications to teaching and demonstrations are countless. It should be


also mentioned that the interpreter understands and performs the exponential
of a matrix (replaces exp() by expm() ), and the functions sin(x), cos(x)
and sqrt(x).
4 Orthogonalization example
In this section we show how the well known orthogonalization procedure can be
formulated using Dirac notation with projection operators. In the listing are
the commands of the example, starting by defining the three nonorthogonal
states |a> |b> |c> .
D: |a> |b> |c> |u> |v> |w> [U]
M: a=[1;1;0]; b=[1;0;0]; c=[0.3;1;1];
Dirac : M: U=[1 0 0;0 1 0; 0 0 1] %Unit
U =
1 0 0
0 1 0
0 0 1
Dirac : |a> = |a> / sqrt(<a|a>)
Dirac : |b> = |b> / sqrt(<b|b>)
Dirac : |c> = |c> / sqrt(<c|c>)
Dirac : % Orthogonalization
Dirac : |u> = |a>
Dirac : |v> = ( U - |u><u|) | b >
Dirac : |v> = |v> / sqrt(<v|v>) % Norm
Dirac : |w> = ( U - |u><u| - |v><v| ) |c>
Dirac : |w> = |w> / sqrt(<w|w>) % Norm
% Tests: (shortened table only); Original:
<a|b> <a|c> <b|c>
0.7071 0.6359 0.2075
% The orthonormal
<u|v> <u|w> <v|w>
0 0 0

Commands are followed by a table constructed from parts of the responses


(the MATLAB forms are omitted). The table shows that the new set |u> |v>
|w> is orthogonal, while the original set |a> |b> |c> was not. This example
illustrates the possible use of the interpreter for quite complex tasks.

5 Technical Notes
How does the interpreter work? The main part is a MATLAB function called
parse.m. This function translates a string of characters representing a Dirac
command into a new string with standard MATLAB syntax. For example
>> parse(’ <x| M |y> ’)
ans =
(x)’*M*y
>> parse(’( <a| + <b| ) ( M + N ) |c> ’)
ans =
((a)’+(b)’)*(M+N)*c

The string returned can be evaluated by MATLAB. To do this in a comfortable


way, we have a function which sets up the Dirac enviroment. When typing
Dirac, the control is taken over by Dirac.m All that we type is then input to
this enviroment. This enviroment has been revised many times. One of its
functions is to take care of the work done. In the normal version, Dirac copies
all the commands into a file. Typing ’H:’ (each of the command tokens must
be followed by a colon) inside Dirac brings the following help information:

Dirac : H:
H: help
M: matlab line (execute a matlab line)
D: Declare a vector vec : |vec>
or an operator op : [op]
or a constant c1 : (c1)
example:
Dirac : D: |a> |psi> [L] [Xz] (c1)
..declares Dirac vectors a,psi
operators L, Xz
constant c1
G: show the global objects
example:
Dirac : G:
DECLARED : |a> |b> |psi>
[L] [Xz] (c1) (c2)
$ exit Dirac
a new call Dirac preserves the
global names and their values
General examples:
e: lists the 2-components examples
E: lists the 3-components examples

Naturally, the detailed behaviour can somewhat change in the future versions,
the described state is end of september 1995. The simplest version of Dirac.m,
would look about like this
% simplest possible version of Dirac.m
stopval=0
while stopval==0
InputStr=input(’Dirac : ’,’s’);
if InputStr(1) ==’$’ stopval=1; end
OutStr=parse(InputStr,0);
fprintf(1,’MATLAB: --> %s\n’,OutStr);
eval(OutStr);
end % while

In fact, the present version of Dirac.m is about one hundred lines and it does
many other things, as e.g. passing some of the command strings directly to
MATLAB, keeping track of assigned variables etc., as the help text indicates.
Inner working of parse. I think that an appropriate name for it is an heuris-
tic interpreter. The rules for Dirac notation itself can be easily spelled out, but
in combination with different uses of parantheses, functions and operators the
set of translating rules gets large. Therefore, I keep the parse.m in its orig-
inal style, with a small set of replacement rules and various post-processing
patches. In its present version, the function has about 250 lines, including
some comments. Function parse.m is a character string function and it uses
the following character string manipulating standard MATLAB functions:

% setstr() assign ASCII value to a character


QUOT=setstr(39);
% strrep() replace a substring
teststr=strrep(teststr,’exp’,’^’) ;
% length() Length of a string, for loops
nl = length(teststr)
% findstr() returns a list of occurences
findstr(teststr,’<’)
% splitting strings
yyy=teststr(1:nl-3)
% setting strings together
yyy=[ yyy ’(’ NaME ’)’ QUOT ]

The simplest first test version, which could only do the scalar product <a|b>
used only the strrep() and returned the new string. The present version
can handle all the combinations of signs which ocurred to the author. In fact,
recently a problem with parantheses has been encountered and the repair of
the inconsistency contributed some ten new lines of code.
For teaching and demonstration purposes the standard MATLAB output is
not always suitable. At present, we are thus also working with formatting
routines, as an example this is a printout of a 3 × 3 matrix

(2. ; 0. ; 0. )
(0. ; 1. ; 1.+ 1.i )
(0. ; 1.- 1.i ; -1. )

Concluding this section, I would like to repeat that it is in principle quite easy
to write an interpreter using the string functions mentioned in the above listing.
The interpreter (or perhaps parser) can then be used via a function shown in
the listing Simple Dirac or directly. Unfortunately, only single line codes
can be performed in this way, since both input() and eval() understand
newline-character as a terminator of the string. On the other hand, there
seems to be no limitation on the length of the string which can be executed by
eval() . An interpreter can pack longer commands in the same way as the
following example shows

>> % a long program in 4 strings


>> L1=’X=zeros(10); ’;
>> L2=’for k1=1:10 if k1>3 ’;
>> L3=’for k2=1:10 X(k1,k2)=k1*k2; ’;
>> L4=’end; end; end; ’;
>> % packed into 1 line
>> eval([ L1 L2 L3 L4 ] );
>> % and this checks it
>> X(4,5)+X(3,5)
ans =
20

6 Time-dependent Schrödinger equation for de-


scription of atomic collisions
The approach to atomic collisions implied in this section is called semiclassical,
referring to the fact that only the electrons are treated as quantal particles,
while the atomic motion is simulated by a classical trajectory. This leads to
time-dependent Schrödinger equation (eq. (8) below). The matrix formulation
of this problem arises from expansion of the unknown electron wavefunction
| ψ(t) i in a set of basis functions | φi i , much in analogy with Fourier series
or expansions using orthogonal polynomials
X
| ψ(t) i = ci (t) | φi i (7)

The unknown quantities to be found are the expansion coefficients, which form
a vector. In this formulation, the time-dependent Schrödinger equation
d
i | ψ(t) i = Ĥ(t) | ψ(t) i (8)
dt
is replaced by a set of coupled differential equations, which are conveniently
expressed by matrix notation
c1 H11 H12 ... H1n c1
    

d  c2   H21 H22 ... H2n  c2 


i = 
    
. ... ... ... ... .
   
dt     
cn Hn1 Hn2 ... Hnn cn

Normaly, the basis functions would be orthonormal. In many of the physical


problems we study, the natural sets of basis functions are not orthogonal.
There are currently several possible approaches to this problem, using matrix
inversion or pre-orthogonalization of the basis set. MATLAB has proven to be
a very useful tool for debugging the FORTRAN-based codes and in particular,
to analyze the actual conceptual problems. Some details of the collision codes
can be found e.g. in [2] or [4].

7 General Comment on Collision Studies


For the atomic collisions calculations, a set of quite large FORTRAN codes ex-
ists and new codes are under developemnt. Here it is described how MATLAB
has recently been applied in the process of developement and debugging. In
these applications, MATLAB’s matrix handling and its integrated graphical
abilities are very valuable and cannot be matched by any other approach. On
the other hand, other modern tools are also extremely useful in the discussed
work.
We are applying REDUCE with GENTRAN to check the correctness of al-
gebraic relations in symbolic calculations and outputing directly functioning
FORTRAN code, which is integrated in the system. Here the combination
REDUCE and GENTRAN are unmatched. Mathematica has been useful for
our work because of its large built-in library of physics related functions.
From this we can see that the amount of time spent in mastering to a suffi-
cient degree the details of the various mentioned systems is large and that a
cross-interpreter and information systems would be of great value for efficient
application of these powerful tools.

8 Nonorthogonal basis sets


We describe here another method to treat the nonorthogonal basis sets, which
seems to be well known in Quantum chemistry [3]. It is based on a treatment
of the overlap matrix, oij = h φi | φj i

o11 o12 ... o1n


 
 o21 o22 ... o2n 
(9)
 
... ... ... ...
 
 
on1 on2 ... onn
The overlap matrix O has eigenvalues O1 , O2 , ...., On and its eigenvectors are
arranged as columns in matrix S. Defining a matrix U

(O1 )−1/2 0 ... 0


 
 0 (O2 )−1/2 ... 0 
U = 
(10)
... ... ... ...
 
 
0 0 ... On−1/2

a transformation matrix T can be constructed

T = SU (11)

It is easy to see that


T + OT = U S + OSU = 1 (12)
so that the (scaling) transformation T transforms all the relevant operators
from the original basis to a new basis, which is orthonormal.
This is all well as far as the functions (i.e. vectors) of the basis remain abstract
objects and we work only with the overlap matrix and other relevant operators.
In an application, however, we might also work with the objects themselves
(e.g. to plot their representation), and they might be e.g. N -dimensional vec-
tors (such that their dimension N >> n). Unfortunately, MATLAB cannot
place such general objects in a vector. We have written a demonstration rou-
tine, exploring possible solutions of these problems (see also section 11 or the
next section, which includes plots).

9 Quantum Chemistry inspired Example


An extreme case of non-orthonormal basis is the use of so–called Gaussian
orbitals in Quantum Chemistry and in some physical applications. Here the
basis functions (or states) are the functions
2
| αi i → e−αi r

which are far from orthogonal with respect to the scalar product defined as
Z ∞
2 2
h αi | αj i → e−αi r e−αj r r2 dr
0

The expressions for all the relevant matrix elements are well known analyti-
2

1.8

1.6

1.4

1.2

0.8

0.6

0.4

0.2

0
0 1 2 3 4 5 6

Figure 1: Comparison of the combined Gaussian with the hydrogen ground


state

cally and matrices for overlap and the atomic total energy (hamiltonian) are
thus easily constructed. The alternative orthogonalization procedure (eq.12)
has been applied in terms of a small set of MATLAB functions. The figures
1 and 2 show a typical output for a randomly chosen set of αi . Motivation
1.05

0.95

0.9

0.85

0.8
0 1 2 3 4 5 6

Figure 2: Ratio Gaussian to exact as seen in Fig.1

for this work is to explore the procedures for choosing sets of orbitals and
understanding the procedures used in quantum chemistry. It will also be used
in the course of Atomic and Molecular Physics. The MATLAB functions are
available as mentioned in the Conclusion.
10 Collision Code Debugging
Our general interest is to investigate the two mentioned orthonormalization
procedures with respect to questions which will become clear at the end of
this section. In the theory of atomic collisions, especially those directed to-
wards the studies of electron transfer, the basis states for the electron are
located on both atomic centers. When the atomic centers are far apart, the
overlaps are small and the basis is approximately orthonormal, if each of the
two subsets on each center were orthonormal. As the two atoms approach
each other, the two subsets gradually overlap and for the smallest distances
the effective dimensionality of the basis might become smaller (approaching
the dimensionality of one subset). The small subspace representing the differ-
ence between the two subsets is ’blown up’ by the normalization and this can
lead to numerical problems. This can be studied by investigating the deter-
minant of the overlap matrix. For well separated atoms it approaches one (if
the two subsets are internally orthonormal for each center), but as the atoms
approach each other, the determinant approaches zero.
All the matrix elements involved in the realistic atomic collision calculation are
quite complicated mathematical objects and they were thus evaluated by the
collision FORTRAN program (ref. [4]). The overlap matrices were dumped
as one large rectangular matrix and entered into MATLAB. They were then
investigated using simple MATLAB functions.
In particular, plotting the determinant of the overlap matrix eq. (9).

D(R) = det(O(R))

as function of the interatomic distance R, we were able to detect the reason


for numerical problems in collision calculations.
In short, it can be shown that D(R) cannot cross zero, it can at most have
a zero minimum. It turned out that some of the numbers were not evaluated
but set precisely to assumed, theoretically correct values. After replacing this
by evaluation, the resulting values remaind positive. This is connected with
the fact that the states are nearly linearly dependent (overlaping) and calls
for further detailed investigation of the calculational approach, the details are
however not interesting in this discussion.
The problem of gradually overlapping basis subsets is however quite general
and the applications of symmetric orthonormalization and elimination of un-
physical states is of broader interest. The work on these aspects is done to-
gether with A. Dubois and a paper is in preparation [5] .

11 Multidimensional Array Interpreter


The technical notes included in our MATLAB release contain a suggestion
how to treat multidimensional arrays. It is based on index pointing into a
rectangular array.
In one of our applications we needed to have an array of vectors, but it could
easily be a vector of matrices.
Here we show how it is possible to treat it by interpreting a notation. In this
example, the interpreted string is fed directly to eval.

>>% These must be written explicitely


>> c_1=v(:,1); c_2=v(:,2);
>> c_3=v(:,3); c_4=v(:,4); c_5=v(:,5);
>>% Here is the same using ToVector()
>> for vind=1:5
eval(ToVector(’c_’,’v’,vind));
end
>> vind=4;
>> ToVector(’c_’,’v’,vind)
ans =
c_4=v(:,4);

Listing of function ToVector.m

function os= ToVector( vname, mname, ki)


% translates for vector-array
% outputs (ki=4)
% vname4 = mname(:,4);
os = [ vname sprintf(’%d’,ki) ’=’];
os = [ os mname ’(:,’ ] ;
os = [ os sprintf(’%d’,ki) ’);’ ];

This enables us to use the vectors


c_1,... c_5...
as if they were indexed vectors. In the simple example here only the assignment
is shown, but a general interpreter can be written, using for example the trick
to pack longer commands into a single string as shown at the end of section 5

12 Conclusion
This paper described the applications of MATLAB. It should, however also be
mentioned that other modern integrated systems are also used in this work.
These include REDUCE, Mathematica and Maple. For numerical intensive
tasks MATLAB is unique. For the educational applications, along the lines of
the Dirac notation interpreter, the mainly algebraic systems may be even more
suitable. However, MATLAB’s internal representation of vectors, matrices and
character strings shortened the way from the idea to the first realization to
several hours.
The files and documentation for the Dirac interpreter can be found in the
World Wide Web at the address
http://www.fi.uib.no/AMOS/matlab/
Also some of the other mentioned functions can be found there. If necessary,
the files can be transfered in any other way on request to the author.

Acknowledgements
I would like to thank J. P. Hansen, A. Dubois and S.E. Nielsen for the im-
pulses from the collaboration on atomic physics codes, K. Børve for clarifying
discussions on the methods of Quantum Chemistry, and my son Jan Kocbach
for first introduction to MATLAB.

References
[1] E. Merzbacher: Quantum Mechanics (Wiley International Edition)

[2] J. P. Hansen and K. Taulbjerg, Comp. Phys. Comm. 51,317 (1988) A


preorthonormalization procedure for coupled channel problems

[3] K. Børve (1995), private communication


[4] J. P. Hansen and A. Dubois Comp. Phys. Comm. 67, 456 (1992) Pro-
cedures for analytical and numerical calculation of Coulombic one- and
two-centre integrals

[5] A. Dubois and L. Kocbach, in preparation (1995)


August 23, 2004. About waves, Fourier transforms and all that.
Fourier Methods
Fourier Series
Fourier Transforms

cos(kx − ωt)

ω = 2πν, circular frequency, as opposed to the frequency ν


wavenumber (bølgetall, dimension 1/LENGTH)

cos(kx)

When expanding on interval of length L


L
Waves - harmonic response (oscillations)
00
y + k2y = 0

waves-propagating (not mentioned, check in literature):

∂ 2u 1 ∂ 2u
− =0
∂x2 c2 ∂t2
Fourier Series
Charles Fourier: Not waves, but Heat Conduction
Expansions on a complete set of functions
(drawing, general function on interval of length L)


X
f (x) = an un (x)
n=0

sets of Fourier functions - periodic on the period of length L

x
cos(n 2π)
L
x
cos(n 2π)
L
(drawing, approximating a double-step function inside of an interval of length
L)
Comment: outside of the interval - ghosts - or periodic ’images’ - bonus or
punishment
Connection with linear algebra: Linear function spaces, Linear vector Spaces
Eucledian 3-dim space
Drawing, components
system of unit vectors: unit - length 1

~ex , ~ey , ~ez

~r = x ~ex + y ~ey + z ~ez

which looks very much like

X
r= an un
n

as compared to


X
f (x) = an un (x)
n=0
expansions on bases. How to obtain the expansion coefficients? For 3-dim
Euclid we know
Projections:

x = ~ex · ~r y = ~ey · ~r z = ~ez · ~r

Scalar product, for all three

~ex · ~ex = 1 ~ey · ~ey = 1 ~ez · ~ez = 1

and for all three pairs

~ex · ~ey = 0 ~ex · ~ez = 0 ~ey · ~ez = 0

So how to (schematically, math needed to prove details!) define SCALAR


PRODUCTS
Length = distance between? Finding if f1 and f2 are close to each other:
Z Z
f1 − f2 (f1 − f2 ) dx (f1 − f2 ) · (f1 − f2 ) dx

So the best candidate is


Z
(f1 − f2 ) · (f1 − f2 ) dx

for the distance, suggesting SCALAR PRODUCTS of two functions as


Z
f1 · f2 dx

For complex functions:


Z
f1∗ · f2 dx

f1∗ is complex conjugated of f1 . We know that


if f = u + iv then f ∗ = u − iv
Normalizations must be taken care of
To remember:
How to find expansion coefficients: projections
Tasks:
find your literature about these subjects
demonstrate by a small program the approximation of double-step function
(it is not the most efficient way to find Fourier transforms, but do it by the
integration)

You might also like