home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: sci.math.symbolic
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!wupost!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watdragon.uwaterloo.ca!daisy.uwaterloo.ca!kogeddes
- From: kogeddes@daisy.uwaterloo.ca (Keith O. Geddes)
- Subject: Re: function arguments type checking in MapleV
- Message-ID: <BtLGK2.9AC@watdragon.uwaterloo.ca>
- Sender: news@watdragon.uwaterloo.ca (USENET News System)
- Organization: University of Waterloo
- References: <FMMOORE.92Aug25193637@momoney.mit.edu>
- Date: Wed, 26 Aug 1992 14:07:14 GMT
- Lines: 57
-
- In article <FMMOORE.92Aug25193637@momoney.mit.edu> fmmoore@athena.mit.edu (Fes-Mike Moore) writes:
- >I'm trying to define type/procargs as described in ?type[argcheck] (page
- >223 of the Maple V Library Reference manual). This is what I'm
- >entering:
- >
- > > `type/expectationargs` := [indexed * function(indexed)];
- > type/expectationargs := [indexed function(indexed)]
- > > expectation := proc(expr)
- > > local i,j,k,l;
- > > if not type([expr], expectationargs) then
- > > ERROR(
- > > `invalid arguments; must be in form of indexed * function(indexed)`)
- > > fi;
- > > i := op(1,op(1,expr));
- > > j := op(2,op(1,expr));
- > > k := op(1,op(1,op(2,expr)));
- > > l := op(2,op(1,op(2,expr)));
- > > print(i,j,k,l)
- > > end;
- >
- >When I run the program, though, I get:
- >
- > > testarg := z[a,b]*conjugate(z[fes,mike]);
- > testarg := z[a, b] conjugate(z[fes, mike])
- >
- > _____________________________________________________________________
- > > expectation(testarg);
- > Error, (in expectation) testing against an invalid type
- >
- >Aren't function and indexed valid types? If so, why can't they be used
- >in this manner? Or am I overlooking something else?
- >
-
- Yes, function and indexed are valid types.
-
- The problem is with the "product" type.
- As one discovers from the help page ?type[structured] (or equivalently,
- in the Maple V Library Reference Manual, Section 2.1.335 "Definition of
- a structured type in Maple" -- see the table on page 252),
- the type "product of terms" must be specified using &*
- and similarly the type "sum of terms" must be specified using &+ .
- An alternative in cases where all terms are of the same type, is to use
- the forms `*`(type) or `+`(type) .
-
- In your case, by changing your first line to
-
- > `type/expectationargs` := [indexed &* function(indexed)];
-
- it will work fine.
-
-
- Professor Keith Geddes
- Director, Symbolic Computation Group
- Department of Computer Science
- University of Waterloo
- Waterloo, Ontario
- Canada N2L 3G1 kogeddes@daisy.uwaterloo.ca
-