The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » sci.math.* » sci.math.symbolic

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Maple unapply
Replies: 2   Last Post: Dec 9, 1996 3:57 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Dirk Alboth

Posts: 25
Registered: 12/8/04
Re: Maple unapply
Posted: Dec 3, 1996 9:02 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Andre Poenitz ( wrote:
: Len Evens ( wrote:
: | I realize that squaring the indentity function is the same as the
: | function described by
: |
: | x -> x^2
: |
: | but is there any special reason Maple does it this way? Is there
: | some way to get it to do exactly the above?

It is actually described in the docs. Maple thinks that all functions
belong to a commutative ring (like C([0,1])). Problem is if the
function doesn't. (Try the same for a matrix-valued function!)

: I is sold as a feature ;-) It would be wonderful if Maple did some
: 'real' simplification on procedures ( (x->x)*(y->y) to (x->x)^2
: or (x->x^2) for that matter...), but the current behaviour is more
: than rudimentary in this respect.

You may also want to try x -> x^2+1.

: The annoying fact is that you can't rely on
: 'type(unapply(...,...),procedure) is true'.

: So far I have found no way to convince Maple that I prefer the
: x->x^2 notation. Maybe I am just lacking some insight.

Some weeks ago, I posted a remark similar to Len's (Andre, you

The problem is that a number of Maple functions rely on this odd
behavior, like D. Thus I found it most convenient to rewrite the
unapply procedure as dounapply (you may want to prefer the name
really_unapply -- but that's too long):

>dounapply := proc(expr) local vars;
vars := op(2..nargs,[args]);
if not type([vars],list(name)) or nops([vars]) <> nops({x}) then
ERROR(`variables must be unique and of type name`)
proc(_x) options operator, arrow; _b end));
> dounapply(x^2,x);

x -> x
> type(",procedure);


dounapply should behave exactly like unapply, except in the mentioned
respect of course. Please mail me about any bugs.

Best wishes,


Dirk Alboth, Mathematics Dept., Paderborn University
33095 Paderborn, Germany

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.