Re: [Maxima-bugs] [ maxima-Bugs-1407378 ] polarform returns a rectangular expression for float argumen



----- Original Message ----- 
From: "Barton Willis" <willisb at unk.edu>
To: "Robert Dodier" <robert.dodier at gmail.com>
Cc: "Maxima" <maxima at math.utexas.edu>
Sent: Thursday, January 19, 2006 3:27 PM
Subject: Re: [Maxima] Re: [Maxima-bugs] [ maxima-Bugs-1407378 ] polarform 
returns a rectangular expression for float argumen


> -----Robert Dodier  wrote: -----
>
>>i'm not sure i know what you mean by object
>>oriented here.
>
> I'd like for the function simplus, for example, to look
> at the property list of non-atom addends to see if there
> was a specific function for adding such objects.

... ordinarily, only atoms have property lists, and these are global, not
lexically bound.  If you are simplifying a+b, do you use the
program for "a" or for "b"?

> If there
> was such a function, simplus would ship the addition
> off to that function. That way simplus could be extended
> without hacking the simplus code. That's all. I don't think
> simplus, simptimes, and ... allow this.

I think the problem is not so easily solved this way.
As a simple example, consider the rule that the objects in
a sum should be sorted lexicographically. That is,
a+b+c  is simplified but b+a+c  is not.  What property
would you place on a, b, or c?

It would be great if you can come up with a good solution
that has eluded previous programmers attempting to write
simplifiers!

(The generic "+" I wrote changes all (+ a b c d ...)   to
(two-arg-+ a (two-arg-+ b ( .....)))

and then does method dispatches e.g. for
(defmethod two-arg-+ ((x number)(y number)) ....)
(defmethod two-arg-+ ((x interval) (y interval)) ....)
(defmethod two-arg-+ ((x interval) (y number)) ....)
etc


>
>>maybe you can give some examples of operations on
>>real_interval (for example) which can't be
>>handled in the current tellsimpafter implementation.
>
> Tell me if I need to study the documentation, but I often
> run into trouble:
>
> (%i1) matchdeclare(x, lambda([s], mapatom(s) or op(s) # 'interval))$
> (%i2) matchdeclare([a,b,c,d],true)$
>
> The warning scares me:
>
> (%i3) tellsimp(x * interval(a,b), interval(min(x*a,x*b), max(x*a,x*b)))$
> Warning: Putting rules on '+' or '*' is inefficient, and may not work.
>
> (%i4) tellsimp(interval(a,b) * interval(c,d),
> interval(min(a*c,a*d,b*c,b*d), max(
> a*c,a*d,b*c,b*d)))$
>
> OK:
>
> (%i5) interval(5,6) * interval(9,12);
> (%o5) interval(45,72)
>
> Yeechs!:
>
> (%i6) interval(5,6) * interval(9,12) * p;
> (%o6) interval(5,6)*interval(9,12)*p
>
> OK:
>
> (%i7) interval(5,6) * p;
> (%o7) interval(MIN(6*p,5*p),MAX(6*p,5*p))
>
> Maybe this can be done with tellsimp; to me, it seems to painful.
> Barton
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>