Re: [fricas-devel] AlgebraicNumber to RealClosure

2025-03-15 Thread Waldek Hebisch
On Tue, Mar 11, 2025 at 11:22:23AM +0100, 'Ralf Hemmecke' via FriCAS - computer algebra system wrote: > Dear Waldek, > > On 3/7/25 19:16, Waldek Hebisch wrote: > > AFAICS you are interested in _very_ special cases. > > Yes, of course. But this discussion helped me to realize, > that I actually h

Re: [fricas-devel] AlgebraicNumber to RealClosure

2025-03-12 Thread 'Ralf Hemmecke' via FriCAS - computer algebra system
On 3/12/25 19:00, Waldek Hebisch wrote: No, there is also 'rootOf'. Ah, OK, that makes sense. And as you noted my code only makes sense for radical expressions. But that is currently exactly what I need. minPoly is in terms of lower oder kernels. For 'rootOf' minPoly is not a binomial. Ye

Re: [fricas-devel] AlgebraicNumber to RealClosure

2025-03-11 Thread 'Ralf Hemmecke' via FriCAS - computer algebra system
Dear Waldek, On 3/7/25 19:16, Waldek Hebisch wrote: AFAICS you are interested in _very_ special cases. Yes, of course. But this discussion helped me to realize, that I actually have a bit more freedom. I have to anyway investigate all the conjugates where in the end I only care about real root

Re: [fricas-devel] AlgebraicNumber to RealClosure

2025-03-07 Thread Waldek Hebisch
On Fri, Mar 07, 2025 at 04:47:04PM +0100, 'Ralf Hemmecke' via FriCAS - computer algebra system wrote: > Dear Waldek, > > thanks for the reply and apologies for being imprecise. > > Actually the algebraic numbers I talk about are rational expression of > nested radicals. In fact, I get all roots

Re: [fricas-devel] AlgebraicNumber to RealClosure

2025-03-07 Thread 'Ralf Hemmecke' via FriCAS - computer algebra system
Dear Waldek, thanks for the reply and apologies for being imprecise. Actually the algebraic numbers I talk about are rational expression of nested radicals. In fact, I get all roots of a polynomial via radicalRoots $ RadicalSolvePackage(ZZ). Degree is <= 4 (mostly 2). These roots undergo some

Re: [fricas-devel] AlgebraicNumber to RealClosure

2025-03-07 Thread Dima Pasechnik
On Fri, Mar 7, 2025 at 7:30 AM Waldek Hebisch wrote: > > On Fri, Mar 07, 2025 at 01:39:53PM +0100, 'Ralf Hemmecke' via FriCAS - > computer algebra system wrote: > > I have given x: AlgebraicNumber and know already that the value is real. > > But how do you "know" this? We discussed several times

Re: [fricas-devel] AlgebraicNumber to RealClosure

2025-03-07 Thread Waldek Hebisch
On Fri, Mar 07, 2025 at 01:39:53PM +0100, 'Ralf Hemmecke' via FriCAS - computer algebra system wrote: > I have given x: AlgebraicNumber and know already that the value is real. But how do you "know" this? We discussed several times the problem: algebraically conjugates of an algebraic number are

[fricas-devel] AlgebraicNumber to RealClosure

2025-03-07 Thread 'Ralf Hemmecke' via FriCAS - computer algebra system
I have given x: AlgebraicNumber and know already that the value is real. 1) Is there a function that given x and an eps:Fraction(Integer) returns two rational bounds l,u such that l<=x<=u and u-lI am actually interested only in (1), but while looking for it, I came across RealClosure und foun

Re: [fricas-devel] AlgebraicNumber

2024-03-23 Thread Waldek Hebisch
On Fri, Mar 22, 2024 at 08:11:31PM +0100, Ralf Hemmecke wrote: > On 3/22/24 17:14, Waldek Hebisch wrote: > > You asked almost the same thing on 6 Jul 2023. > > Do you see a problem? Well, it was intended as gentl remaider that a lot of solutions are in the mailing list archive. And if mailing li

Re: [fricas-devel] AlgebraicNumber

2024-03-22 Thread Ralf Hemmecke
On 3/22/24 17:14, Waldek Hebisch wrote: You asked almost the same thing on 6 Jul 2023. Do you see a problem? I have at least 2. (1) your solution was too complicated, i.e. hard to remember by heart, (2) it involves InnerTrigonometricManipulations. I consider an "Inner..." package as someth

Re: [fricas-devel] AlgebraicNumber

