/usr/share/axiom-20170501/input/usingfunctions.input is in axiom-test 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | )set break resume
)sys rm -f usingfunctions.output
)spool usingfunctions.output
)set message test on
)set message auto off
)clear all
--S 1 of 9
mult(xs:LIST(INT)):EXPR(FLOAT)==reduce(*,[x-z for z in xs::List(INT)])
--R
--R Function declaration mult : List(Integer) -> Expression(Float) has
--R been added to workspace.
--R Type: Void
--E 1
--S 2 of 9
t4:=mult([20,5,1])
--R
--R Compiling function mult with type List(Integer) -> Expression(Float)
--R
--R
--R 3 2
--R (2) x - 26.0 x + 125.0 x - 100.0
--R Type: Expression(Float)
--E 2
--S 3 of 9
integ(f:EXPR(FLOAT),s:Segment(Float)):FLOAT ==
-- simpsons
b:=high(s)
a:=low(s)
fa:=eval(f,[x],[a])
fb:=eval(f,[x],[b])
fmid:=eval(f,[x],[(a+b)/2.])
print [a,b,fa,fb,fmid]
result:=(b-a)/6.0 * (fa+4*fmid+fb)
return result
--R
--R Function declaration integ : (Expression(Float),Segment(Float)) ->
--R Float has been added to workspace.
--R Type: Void
--E 3
--S 4 of 9
integ(t4,1.0..5.0)
--R
--R Compiling function integ with type (Expression(Float),Segment(Float)
--R ) -> Float
--R [1.0,5.0,0.0,0.0,68.0]
--R
--R (4) 181.3333333333 3333333
--R Type: Float
--E 4
--S 5 of 9
intm(xs:LIST(INT),a:FLOAT,b:FLOAT):FLOAT==
g:=mult(xs)
t1:=integ(g,a..b)
return(t1)
--R
--R Function declaration intm : (List(Integer),Float,Float) -> Float has
--R been added to workspace.
--R Type: Void
--E 5
--S 6 of 9
intm([20,5,1],1.0,5.0)
--R
--R Compiling function intm with type (List(Integer),Float,Float) ->
--R Float
--R [1.0,5.0,0.0,0.0,68.0]
--R
--R (6) 181.3333333333 3333333
--R Type: Float
--E 6
)clear all
--S 7 of 9
mult(xs:LIST(FRAC(INT))):EXPR(INT)==reduce(*,[x-z for z in xs])
--R
--R Function declaration mult : List(Fraction(Integer)) -> Expression(
--R Integer) has been added to workspace.
--R Type: Void
--E 7
--S 8 of 9
intm(xs:LIST(FRAC(INT)),a:FRAC(INT),b:FRAC(INT)):FLOAT ==
numeric(integrate(mult(xs),x=a..b)::EXPR(INT))
--R
--R Function declaration intm : (List(Fraction(Integer)),Fraction(
--R Integer),Fraction(Integer)) -> Float has been added to workspace.
--R Type: Void
--E 8
--S 9 of 9
intm([20,5,1],1.0,5.0)
--R
--R (3) 181.3333333333 3333333
--R Type: Float
--E 9
)spool
)lisp (bye)
|