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