blob: d3f88c30d3207cde2c61f7cd478eb4bdca6386b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
\documentclass{article}
\usepackage{axiom}
\begin{document}
\title{\$SPAD/src/input arith.input}
\author{The Axiom Team}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
\section{bugs}
\subsection{bug1}
Cannot find a definition or applicable library operation named
reduce with argument type(s)
Variable *
List Segment PositiveInteger
<<bug1>>=
fac3 10
@
<<bugs>>=
)clear all
234+108
234*108
234**108
factor %
z := 1/2
v := (z + 1) ** 10
1024 * %
u := (x+1)**6
differentiate(u,x)
-- factor %
)clear all
-- compute Fibonacci numbers
fib(n | n = 0) == 1
fib(n | n = 1) == 1
fib(n | n > 1) == fib(n-1) + fib(n-2)
fib 5
fib 20
)clear all
-- compute Legendre polynomials
leg(n | n = 0) == 1
leg(n | n = 1) == x
leg(n | n > 1) == ((2*n-1)*x*leg(n-1)-(n-1)*leg(n-2))/n
leg 3
leg 14
-- look at it as a polynomial with rational number coefficients
--% :: POLY FRAC INT
)clear all
-- several flavors of computing factorial
fac1(n | n=1) == 1
fac1(n | n > 1) == n*fac1(n-1)
--
fac2 n == if n = 1 then 1 else n*fac2(n-1)
--
fac3 n == reduce(*,[1..n])
fac1 10
fac2 10
<<bug1>>
@
<<*>>=
)clear all
234+108
234*108
234**108
factor %
z := 1/2
v := (z + 1) ** 10
1024 * %
u := (x+1)**6
differentiate(u,x)
-- factor %
)clear all
-- compute Fibonacci numbers
fib(n | n = 0) == 1
fib(n | n = 1) == 1
fib(n | n > 1) == fib(n-1) + fib(n-2)
fib 5
fib 20
)clear all
-- compute Legendre polynomials
leg(n | n = 0) == 1
leg(n | n = 1) == x
leg(n | n > 1) == ((2*n-1)*x*leg(n-1)-(n-1)*leg(n-2))/n
leg 3
leg 14
-- look at it as a polynomial with rational number coefficients
--% :: POLY FRAC INT
)clear all
-- several flavors of computing factorial
fac1(n | n=1) == 1
fac1(n | n > 1) == n*fac1(n-1)
--
fac2 n == if n = 1 then 1 else n*fac2(n-1)
--
fac3 n == reduce(*,[1..n])
fac1 10
fac2 10
@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}
|