Mathematica tool box 1

This is a shorthands..on introduction to Mathematica.
 You can find it on most LSU computers.

Notice that all you write is in a  cello with bracket------->

Remove["Global`*"]

If you have used Mathematica earlier and you start new work, it is prudent to start with the above statement. This removes all prior definitions from memory so that they do not interfere with your new work.

Le us do simple math;

Click on the rigth bracket in the next cell  In[1] (not this one with comments)  and then press Shift+Enter

This is an Input cell, which is used to write programs that the computer will interpret and execute. To ask the computer to execute the "program" written in this cell press
	Shift-Enter   (hold the Shift key down and press Enter)
 (make sure that the cursor is inside the cell or that the cell is selected by clicking on the vertical, blue bar).

2+2

2+2

You will get the output Out[1] with th e  value 4

Note: you can do the same operation also with Pull-down menu Kernel--> Evaluation -->Evaluate Cell

Note: there are palettes that have greek characters and mathematical symbols , you can copy them to simlify preparation of your instructions

To get greek letters use
	Escape-Latin letter-Escape.
For example to get α  I press Escape, then a, then Escape again.  Escape-b-Escape give β etc. 
Exercise:  Experiment with all the letters of the latin alphabet to generate the corresponding greek symbols

To produce mathematical symbols we use palettes. There are two pallets:   
	BasicInput 
and 
	BasicTypesetting.  
Here is how you use BasicInput:
	In the menu File, choose Pallets and then BasicInput. In the future I will use the nomenclature
	File/Palettes/BasicInput 
for the above sentence. 
A little window appears with symbols for integrals, sums, square roots etc.  If you want to write an integral do this:
	Click on the integral sign (∫_□^□)□d□ in the palette. 
	The little squares are places for you to type letters in. The integral below is obtained by typing in the squares 
			(∫_0^∞)f(x)dx
	The cursor was initially in the square marking the low integration limit. I typed 0.  Then I pressed Tab and the cursor moved in the square marking the upper limit of the integral.  I went to the BasicTypsetting palette and I clicked on ∞. Then I pressed Tab and wrote f(x). Then I pressed Tab and I wrote x.  Note that after doing this the background of the integral is pink. This tells me that I am in a special "mode" in which I write equations. To get out of this mode I press Control-space (space means the bar that moves the cursor one space).  You can also get out of that mode by clicking on a different part of the cell. 
	To use BasicTypesetting  start with File/Palettes/BasicTypesetting.  You get a window with all kinds of symbols. Let us create the symbol (Subscript[a, 3]^2). In the palette you see (Subscript[□, □]^□) . Click on it. Then type in the squares what you want. Navigate from one square to another square by hitting Tab (or just click on them). When you are done, press Control-space bar or click on another part of the file. 
	If you have been working with one of the Palettes and it disappeared behind the file you are working on, go to Window menu and click on the palette name. That will bring it in front and you can work with it. 
Exercise:
Open a new cell with Alt-7 and type:

	(2.^(1/3))
	
	(∑_(i=2)^15)(i^(1/3))
	
	x ≡(ℏ/(2 m))((∂ψ(x) )/(∂ϕ))
	
	(OverVector[x]) =(({{2, 1}, {3, 5}}))(({{a}, {c}}))
	
With a bit of experimentation and patience you can write any mathematical formula you can think of.

N[(2^(1/3))]

(2.^(1/3))

evaluate

a=231587.326+24310671034.45

Every time " a"is present in a program, it will be replaced by 7.  See below the simplest program, which tells the machine that you want to see the value assigned to a. Type a in an input cell and then press Alt-Enter

a

You can find out what the machine knows about the symbol a as follows

a

?a

If you want new a use

Clear[a]

a

YOU CAN START WITH SOME APPLICATIONS RELATED TO PHYSICAL CHEMISTRY

1. From the palette try to write the following usingsimbols like  (Subscript[\[Placeholder], \[Placeholder]		])
(Subscript[λ, ph])= wavelength
(Subscript[ν, ph])  =frequency
and give them values (firstly without units)

λ1=3

λ=6

λ1

λ 3

(Subscript[λ, ph])

(Subscript[λ, ph])= 589. (10^(-9))

(Subscript[ν, ph])= 5.09 (10^14)

Evaluate (Control +Shift) these cells in red!!!

Calculate (evaluate)  the product

c= (Subscript[λ, ph]) * (Subscript[ν, ph])

make c availbal again!!!

Clear[c]

2. Physical constants etc

