inconsistency Manip.spad and 'Float has PolynomialFactorizationExplicit'

23 views
Skip to first unread message

eric ten cate

unread,
Apr 27, 2026, 10:09:01 AMApr 27
to FriCAS - computer algebra system
Hello Fricas developers,

I am relative new to Fricas. I think there is a small inconsistency in manip.spad.
The 'if-then-else' around rootFactor in the 'Exports' is inconsistent with the if-then-else in 'Implementation', see below.

Can someone tell me why Float does not have PolynomialFactorizationExplicit?
'Float has PolynomialFactorizationExplicit' results in false. Is it not implemented or doesn't Float have the properties?

Thanks,
eric.

Exports ==> with
....
if R has UniqueFactorizationDomain and R has CharacteristicZero
        and R has PolynomialFactorizationExplicit then
            rootFactor : F -> F
              ++ rootFactor(f) transforms every radical of the form
              ++ \spad{(a1*...*am)^(1/n)} appearing in f into
              ++ \spad{a^(1/n)*...*am^(1/n)}.
              ++ This transformation is not in general valid for all
              ++ complex numbers \spad{a} and b.
....

Implementation ==> add
....
   if R has Join(Comparable, GcdDomain, RetractableTo Integer)
     and F has FunctionSpace(R) then
....
      if R has UniqueFactorizationDomain and R has CharacteristicZero
        and R has PolynomialFactorizationExplicit then
...
         rootFactor x == ...

Waldek Hebisch

unread,
Apr 27, 2026, 3:09:56 PMApr 27
to fricas...@googlegroups.com
On Mon, Apr 27, 2026 at 06:21:22AM -0700, eric ten cate wrote:
> Hello Fricas developers,
>
> I am relative new to Fricas. I think there is a small inconsistency in
> manip.spad.
> The 'if-then-else' around rootFactor in the 'Exports' is inconsistent with
> the if-then-else in 'Implementation', see below.

Yes, this is limitation of current implementation, not reflected
in 'Exports' part.

> Can someone tell me why Float does not have PolynomialFactorizationExplicit?
> 'Float has PolynomialFactorizationExplicit' results in false. Is it not
> implemented or doesn't Float have the properties?

It is a mixture of both. First, needed operations are not implemented
for Float. Second, while theoretically well defined the operations
are numerically quite unstable. One could try do define more
appropriate version but it is not clear if the results would be
good.

In general, a lot of algorithms that FriCAS use are "generic",
that is could be used over many domains. But due to approximative
nature of Float and numerical instability using them with Float-s
usualy does not lead to satisfactory result. So in FriCAS there
is tendency to disallow such operations in type rules.
Otherwise users would try them and complain of nonsense results.

--
Waldek Hebisch

eric ten cate

unread,
Apr 28, 2026, 2:25:54 PMApr 28
to fricas...@googlegroups.com

Thank you for the fast reply. Last question, is there a type real besides its representation Float?
I used Expression Float for representing a velocity (waterflow).
Thanks,
Eric 

Op ma 27 apr 2026, 21:09 schreef Waldek Hebisch <de...@fricas.org>:
On Mon, Apr 27, 2026 at 06:21:22AM -0700, eric ten cate wrote:
> Hello Fricas developers,
>
> I am relative new to Fricas. I think there is a small inconsistency in
> manip.spad.
> The 'if-then-else' around rootFactor r in the 'Exports' is inconsistent with
> the if-then-else in 'Implementation', see below.

Yes, this is limitation of current implementation, not reflected
in 'Exports' part.

> Can someone tell me why Float does not have PolynomialFactorizationExplicit?
> 'Float has PolynomialFactorizationExplicit' results in false. Is it not
> implemented or doesn't Float have the properties?

It is a mixture of both.  First, needed operations are not implemented
for Float.  Second, while theoretically well defined the operations
are numerically quite unstable.  One could try do define more
appropriate version but it is not clear if the results would be
good.

