Ralf Hemmecke wrote:
> 
> > I just commited fix for the bug to the repository, but note then
> > even with fix you may prefer to use 'sqrt(-1)' insted of '%i' in
> > rules, because '%i' does not match imaginary part of '2 + %i':
> > complex pattern matching considers '%i' and '2 + %i' to be to
> > distinct complex constants.  OTOH 'sqrt(-1)' is considered "kernel"
> > and is matched separately form constants.
> 
> My first thought about this problem was to replace %i by sqrt(-1) within
> the rule command. But then there would be two issues.
> 1) Probably small waste of time to scan the pattern and do the replacement.
> 2) The equation x^2+1 has two solutions %i and -%i. Everyone seems to
> believe that sqrt(-1)=%i, but in fact that choice is arbitrary. Is
> sqrt(-2 %i) equal to (1+%i) or to (-1+%i)? Maybe for sqrt(-1) FriCAS
> makes this fixed choice or maybe not. I haven't checked.
 

FriCAS treats '%i' and 'sqrt(-1)' as two almost unrelated things:
'%i' is just a constant from base ring, while 'sqrt(-1)' is
a kernel.  So '%i*%i' gets passed to Complex and evaluated here.
OTOH 'sqrt(-1)' is an algebraic kernel and 'sqrt(-1)*sqrt(-1)'
is handled by Expression.  One visible difference is type:

(3) -> exp(%i)

          %i
   (3)  %e
                                           Type: Expression(Complex(Integer))
(4) -> exp(sqrt(-1))

           +---+
          \|- 1
   (4)  %e
                                                    Type: Expression(Integer)



-- 
                              Waldek Hebisch
[email protected] 

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to