home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!asuvax!ncar!noao!amethyst!organpipe.uug.arizona.edu!hindmost!rclark
- From: rclark@lpl.arizona.edu (Richard Clark x4971)
- Newsgroups: sci.math.symbolic
- Subject: mathematica ?? feature or bug
- Message-ID: <1993Jan2.125631.23919@organpipe.uug.arizona.edu>
- Date: 2 Jan 93 12:56:31 GMT
- Sender: news@organpipe.uug.arizona.edu
- Distribution: usa
- Organization: Lunar & Planetary Laboratory, Tucson AZ.
- Lines: 25
-
-
- I recently noticed the following feature in mathematica. I define a
- function (rexpand) to carry out an expansion to a desired order. The
- value of 'order' passed to the function is replaced with the global value
- read from input. (of course this gave the results I was wanting, I just
- noticed the error in the script a couple of days ago.)
-
- So how would I write rexpand so that the value of order_ passed to it
- is used instead of the global value?
-
- I am running mathematica interactively and read the following with << as
- the first thing I do in the session.
- I am using mathematica version 1.2 on a Sun4
-
- ---------------------------
- (* r(theta) expansions *)
- order = Input["order for expansions "]
- (* #27.1 from ZT *)
- rexpand[l_,ll_,t_,order_] = l (1 + Sum[ ll[2 n] LegendreP[2 n,t],{n,0,order}])
- r$a = rexpand[a,aa,0,3] (* '3' is the value for order_ *)
- r$s = rexpand[s,ss,Cos[th],3]
- -------------------------------
-
- Richard Clark
- rclark@lpl.arizona.edu
-