home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: sci.math.symbolic
- Path: sparky!uunet!munnari.oz.au!manuel.anu.edu.au!sserve!tau.ma.adfa.oz.au!ted
- From: ted@tau.ma.adfa.oz.au (Ted Catchpole)
- Subject: Maple "subs" problem
- Message-ID: <1993Jan4.052918.9854@sserve.cc.adfa.oz.au>
- Sender: news@sserve.cc.adfa.oz.au
- Reply-To: e-catchpole@adfa.edu.au
- Organization: Maths Dept. ADFA
- Date: Mon, 4 Jan 1993 05:29:18 GMT
- Lines: 50
-
- I'm a beginning maple user, stuck on what is probably a
- trivial problem. It's to do with "subs". Here it is:
-
- > with(linalg):
-
- > f := proc(x,y) x[1]*x[2]/(y[1]^2+y[2]^2) end:
-
- > g := proc(x,y) grad(f(x,y),y) end:
-
- Now what I wnat is g([1,2],[3,4]).
-
- > f([1,2],[3,4]);
- 2/25
- But . . .
-
- > g([1,2],[3,4]);
- Error, (in grad) wrong number (or type) of parameters in function diff;
-
- This works . . .
-
- > subs(y[1]=3,y[2]=4,g([1,2],y));
- 12 16
- [ - ---, - --- ]
- 625 625
-
- but this doesn't . . .
-
- > y := vector(2):
-
- > subs(y=[3,4],g([1,2],y));
-
- [3, 4][1] [3, 4][2]
- [ - 4 --------------------------, - 4 -------------------------- ]
- 2 2 2 2 2 2
- ([3, 4][1] + [3, 4][2] ) ([3, 4][1] + [3, 4][2] )
-
-
-
- I really need to use the second form, as my real example has (long) vectors of
- runtime-specified length, and it's horrible having to use the first form.
-
- Can anyone help please?
-
- -------------------
- Dr E.A. (Ted) Catchpole Phone : +61 6 268 8895
- Dept. of Mathematics Fax : +61 6 268 8886
- University College Internet : e-catchpole@adfa.edu.au
- Canberra ACT 2600
- AUSTRALIA
- --------------------
-