2024-03-22 Thread Waldek Hebisch
On Fri, Mar 22, 2024 at 08:59:23PM +0800, Qian Yun wrote: > Line 615 of expr.spad. > > (Related function: smp2an, k2an, R2AN). This handles case of Expression(Integer). But to convert %i to AlgebraicNumber one needs to do what ITRIGMNP is doing. -- Waldek Hebisch

Re: [fricas-devel] AlgebraicNumber

2024-03-22 Thread Waldek Hebisch
On Fri, Mar 22, 2024 at 01:22:23PM +0100, 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

Re: [fricas-devel] AlgebraicNumber

2024-03-22 Thread Ralf Hemmecke
Cool, Qian! You are a genius. You seem to have digged out the right place. Now, of course, the question is how to condition that part. For map(x+->(real x + sqrt(-1)@AN*imag(x)), z) to work R must provide "real" and "imag" and their target should be coercible to AN. I think, just testing "R

Re: [fricas-devel] AlgebraicNumber

2024-03-22 Thread Qian Yun
Line 615 of expr.spad. (Related function: smp2an, k2an, R2AN). - Qian On 3/22/24 20:57, Ralf Hemmecke wrote: Maybe this signature    retractIfCan : % -> Union(AlgebraicNumber,"failed") should support it, when % is EXPR COMPLEX INT. Implemented where? Ralf -- You received this message bec

Re: [fricas-devel] AlgebraicNumber

2024-03-22 Thread Ralf Hemmecke
Maybe this signature   retractIfCan : % -> Union(AlgebraicNumber,"failed") should support it, when % is EXPR COMPLEX INT. Implemented where? Ralf -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this gr

Re: [fricas-devel] AlgebraicNumber

2024-03-22 Thread Qian Yun
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 :=

Re: [fricas-devel] AlgebraicNumber

2024-03-22 Thread Ralf Hemmecke
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

Re: [fricas-devel] AlgebraicNumber

2024-03-22 Thread Qian Yun
I can only think of this way: (real z + sqrt(-1)*imag z)::AN - Qian On 3/22/24 20: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

[fricas-devel] AlgebraicNumber

2024-03-22 Thread Ralf Hemmecke
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 kno

Re: [fricas-devel] AlgebraicNumber

2010-06-10 Thread Ralf Hemmecke
>> P why is it always me that runs into bugs? > > I would not call the above a bug: this is fundamental limitation of > AlgebraicNumber. Well, I call it a bug if the specification doesn't match the implementation. Even if the documentation is wrong (which obviously is then), it's a bug.

Re: [fricas-devel] AlgebraicNumber

2010-06-10 Thread Waldek Hebisch
Ralf Hemmecke wrote: > On 06/10/2010 12:43 PM, Bertfried Fauser wrote: > > >> a := sqrt((sqrt(5) + 3)/2) > >> b := (sqrt(5)+1)/2 > >> > >> (51) -> (a=b)::Boolean > >> > >> (51) true > > >> c:= -(sqrt(5)+1)/2 > >> (4) -> (a=c)::Boolean > >> > >> (4) true > > >> (6) -> (b=c)::Boolean > >> >

Re: [fricas-devel] AlgebraicNumber

2010-06-10 Thread Ralf Hemmecke
On 06/10/2010 12:43 PM, Bertfried Fauser wrote: >> a := sqrt((sqrt(5) + 3)/2) >> b := (sqrt(5)+1)/2 >> >> (51) -> (a=b)::Boolean >> >> (51) true >> c:= -(sqrt(5)+1)/2 >> (4) -> (a=c)::Boolean >> >> (4) true >> (6) -> (b=c)::Boolean >> >> (6) false >>T

Re: [fricas-devel] AlgebraicNumber

2010-06-10 Thread Bertfried Fauser
Hi Ralf, > can someone simplify the following expression a to b Not me, but... > a := sqrt((sqrt(5) + 3)/2) > b := (sqrt(5)+1)/2 > > (51) -> (a=b)::Boolean > >   (51)  true >                                    Type: Boolean define > c:= -(sqrt(5)+1)/2 > (4) -> (a=c)::Boolean > > (4) true >

[fricas-devel] AlgebraicNumber

2010-06-10 Thread Ralf Hemmecke
Hello can someone simplify the following expression a to b a := sqrt((sqrt(5) + 3)/2) b := (sqrt(5)+1)/2 I don't seem to be able to find an appropriate function in AN. So maybe a better question is: Should it reduce to b? I think, it should, since (51) -> (a=b)::Boolean (51) true