On Sat, Jul 19, 2025 at 10:03:32AM +0200, 'Ralf Hemmecke' via FriCAS - computer 
algebra system wrote:
> I do not quite understand why this doesn't work.
> 
> %%% (225) -> M ==> MultivariatePolynomial(['a,'b], QQ)
> Type: Void
> %%% (226) -> C ==> Fraction R
> Type: Void
> %%% (227) -> R ==> MultivariatePolynomial(['a,'b], QQ)
> Type: Void
> %%% (228) -> C ==> Fraction R
> Type: Void
> %%% (229) -> U ==> Polynomial C
> Type: Void
> %%% (230) -> e1 := 1$U
> 
>    (230)  1
>   Type:
> Polynomial(Fraction(MultivariatePolynomial([a,b],Fraction(Integer))))
> %%% (231) -> e1 + e1
> 
>    (231)  2
>   Type:
> Polynomial(Fraction(MultivariatePolynomial([a,b],Fraction(Integer))))
> %%% (232) -> "x"::Symbol :: U
> 
>    Polynomial(Fraction(MultivariatePolynomial([a,b],Fraction(Integer)))
>       ) is not a valid type.
> 
> %%% (232) -> u1: U := 1
> 
>    Polynomial(Fraction(MultivariatePolynomial([a,b],Fraction(Integer)))
>       ) is not a valid type.
> 
> %%% (232) -> u1: U := 1$U
> 
>    Polynomial(Fraction(MultivariatePolynomial([a,b],Fraction(Integer)))
>       ) is not a valid type.

Look at 'isLegitimateMode' in clammed.boot: it rejects types where
inner and outer polynomial variables intersect.  In your case Polynomial
has all variables so there is intersection and the type is rejected.
You may ask why some construct accept such types and other do not?
Coercion above is potentially ambigious, that is probably the reason.
Similarly assigning 1 is potentially ambigious.  1$U looks fine,
but the test is probably too cude.

For me

monomial(1$U, "x"::Symbol, 1)$U

which avoids ambiguity works.

Certiainly, if we want to reject such things error message should
be clearer.  And if done such rejection should be smarter (x is
a valid variable only for Polynomial, so really no ambiguity here).

And FriCAS is rather inconsistent here, Expression and series
domains have the same problem with variable capture, but are
handled differently than polynomials.

-- 
                              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 visit 
https://groups.google.com/d/msgid/fricas-devel/aHuQUos6FyChU5cL%40fricas.org.

Reply via email to