On Thu, Jul 04, 2024 at 02:23:00PM +0200, Ralf Hemmecke wrote:
> The following session surprised me.
>
> %%% (1) -> e7:=nthRoot((3*sqrt(7)::Expression(INT)+2*sqrt(3))/sqrt(3),3)
>
> +---------------+
> | +-+ +-+
> |3 \|7 + 2 \|3
> (1) |---------------
> 3| +-+
> \| \|3
> Type: Expression(Integer)
> %%% (2) -> a7 := nthRoot((3*sqrt(7)+2*sqrt(3))/sqrt(3),3)
>
> +---------------+
> | +-+ +-+
> |3 \|7 + 2 \|3
> (2) |---------------
> 3| +-+
> \| \|3
> Type: AlgebraicNumber
> %%% (3) -> b7 := nthRoot((3*sqrt(7)+5*sqrt(3))/sqrt(3),3)
>
> +------------+
> 3| +-+ +-+
> (3) \|\|3 \|7 + 5
> Type: AlgebraicNumber
> %%% (4) -> a5 := nthRoot((3*sqrt(5)+2*sqrt(3))/sqrt(3),3)
>
> +------------+
> 3| +-+ +-+
> (4) \|\|3 \|5 + 2
> Type: AlgebraicNumber
>
> When you remove the comment sign from the first line of the attached file
> and execute foo.input in a fresh session, the output will look different.
>
> Well, of course, it shouldn't surprise me. There is caching done in FriCAS.
There is caching and worse, AlgebraicNumber uses the same cache as
Expression(Integer).
> I did not manage to get a rational denominator of e7
>
> %%% (5) -> ratDenom e7
>
> +---------------+
> | +-+ +-+
> |3 \|7 + 2 \|3
> (5) |---------------
> 3| +-+
> \| \|3
> Type: Expression(Integer)
>
> And this I find somewhat user-unfriendly.
Yes, unfortunately current caching mechanizm works in this way.
If you want expressions with rational denominators you can use
'setSimplifyDenomsFlag(true)'. But once you get kernel with
denominator it will stay in the cache till say ')clear all'.
That is one of motivations for recent FunctionSpace change.
It should allow using local caches, so limit pollution to
global cache. And maybe somebody will develop different
caching mechanizm, with nicer behaviour.
--
Waldek Hebisch
--
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/ZoasRGtJE-UrzKkj%40fricas.org.