There are 2 different issues in your question.

First, difference between %i and sqrt(-1):

When used in expression, one gives EXPR(COMPLEX INT),
the other gives EXPR INT:

(7) -> sin(%i)

   (7)  sin(%i)
                                  Type: Expression(Complex(Integer))
(8) -> sin sqrt(-1)

             +---+
   (8)  sin(\|- 1 )
                                  Type: Expression(Integer)

And the integration code will treat differently for
Expression(Complex(Integer)) and Expression(Integer).

Second, the error in
   integrate(x/( (x^2 - 1/5 - 2*sqrt(-1)/5)*sqrt(x^3 - x)),x)

That's because the interpreter can't automatically figure out
the type for this.  Not sure if it's a bug.  Give it a hint can help:

    x/( (x^2 - 1/5 - 2*sqrt(-1::EXPR INT)/5)*sqrt(x^3 - x))

- Qian

On 6/19/22 16:02, 'Nasser M. Abbasi' via FriCAS - computer algebra system wrote:
I was looking at another question at difference forum. I noticed integrate hangs when using %i for sqrt(-1) but returns right away when type sqrt(-1). But returns with an error message.

But these two should be the same.

===========================
(14) -> %i*%i

    (14)  - 1
                                                       Type: Complex(Integer)
(15) -> sqrt(-1)*sqrt(-1)

    (15)  - 1
=========================

So why this gives error
==========================
(16) -> setSimplifyDenomsFlag(true)

integrate(x/( (x^2 - 1/5 - 2*sqrt(-1)/5)*sqrt(x^3 - x)),x)

    There are 9 exposed and 6 unexposed library operations named -
       having 2 argument(s) but none was determined to be applicable.
       Use HyperDoc Browse, or issue
                                 )display op -
       to learn more about the available operations. Perhaps
       package-calling the operation or using coercions on the arguments
       will allow you to apply the operation.

    Cannot find a definition or applicable library operation named -
       with argument type(s)
                         Polynomial(Fraction(Integer))
                                AlgebraicNumber

       Perhaps you should use "@" to indicate the required return type,
       or "$" to specify which version of the function you need.
======================

But this does not give error (but seems to hang, or take long time for me to wait)

  integrate(x/( (x^2 - 1/5 - 2*%i/5)*sqrt(x^3 - x)),x)

I just changed sqrt(-1) by %i  and nothing else.

--Nasser

--
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] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/f6d9d25d-00aa-4069-8192-33e2f443ea6cn%40googlegroups.com <https://groups.google.com/d/msgid/fricas-devel/f6d9d25d-00aa-4069-8192-33e2f443ea6cn%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/dc51fbdb-16c3-a14a-b2ac-1c293d30f9c0%40gmail.com.

Reply via email to