class10 - PHYS 5900 Class 10 (9/16/2009) Zi-Wei Lin...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
PHYS 5900 Class 10 (9/16/2009) Zi-Wei Lin Evaluation of Subexpressions In[1]:= Integrate @ Sqrt @ a + b Sin @ t D ^2 D Cos @ t D ,t D Out[1]= a Log B 2 b Sin @ t D + b a + b Sin @ t D 2 F 2 b + 1 2 Sin @ t D a + b Sin @ t D 2 In[2]:= myPartial = D @ % ,t ê Simplify Out[2]= Cos @ t D 2a + b b Cos @ 2t D 2 Trig functions cannot reduce the above to the original integrand: In[3]:= TrigFactor @ myPartial D Out[3]= Cos @ t D 2a + b b Cos @ 2t D 2 In[4]:= TrigReduce @ myPartial D Out[4]= Cos @ t D 2a + b b Cos @ 2t D 2 In[5]:= TrigExpand @ myPartial D Out[5]= Cos @ t D 2a + b b Cos @ 2t D 2 To verify that the above is the same as the original integrand, we can evaluate subexpressions inside the above output : 1) copy the output : In[6]:= Cos @ t D 2a + b b Cos @ 2t D 2 Out[6]= Cos @ t D 2a + b b Cos @ 2t D
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2) expand the proper subexpression, either through Palettes/Other/AlgebraicManipulation: In[7]:= Cos @ t D 2a + b b Cos @ t D 2 b Sin @ t D 2 2 Out[7]= Cos @ t D 2a + b b Cos @ t D 2 b Sin @ t D 2 2 or using commands : In[8]:= Cos @ t D 2a + b TrigExpand @ b Cos @ 2t DD 2 Out[8]= Cos @ t D 2a + b b Cos @ t D 2 + b Sin @ t D 2 2 3) Simplify subexpression : In[9]:= 1 2 Cos @ t D 2a + Simplify A b b Cos @ t D 2 + b Sin @ t D 2 E Out[9]= Cos @ t D 2a + 2 b Sin @ t D 2 2 In[10]:= Simplify @ % D Out[10]= Cos @ t D a + b Sin @ t D 2 ü We can also do this to check: In[11]:= H myPartial Sqrt @ a + b Sin @ t D ^2 D Cos @ t DL êê Simplify Out[11]= 0 2 class10.nb
Background image of page 2
2.3 Graphical Capabilities ü Two-Dimensional Graphics Basic Plots The normalized eigenfunction for the 1 st excited state of the 1 dimensional harmonic oscillator is 2e x 2 2 x π 1 ê 4 : In[12]:= myFunc = Sqrt @ 2 Pi^ H 1 ê 4 L x Exp @ H x^2 2 D ; In[13]:= Plot @ myFunc, 8 x, 4, 4 <D Out[13]= - 4 - 2 2 4 - 0.6 - 0.4 - 0.2 0.2 0.4 0.6 It's normalized: In[14]:= Integrate @ myFunc^2, 8 x, Infinity, Infinity <D Out[14]= 1 In[15]:= Clear @ myFunc D class10.nb 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
In Plot @ f, 8 x, x min ,x max <D , Mathematica evaluates f for each value of x . it is often faster to do Plot @ Evaluate @ f D , 8 x, x min ,x max <D where evaluate f first into a more explicit expression before it is evaluated numerically for each value of x. This is the same for plotting numerical solutions
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 13

class10 - PHYS 5900 Class 10 (9/16/2009) Zi-Wei Lin...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online