exp(%i*%pi/4) not simplified



Am Samstag, den 25.07.2009, 08:24 -0700 schrieb Richard Fateman:
> It is generally a serious problem to have two representations for the 
> same thing, and so there are probably
> places where sqrt(x)  or something similar is entirely bypassed, and 
> only x^(1/2)  is generated.
> 
> So a rule that operates only on $sqrt may not be so effective unless the 
> user actually types in sqrt().
> 
> I think this needs more testing, e.g. rat(x^(3/2))  subst (1.2,x,%)  ?

Hello Richard,

we do not have two representations for the sqrt function. The name
"sqrt" is only visible to the user on the display. Internally sqrt is
always represented as

((mexpt) x ((rat) 1 2))

Therefore we can declare a rule for sqrt(x) or x^(1/2). It is the same.

(%i1) matchdeclare(xx,atom)$
(%i2) tellsimpafter((xx)^(1/2),(float(xx)^(1/2)));
(%o2) [^rule1, simpexpt]

(%i3) sqrt(2);
(%o3) 1.414213562373095
(%i4) 2^(1/2);
(%o4) 1.414213562373095

The Lisp call ($sqrt x) immediately simplifies the sqrt function to the
internal representation. In the last commit I have moved some special
code from the simplifying function simpsqrt to simpexpt to get sqrt(x)
and x^(1/2) really identical.

Dieter Kaiser