The following is a very surprising for a novice, and a bit surprising for me: fricas (1) -> c 0==1; c 1==1; c n==c(n-1)+s*(reduce(+, Type: Void
fricas c 5 Note that the type of fricas coefficient(univariate(c(5), Axiom manages - after a lot of trying- to coerce fricas [coefficient(univariate(c(n), But why does it give up here? Martin
fricas Zq:=SUP(INT)
Type: Type
fricas q:Zq := monomial(1,
Type: SparseUnivariatePolynomial?(Integer)
fricas Zqs:=SUP(Zq)
Type: Type
fricas s:Zqs := monomial(1$Zq,
fricas macro mac(n) == c(n-1) + s*(reduce(+, Type: Void
fricas c(n: Integer): Zqs == (n=0 or n=1 => 1; mac n) Type: Void
fricas c 0 fricas Compiling function c with type Integer -> SparseUnivariatePolynomial (SparseUnivariatePolynomial(Integer))
fricas c 1
fricas c 2
fricas mac 2
I don't know but the output of c(2) is wrong. I would have expected "? ? + 1" in accordance to mac(2). So the typed form of you example doesn't work. And the output looks ugly anyway. :-( Ralf No, Axiom is smart enough :-) --greg, Thu, 22 Feb 2007 11:08:42 -0600 reply In your function you are using the - operation for the upper bound, it is not defined for NNI or PI. Axiom is smart enough to detect the types of the step and the bounds. Because of that it is assumed that the result of (n-1) is an Integer.
Here I even don't define the type of the function: fricas )clear all Type: Void
fricas [coefficient(univariate(c(n), fricas Compiling function c with type Integer -> Polynomial(Integer) fricas Compiling function G36 with type Integer -> Boolean
Type: List(Polynomial(Integer))
I don't know why it gives up in your exemple though. Greg |