In general, a lot of algorithms that FriCAS use are "generic",
that is could be used over many domains.  But due to approximative
nature of Float and numerical instability using them with Float-s
usualy does not lead to satisfactory result.  So in FriCAS there
is tendency to disallow such operations in type rules.
Otherwise users would try them and complain of nonsense results.

--
                              Waldek Hebisch

--
You received this message because you are subscribed to a topic in the Google Groups "FriCAS - computer algebra system" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/fricas-devel/CiHvGg55M3w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to fricas-devel...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/fricas-devel/ae-0geG_LR3BP2Kc%40fricas.org.

Waldek Hebisch

unread,
Apr 28, 2026, 2:47:27 PMApr 28
to fricas...@googlegroups.com
On Tue, Apr 28, 2026 at 08:03:52PM +0200, eric ten cate wrote:
> Thank you for the fast reply. Last question, is there a type real besides
> its representation Float?
> I used Expression Float for representing a velocity (waterflow).
> Thanks,

It is not clear to me what you want to know. Float is arbitrary
precision and has purely software implementation. If you want
hardware floating point use DoubleFloat.

--
Waldek Hebisch

eric ten cate

unread,
May 20, 2026, 4:34:16 PM (6 days ago) May 20
to fricas...@googlegroups.com
Hello mister Waldek,
In the attachment you see an example of what I want to do with formula rewriting and how I use floats and Expression Float.
Maybe you have some advice?

I created the pdf file with jFricas, and it works quite well.
It took some time to answer since I do this in my spare time. 
Thanks, 
Eric.


--
You received this message because you are subscribed to a topic in the Google Groups "FriCAS - computer algebra system" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/fricas-devel/CiHvGg55M3w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to fricas-devel...@googlegroups.com.
FriCAS-Expressions-Chezy.pdf

Waldek Hebisch

unread,
May 20, 2026, 8:10:07 PM (6 days ago) May 20
to fricas...@googlegroups.com
On Wed, May 20, 2026 at 09:42:31PM +0200, eric ten cate wrote:
> Hello mister Waldek,
> In the attachment you see an example of what I want to do with formula
> rewriting and how I use floats and Expression Float.
> Maybe you have some advice?

After quick look I see no floats there. So I do not understand
why you use Expression(Float)?. If you used Expression(Integer)
the simplifications would work. If for some reason you really
need Expression(Float), you can do simplifications using
Expression(Integer) and convert to Expression(Float) at the
end.

--
Waldek Hebisch

Waldek Hebisch

unread,
May 21, 2026, 3:20:40 PM (5 days ago) May 21
to fricas...@googlegroups.com
On Wed, May 20, 2026 at 09:42:31PM +0200, eric ten cate wrote:
> Hello mister Waldek,
> In the attachment you see an example of what I want to do with formula
> rewriting and how I use floats and Expression Float.
> Maybe you have some advice?
>
> I created the pdf file with jFricas, and it works quite well.
> It took some time to answer since I do this in my spare time.
> Thanks,
> Eric.

As I wrote, using Expression(Float) is an unnecessary complication.
AFAICS you can get effect that you want by doing the following:

Chezy_h := h[e] = (Q^2/(C^2 *i*B^2))^(1/3)
Chezy_u := (subst(u=Q/(B*h[e]), Chezy_h))
pu := ratPoly(rhs(Chezy_u))(u)::Polynomial(Integer)
radicalSolve(pu, u)(1)

The first two line automatically produce resulit of type
Equation(Expression(Integer)), 'ratPoly' alone would give
type that is hard to use, providing 'u' and coercing to
Polynomial(Integer) allows using 'radicalSolve' which in
this case produces desired result.

I slightly different spirit, probably 'rootFactor' should
be changed. Currently

rootFactor((x^2)^(1/3))

gives:

+--+
3| 2
(14) \|x
Type: Expression(Integer)

and arguably it should give x^(2/3).

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages