To define a constant, use a single equals sign:
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_3.gif]](../Images/MATH.LAB.CHEM155.ST_gr_3.gif)
Once defined, you can use the constant anywhere you want:
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_4.gif]](../Images/MATH.LAB.CHEM155.ST_gr_4.gif)
To avoid problems, erase from memory the assigned value to a
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_5.gif]](../Images/MATH.LAB.CHEM155.ST_gr_5.gif)
When defining a function, you need to remember two important things:
Use an underscore character after each argument name on the left-hand side (but not on the right-hand side)
Use a := in the middle
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_6.gif]](../Images/MATH.LAB.CHEM155.ST_gr_6.gif)
Once defined, you can use the function
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_7.gif]](../Images/MATH.LAB.CHEM155.ST_gr_7.gif)
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_8.gif]](../Images/MATH.LAB.CHEM155.ST_gr_8.gif)
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_9.gif]](../Images/MATH.LAB.CHEM155.ST_gr_9.gif)
The square root of 10
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_10.gif]](../Images/MATH.LAB.CHEM155.ST_gr_10.gif)
We need to tell MATHEMATICA that we need a numerical value. We can use a decimal point
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_11.gif]](../Images/MATH.LAB.CHEM155.ST_gr_11.gif)
or we can use the N function and ask for 50 digits:
N[ Sqrt[10], 50 ]
3^100
N[%]
The command % refers to the previous output
In the following expression I stand for
(3 + 4 I) ^10
More complicated functions
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_13.gif]](../Images/MATH.LAB.CHEM155.ST_gr_13.gif)
Notice the equal ":=" sign that implies a delay calculation, and the underscore "_" sign that implies the independent variable.
Plot a function
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_14.gif]](../Images/MATH.LAB.CHEM155.ST_gr_14.gif)
Make sure that you do not mix the "( ), { } and [ ]" brackets. MATHEMATICA gets confused and it will send you an error message.
Find the zeros
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_15.gif]](../Images/MATH.LAB.CHEM155.ST_gr_15.gif)
Notices "==" logical sign that determines equality.
We can take the derivative of the function:
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_16.gif]](../Images/MATH.LAB.CHEM155.ST_gr_16.gif)
or
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_17.gif]](../Images/MATH.LAB.CHEM155.ST_gr_17.gif)
We have to tell MATHEMATICA to erase from memory defined constants or functions
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_18.gif]](../Images/MATH.LAB.CHEM155.ST_gr_18.gif)
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_19.gif]](../Images/MATH.LAB.CHEM155.ST_gr_19.gif)
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_20.gif]](../Images/MATH.LAB.CHEM155.ST_gr_20.gif)
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_21.gif]](../Images/MATH.LAB.CHEM155.ST_gr_21.gif)
or
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_22.gif]](../Images/MATH.LAB.CHEM155.ST_gr_22.gif)
Integration
in1=NIntegrate [ Sin [Sin[x]], {x, 0, Pi} ]
or
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_23.gif]](../Images/MATH.LAB.CHEM155.ST_gr_23.gif)
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_24.gif]](../Images/MATH.LAB.CHEM155.ST_gr_24.gif)
Relevant integrals in the case of the particle in the box. Here we use regular integration and also we considered a useful mathematical technique to find integrals.
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_25.gif]](../Images/MATH.LAB.CHEM155.ST_gr_25.gif)
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_26.gif]](../Images/MATH.LAB.CHEM155.ST_gr_26.gif)
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_27.gif]](../Images/MATH.LAB.CHEM155.ST_gr_27.gif)
We need to consider some substitutions using the "/." command
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_28.gif]](../Images/MATH.LAB.CHEM155.ST_gr_28.gif)
Notice that "/. tells MATHEMATICA to substitute and that the actual substitution is given by the arrow command ->"and multiple substitution are enclosed by a curly bracket and separated by commas.
Finally consider the following integral:
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_29.gif]](../Images/MATH.LAB.CHEM155.ST_gr_29.gif)
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_30.gif]](../Images/MATH.LAB.CHEM155.ST_gr_30.gif)
A relevant application in Quantum Mechanics
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_34.gif]](../Images/MATH.LAB.CHEM155.ST_gr_34.gif)
First we consider the integral of the square of the wave function
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_35.gif]](../Images/MATH.LAB.CHEM155.ST_gr_35.gif)
Since α is a positive real number the integral is equal to unity. Thus we say that psiH10 is normalized.
Now we take the derivative of the wave function
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_36.gif]](../Images/MATH.LAB.CHEM155.ST_gr_36.gif)
The average <> is proportional by the following integral:
![[Graphics:../Images/MATH.LAB.CHEM155.ST_gr_38.gif]](../Images/MATH.LAB.CHEM155.ST_gr_38.gif)
Problem 1. - Find the value of <> .