Maybe this signature
  retractIfCan : % -> Union(AlgebraicNumber,"failed")
should support it, when % is EXPR COMPLEX INT.

- Qian

On 3/22/24 20:38, Ralf Hemmecke wrote:
Oh, for my case I have found a simple trick.
First map to Expression(Complex Intger) to Expression(AN) and then retract.

i := sqrt(-1)@AN;
za := map(x+->(real x + i*imag(x)), z)

Ralf

PS: Yes, Qian, your answer looks close.


On 3/22/24 13:22, Ralf Hemmecke wrote:
Suppose by some computation I get an expression like

z := (10*sqrt(163)+11*%i)/13/sqrt(105)

I would like to transform it into an element of AlgebraicNumber.

Unfortunately, up to now I was unable to find a function that helps to to the retraction.

Does someone know a way for cases where I know that the input actually can happily live in AN?

Thank you in advance.
Ralf

PS: That is one of the situations where things that look simple are hard for users to actually perform.



--
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 fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/f6564365-829f-4c5f-9345-1dae7772f546%40gmail.com.

Reply via email to