Your "error" is in this line. > fallingPower (p,n) == p*fallingPower(p-1,n-1)
Axiom has no chance to figure out at compile time that n-1 is really of type NNI as you required in your signature
> fallingPower : (INT,NNI) -> INT So the best way to deal with that is to help Axiom. The following line works for me in FriCAS. fallingPower (p,n) == p*fallingPower(p-1,(n-1)::NNI) Maybe you have to add "::NNI" in a few other places. Hope that helps Ralf On 07/21/2009 05:44 AM, Michael Becker wrote:
Hi, I have the followin input-file ------- ma2.input ----------------------------------- fallingPower : (INT,NNI) -> INT fallingPower (p,0) == 1 fallingPower (p,n) == p*fallingPower(p-1,n-1) test0 () == n : Matrix Integer n := new(3,3,0) for i in 1..3 repeat _ for j in 1..3 repeat _ n(i,j) := fallingPower(i+j,j) n test1 () == n : Matrix Integer n := new(3,3,0) for i in 1..3 repeat _ for j in 1..3 repeat _ n(i,j) := i+j n test2 () ==n : Matrix Integer n := new(3,3,0)for i in 1..3 repeat _ for j in 1..3 repeat _ n(i,j) := fallingPower(i,j) n test2() test1() test0() -------------------------------------------------- reading this in axiom gives the follwing error -------------------------------------------------- AXIOM Computer Algebra System Version: Axiom (May 2009) Timestamp: Sunday June 21, 2009 at 23:34:35 ----------------------------------------------------------------------------- Issue )copyright to view copyright notices. Issue )summary for a summary of useful system commands. Issue )quit to leave AXIOM and return to shell. ----------------------------------------------------------------------------- Re-reading compress.daase Re-reading interp.daase Re-reading operation.daase Re-reading category.daase Re-reading browse.daase (1) -> (1) -> )re ma2 (1) -> fallingPower : (INT,NNI) -> INT Type: Void fallingPower (p,0) == 1 Type: Void fallingPower (p,n) == p*fallingPower(p-1,n-1) Type: Void test0 () == n : Matrix Integer n := new(3,3,0) for i in 1..3 repeat _ for j in 1..3 repeat _ n(i,j) := fallingPower(i+j,j) n Type: Void test1 () == n : Matrix Integer n := new(3,3,0) for i in 1..3 repeat _ for j in 1..3 repeat _ n(i,j) := i+j n Type: Void test2 () == n : Matrix Integer n := new(3,3,0) for i in 1..3 repeat _ for j in 1..3 repeat _ n(i,j) := fallingPower(i,j) n Type: Void test2() Loading /usr_local/axiom0509/mnt/opensuse/algebra/MATRIX.o for domain Matrix Loading /usr_local/axiom0509/mnt/opensuse/algebra/IIARRAY2.o for domain InnerIndexedTwoDimensionalArray There are no library operations named fallingPower Use HyperDoc Browse or issue )what op fallingPower to learn if there is any operation containing " fallingPower " in its name. Cannot find a definition or applicable library operation named fallingPower with argument type(s) Integer Integer Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. AXIOM will attempt to step through and interpret the code. Compiling function fallingPower with type (Integer, NonNegativeInteger) -> Integer Compiling function test2 with type () -> Matrix Integer Compiling function G1997 with type Integer -> Boolean Loading /usr_local/axiom0509/mnt/opensuse/algebra/MATCAT-.o for domain MatrixCategory& Loading /usr_local/axiom0509/mnt/opensuse/algebra/ARR2CAT-.o for domain TwoDimensionalArrayCategory& +1 0 0+ | | (7) |2 2 0| | | +3 6 6+ Type: Matrix Integer test1() Compiling function test1 with type () -> Matrix Integer +2 3 4+ | | (8) |3 4 5| | | +4 5 6+ Type: Matrix Integer test0() Compiling function test0 with type () -> Matrix Integer Loading /usr_local/axiom0509/mnt/opensuse/algebra/UPMP.o for package UnivariatePolynomialMultiplicationPackage Loading /usr_local/axiom0509/mnt/opensuse/algebra/UP.o for domain UnivariatePolynomial Internal Error Interpreter code generation failed for expression (IF (= |#2| 0) 1 (* |#1| (|fallingPower| (- |#1| 1) (- |#2| 1)))) --------------------------------------------------i can't see whats wrong with 'test0'.-- Michael ps: same result in fricas or open-axiom.
_______________________________________________ Axiom-developer mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/axiom-developer