h=6.626*(10^(-34))   J s
(Subscript[m, e])=9.109*(10^(-31)) kg
c=2.998*(10^8)  m (s^(-1))
(Subscript[N, A]) =6.02214 *(10^23) (mol^(-1))
hbar=hh=(h/(2 *Pi))

f=1023.0 (s^(-1))

λ=0.317 m

c= f λ

3. More functions:

a1=(Sqrt[(3^2)])

Cos[π/6.]

a2=Sin [(Pi/2.)]

a3= Log[10.]

a4= Log[10, 10.]

a5=Exp[1.]

c1=3.567
c2=0.435
c3=1.111
x=2

a6=1+c1 *(x^1) + c2*(x^2) +c3*(x^3)

This will make x available as variable again!!!!!!!!!!!

Clear[ x]

x

Summation with index i, use array:

Array1[ar,5]

ar[1]=2.79
ar[2]=2.88
ar[3]=2.9
ar[4]=3.1
ar[5]=3.2

ar[4]

(∑_(i=1)^3)ar[i]

(((∑_(i=1)^5)ar[i])/5)

MAKE YOUR OWN FUNCTION, myf

Clear[c]

c=324.8 m (s^(-1))

mm= 0.039948 (kg/mol)

Clear[m]

R = 8.31447 ((kg (m^2))/( mol K (s^2)))

2^2

γ[T_]:= mm (c^2) /( R  T)

γ[T_]:= ((mm (c^2))/(R T))

γ[298.25 K]

myf[x_]:= x^2

myf[5]

If you need more functions write the name of the function in HELP window and you will see how to use it!!!!!!!!!!!!!!!!!!!!!

4. Derivation and integrationxxxxxxxxx   
VOLUME ELEMENTS elements:
(0)1D   dx
(1)     dτ=dV=       dx*dy*dz
(2)     in spherical polar coordinates:  
dτ=  dV      ((r^2) \[DifferentialD]r)*(Sin[θ]\[DifferentialD]θ) *(\[DifferentialD]ϕ)
or  under integral:((∫_0^∞)(r^2) \[DifferentialD]r)*((∫_0^π)Sin[θ]\[DifferentialD]θ)*((∫_0^(2 π))\[DifferentialD]ϕ)

Calculate (use palette)

(∫_0^(Pi/2))(Sin[x])\[DifferentialD]x

∫(x^2)\[DifferentialD]x

(∫_a^b)x\[DifferentialD]x

(∫_0^((3.1415/2)))Cos[x]\[DifferentialD]x

Derivatives : D or (∂_x) \[Placeholder] or (∂_(x,y))\[Placeholder]

Clear[a,b,c]

D[ a b c,c]

(∂_a) (a b c)

D[(x^2),x]

or

(∂_x) (x^2)

(∂_x) (1+ a *(y^m)*(x^n)+ b *Sin[f*x*y]+c*Exp[-d*x] )

(∂_y) (1+ a *(y^m)*(x^n)+ b *Sin[f*x*y]+c*Exp[-d*x] )

Partial derivatives:

D[ (1+(x^n)*(y^m)*(z^o)),x,y,z]

Second derivative

(∂_(x,x))(1+ a *(y^m)*(x^n)+ b *Sin[f*x*y]+c*Exp[-d*x] )

or
D[(1+ a *(y^m)*(x^n)+ b *Sin[f*x*y]+c*Exp[-d*x] ),{x,2}]

Clear[mm,c,T, R]

c=324.8 m (s^(-1))

mm= 0.039948 (kg/mol)

R = 8.31447 ((kg (m^2))/( mol K (s^2)))

(∂_c) (((mm (c^2))/(R T)))

(∂_T) (((mm (c^2))/(R T)))

T=298.25 K

dγ=(Sqrt[(((2 c mm)/(R T))  3.58  (m/s))^2+(-(((c^2) mm)/(R (T^2)))  0.4  K)^2])

dc=(∂_c) (((mm  (c^2))/(R T)))

dT=(∂_T) (((mm  (c^2))/(R T)))

dc=((2 c mm)/(R T))

dT=-(( (c^2) mm)/(R (T^2)))

dT=(∂_T) (((mm  (c^2))/(R T)))

T=298.25 K

dγ=(Sqrt[(dc^2 * (3.58 (m/s))^2) +(dT^2 * (0.4  K)^2)])

5. Solving equations:

Solve [(x^2)==1, x]

Solve[3.* (x^2)-2.* x +1. ==12., x]

------------------------------
FYI : Solving differential equations


DSolve[ {(∂_(x,x))ψ[x] ==(((-2*m))/(hh^2))*(Ek-V)* ψ[x] ,ψ[0]==0}, ψ[x], x ]