Should maxima know that if A is complex, A = realpart(A) + %i * imagpart(A) ?



Programs in Maxima are not magic.

A program P will be affected by declarations such as declare(A,complex) only
if P, or one of its subroutines explicitly checks for such information.
Such checks may be costly (if done all over), and since P may have been
written in ignorance of the declaration system,  or even before the
declaration system was written, there may be no connection between P and
declarations, even if it might seem to be a good idea.

In regard to this particular query,

is(equal(b,realpart(b)+%i*imagpart(b)));
  returns true,  without any declarations.

and with the declaration that you show below, I got
for %o52,   UNKNOWN  

Note that there is a difference between "="  and equal(..,..)
and you probably mean the latter.  The test for "=" is presumably supposed
to be relatively fast syntactic equality.

RJF


> -----Original Message-----
> From: maxima-bounces at math.utexas.edu 
> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Rob Frohne
> Sent: Tuesday, December 11, 2007 11:31 PM
> To: Maxima List
> Subject: Should maxima know that if A is complex,A = 
> realpart(A) + %i * imagpart(A) ?
> 
> Hi,
> 
> I'm trying to figure out the tricks to working with complex 
> equations in
> maxima, and wonder about the following:
> 
> (%i49) declare(A, complex);
> (%o49) done
> (%i50) is(realpart(A)=A);
> (%o50) false
> (%i51) is(imagpart(A)=A);
> (%o51) false
> (%i52) is(A=realpart(A)+%i*imagpart(A));
> (%o52) false
> 
> Maxima seems to know that if A is real, realpart(A)=A.
> 
> What do you think?  Is there a good way to fix this, or a good reason
> not to?
> 
> Rob
> 
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>