class37b - @ n D does nothing."; Function2:: usage =...

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

View Full Document Right Arrow Icon
PHYS 5900 Class 37b (12/04/2009Fri) Zi-Wei Lin After saving myPackage`Hydrogen`, here we restart Mathematica to test the package: In[1]:= ? Psi In[2]:= Needs @ "myPackage`HydrogenAtom` " D In[3]:= ? Psi Psi @ n, l, m, r, theta, phi D gives the normalized energy eigenfunctions in the spherical coordinates r, theta, and phi. In[4]:= Psi @ 3, 2, - 2, r, theta, phi D Out[4]= ª - 2 ± phi - r 3 a r 2 Sin @ theta D 2 162 a 7 ± 2 Π In[5]:= Energy @ 1 D Out[5]= - 13.6059 ElectronVolt In[6]:= Energy @ 1, eUnit Joule D Out[6]= - 2.1799 * 10 - 18 Joule
Background image of page 1

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

View Full DocumentRight Arrow Icon
Template for a Package is provided below; it is similar to the structure of the above package Hydrogen` In[7]:= H * Skeleton.m -- a template for packages * L H * set up the package context and import the necessary packages * L BeginPackage @ "Skeleton`", 8 "Package1`", "Package2`" <D ; H * usage messages for symbols intended for export * L Skeleton:: usage = "Skeleton.m is a package that does nothing."; Function1:: usage = "Function1
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: @ n D does nothing."; Function2:: usage = "Function2 @ n, H m:17 LD does even more nothing."; H * begin the private context * L Begin @ "`Private`" D ; H * definition of auxiliary functions * L Aux @ f_ D : = Do @ something D ; H * error messages for objects intended for export * L Skeleton:: badarg = "Sorry, you called `1` with argument `2` ! "; H * definition of functions intended for export * L Function1 @ n_ D : = n; Function2 @ n_, m_: 17 D : = n m ± ; n < 5 ¨¨ Message @ Skeleton:: badarg , Function2, n D ; H * end the private context * L End @D ; H * protect symbols intended for export * L Protect @ Function1, Function2 D ; H * end the package context * L EndPackage @D ; Next we will go over some problems in the homeworks and tests: 2 class37b.nb...
View Full Document

This note was uploaded on 04/25/2010 for the course PHYS 5900 taught by Professor Lin during the Fall '09 term at East Carolina University .

Page1 / 2

class37b - @ n D does nothing."; Function2:: usage =...

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

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