home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / sci / math / symbolic / 3353 next >
Encoding:
Text File  |  1993-01-04  |  1.8 KB  |  62 lines

  1. Newsgroups: sci.math.symbolic
  2. Path: sparky!uunet!munnari.oz.au!manuel.anu.edu.au!sserve!tau.ma.adfa.oz.au!ted
  3. From: ted@tau.ma.adfa.oz.au (Ted Catchpole)
  4. Subject: Maple "subs" problem
  5. Message-ID: <1993Jan4.052918.9854@sserve.cc.adfa.oz.au>
  6. Sender: news@sserve.cc.adfa.oz.au
  7. Reply-To: e-catchpole@adfa.edu.au
  8. Organization: Maths Dept. ADFA
  9. Date: Mon, 4 Jan 1993 05:29:18 GMT
  10. Lines: 50
  11.  
  12. I'm a beginning maple user, stuck on what is probably a
  13. trivial problem. It's to do with "subs". Here it is:
  14.  
  15. > with(linalg):
  16.  
  17. > f := proc(x,y) x[1]*x[2]/(y[1]^2+y[2]^2) end:
  18.  
  19. > g := proc(x,y) grad(f(x,y),y) end:
  20.  
  21. Now what I wnat is g([1,2],[3,4]).
  22.  
  23. > f([1,2],[3,4]);
  24.                                       2/25
  25. But . . . 
  26.  
  27. > g([1,2],[3,4]);
  28. Error, (in grad) wrong number (or type) of parameters in function diff;
  29.  
  30. This works . . .
  31.  
  32. > subs(y[1]=3,y[2]=4,g([1,2],y)); 
  33.                                      12     16
  34.                                 [ - ---, - --- ]
  35.                                     625    625
  36.  
  37. but this doesn't . . . 
  38.  
  39. > y := vector(2):
  40.  
  41. > subs(y=[3,4],g([1,2],y)); 
  42.  
  43.                       [3, 4][1]                       [3, 4][2]
  44.        [ - 4 --------------------------, - 4 -------------------------- ]
  45.                        2            2 2                2            2 2
  46.              ([3, 4][1]  + [3, 4][2] )       ([3, 4][1]  + [3, 4][2] )
  47.  
  48.  
  49.                 
  50. I really need to use the second form, as my real example has (long) vectors of 
  51. runtime-specified length, and it's horrible having to use the first form.
  52.                                                                              
  53. Can anyone help please?
  54.  
  55. -------------------
  56. Dr E.A. (Ted) Catchpole        Phone     : +61 6 268 8895
  57. Dept. of Mathematics        Fax      : +61 6 268 8886
  58. University College        Internet : e-catchpole@adfa.edu.au
  59. Canberra  ACT 2600    
  60. AUSTRALIA            
  61. --------------------
  62.