home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / sci / math / symbolic / 3348 < prev    next >
Encoding:
Internet Message Format  |  1993-01-03  |  1.4 KB

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