Currently, Axiom allows fricas (1/x)::UP(x,
and fricas (1/x)::UP(x,
I think that this is calling for trouble, see issue #270. There are two ways to fix this: - forbid (or rather depreciate) towering of domains that contain variables
This is probably the easier way out. However, in order to allow polynomials like `sin(2)*x + sin(3)*x^2` , new domains`UEXPR` and`MEXPR` paralleling`UP` and`MPOLY` would be needed. These are on the OldWishList... - make the coercion to
`UP(x, EXPR INT)` and the like smarter, allowing only coefficients that do not contain the variable`x` . This is what I'm going to discuss on this page.
More precisely: For any polynomial (or series) domain that has a specified list of variables, I want that axiom ensures that any coefficient of a member does not contain one of these variables. Examples: (1/x)::UP(x, EXPR INT) x*2^x::UP(x, EXPR INT) (1/x)::UP(x, FRAC POLY INT) (1/x)::UTS(FRAC POLY INT,x,0) all produce an error x*2^y::UP(x, EXPR INT) would be ok. More generally, the "outermost" domain should "take" all the variables: To achieve this, we need to be able to test wether a given element of a given ring contains a specific variable. Unfortunately, this is not as easy as it seems. For example, However for our purposes something rather primitive is sufficient: All domains that contain variables need to export a function if S has variables2: S -> List Symbol then variables2: % -> List Symbol variables2 f == merge(variables2(numer(f)), variables2(denom(f))) and add the following to if R has variables2: R -> List Symbol then coerce(r:R):% == if member?(x, variables2(r)) then error "coefficient contains variable" else coerce(r)$Rep |