home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / sci / math / symbolic / 2264 < prev    next >
Encoding:
Text File  |  1992-08-25  |  1.7 KB  |  53 lines

  1. Newsgroups: sci.math.symbolic
  2. Path: sparky!uunet!stanford.edu!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!fmmoore
  3. From: fmmoore@athena.mit.edu (Fes-Mike Moore)
  4. Subject: function arguments type checking in MapleV
  5. Message-ID: <FMMOORE.92Aug25193637@momoney.mit.edu>
  6. Sender: news@athena.mit.edu (News system)
  7. Nntp-Posting-Host: momoney.mit.edu
  8. Organization: Massachusetts Institute of Technology
  9. Date: Tue, 25 Aug 1992 23:36:43 GMT
  10. Lines: 41
  11.  
  12. I'm trying to define type/procargs as described in ?type[argcheck] (page
  13. 223 of the Maple V Library Reference manual).  This is what I'm
  14. entering:
  15.  
  16.     > `type/expectationargs` := [indexed * function(indexed)];
  17.               type/expectationargs := [indexed function(indexed)]
  18.     > expectation := proc(expr)
  19.     > local i,j,k,l;
  20.     >   if not type([expr], expectationargs) then
  21.     >       ERROR(
  22.     >   `invalid arguments; must be in form of indexed * function(indexed)`)
  23.     > fi;
  24.     > i := op(1,op(1,expr)); 
  25.     > j := op(2,op(1,expr)); 
  26.     > k := op(1,op(1,op(2,expr))); 
  27.     > l := op(2,op(1,op(2,expr))); 
  28.     > print(i,j,k,l) 
  29.     > end;
  30.  
  31. When I run the program, though, I get:
  32.  
  33.     > testarg := z[a,b]*conjugate(z[fes,mike]);
  34.                    testarg := z[a, b] conjugate(z[fes, mike])
  35.  
  36.     _____________________________________________________________________
  37.     > expectation(testarg);
  38.     Error, (in expectation) testing against an invalid type
  39.  
  40. Aren't function and indexed valid types?  If so, why can't they be used
  41. in this manner?  Or am I overlooking something else?  In general I can
  42. do:
  43.  
  44.     > type(conjugate(x), function(name));
  45.                                       true
  46.  
  47. so I presumably shouldn't have any problems with this...
  48.  
  49. Thanks for your help...
  50. --
  51. Fes-Mike Moore
  52. CSSC Student Consultant
  53.