axiom-developer
[Top][All Lists]

## [Axiom-developer] Re: conditionally defined functions

 From: Martin Rubey Subject: [Axiom-developer] Re: conditionally defined functions Date: Fri, 17 Sep 2004 18:03:24 +0000

```Hi Ralf,

Ralf HEMMECKE writes:
> Hi Martin,
>
> > As you might know, I'm experimenting with fixes of the following,
> > superficially
> > strange behaviour:
> >
> >
> > (1) -> (1/x)::UP(x, FRAC POLY INT)
> >
> >         1
> >    (1)  -
> >         x
> >                     Type: UnivariatePolynomial(x,Fraction Polynomial
> > Integer)
>
> Hmm, when I simply type 1/x, I get:
>
>          1
>     (4)  -
>          x
>                               Type: Fraction Polynomial Integer
>
> So coercing this into UP(x, FRAC POLY INT) is OK.

Well, I think it shouldn't. But maybe I'm wrong. But in the latter case, I'd
argue that UP(x, FRAC POLY INT) should be a forbidden type.

> It only looks a bit strange, because you might want to get an error message
> telling you that you cannot have x in the denominator.
>
> I made the following experiment:
>
> (5) -> X := monomial(1,1)\$UP(x, FRAC POLY INT)
>     (5)  x
>            Type: UnivariatePolynomial(x,Fraction Polynomial Integer)
> (8) -> inv X
>
>          1
>     (8)  -
>          x
>       Type: Fraction UnivariatePolynomial(x,Fraction Polynomial Integer)
> (9) -> 1/X
>
>          1
>     (9)  -
>          x
>         Type: UnivariatePolynomial(x,Fraction Polynomial Integer)
>

that's interesting. I like (8), but I dislike (9).

> That the types are different is really a bit strange.
>
>
> If I posed the question:
>
> Is UP(x, FRAC POLY INT) = FRAC POLY INT ?
>
> What would you answer? I am not asking for equality of the domains in
> AXIOM, but rather what FRAC POLY INT is mathematically.

FRAC POLY INT is the domain of fractions of polynomials with integer coeffs.

UP(x, FRAC POLY INT) is the domain of univariate polynomials in x, having
fractions of polynomials with integer coeffs as coeffs.

But the latter type makes sense only if you don't allow x to "appear" in the
coefficients.

Note that

(1) -> x::UP(x, FRAC MPOLY([x], INT))

UnivariatePolynomial(x,Fraction MultivariatePolynomial([x],Integer))
is not a valid type.

(1) -> x::UP(x, FRAC MPOLY([y], INT))
(1)  x
Type: UnivariatePolynomial(x,Fraction MultivariatePolynomial([y],Integer))

```