$SPAD/src/input defs.input

The Axiom Team December 3, 2016

Abstract

Contents

2 The otherwise clause is not recognized either in the NAG version or the Axiom version.

— fib —

)clear all
fib(0) == 1
fib(1) == 1
fib(n) == fib(n-1) + fib(n-2) otherwise
fib(10)
fib(100)
[fib(2**i) for i in 1..]

———-

The when clause is not recognized either in the NAG version or the Axiom version. — chebyshev —

chebyshev1: Integer -> UnivariatePolynomial(x,Fraction Integer)
chebyshev1(0) == 1
chebyshev1(1) == x
chebyshev1(n) == 2*x* chebyshev1(n-1) - chebyshev1(n-2) when n > 1
chebyshev1(2)
chebyshev1(7)
chebyshev2 : Integer -> UnivariatePolynomial(x,Fraction Integer)
chebyshev2 == rules
  chebyshev2(0) == 1
  chebyshev2(1) == 2*x
  chebyshev2(n) == 2*x* chebyshev2(n-1) - chebyshev2(n-2) when n > 1
chebyshev2(1)
chebyshev2(4)
chebyshev2(11)

———-

— * —

-- Input for page DefinitionsVsMappings
)clear all
square(x) == x*x
square == x +-> x*x
factorial(0) == 1
factorial(n) == n * fact(n - 1) when n > 0
factorial(n) ==
  n = 0 => 1
  n > 0 => n * factorial(n - 1)
factorial == n +->
  n = 0 => 1
  n > 0 => n * factorial(n - 1)

-- Input for page DefinitionsForFunctions
)clear all
define square(x) == x*x
square(x) == x*x
square(111)
square == x +-> x*x
square(1111)
timesY(x) == x * y
timesY == x +-> x * y
timesY(2)
y := 2
timesY(2)
y := 3
timesY(2)
-- Input for page RulesForVariables
)clear all
rule x == y + z
x
rule y == z + 1
x
z := a; y := 1;
x
a := 2/3
x
-- Input for page RulesVsAssignments
)clear all
rule x == y + 1; rule y == z + 1; rule z == 7;
[x,y,z]
rule z == 7; rule y == z + 1; rule x == y + 1; [x, y, z]
rule z == 1; [x, y, z]
a := b + 1; b := c + 1; c := 7;
[a, b, c]
b := 5; [a, b, c]
c := 7; b := c + 1; a := b + 1; [a, b, c]
p := q + 1; rule q == r + 1; r := 7; [p, q, r]
r := 1; [p, q, r]
-- Input for page RecurrenceRelations
\getchunk{fib}
\getchunk{chebyshev}

———-

References^{[1] nothing}

5