{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# class37b - n D does nothing" Function2 usage...

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

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 3a r 2 Sin @ theta D 2 162a 7 2 Π In[5]:= Energy @ 1 D Out[5]= - 13.6059ElectronVolt In[6]:= Energy @ 1, eUnit fi Joule D Out[6]= - 2.1799 * 10 - 18 Joule

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

View Full Document
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::
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

{[ snackBarMessage ]}