$SPAD/src/input collect.input

Timothy Daly December 3, 2016

Abstract

Contents

2

1 License

— license —

--Copyright The Numerical Algorithms Group Limited 1991.

———-

— * —

)set break resume
)spool collect.output
)set message test on
)set message auto off
)clear all
--S 1 of 55
a := [i**3 for i in 0..10]
--R
--R
--R   (1)  [0,1,8,27,64,125,216,343,512,729,1000]
--R                                               Type: List(NonNegativeInteger)
--E 1
--S 2 of 55
b := expand [0..10]
--R
--R
--R   (2)  [0,1,2,3,4,5,6,7,8,9,10]
--R                                                          Type: List(Integer)
--E 2
--S 3 of 55
c := [x**3 for x in b]
--R
--R
--R   (3)  [0,1,8,27,64,125,216,343,512,729,1000]
--R                                                          Type: List(Integer)
--E 3
--S 4 of 55
d := [i**3 for i in 0..10 | even? i]
--R
--R
--R   (4)  [0,8,64,216,512,1000]
--R                                               Type: List(NonNegativeInteger)
--E 4
--S 5 of 55
d := [x**3 for x in b | even? x]

--R
--R
--R   (5)  [0,8,64,216,512,1000]
--R                                                          Type: List(Integer)
--E 5
--S 6 of 55
d := [x for x in c | even? x]
--R
--R
--R   (6)  [0,8,64,216,512,1000]
--R                                                          Type: List(Integer)
--E 6
--S 7 of 55
d := [i**3 for i in 0..10 by 2 | even? i]
--R
--R
--R   (7)  [0,8,64,216,512,1000]
--R                                               Type: List(NonNegativeInteger)
--E 7
--S 8 of 55
e := reverse [i**3 for i in 10..0 by -2 | even? i]
--R
--R
--R   (8)  [0,8,64,216,512,1000]
--R                                               Type: List(NonNegativeInteger)
--E 8
--S 9 of 55
[x - y for x in d for y in e]
--R
--R
--R   (9)  [0,0,0,0,0,0]
--R                                                          Type: List(Integer)
--E 9
--S 10 of 55
[x**3 - y for x in b | even? x for y in e]
--R
--R   (10)  [0,- 56,- 448]
--R                                                          Type: List(Integer)
--E 10
--S 11 of 55
f := [i**3 for i in 0..]
--R
--R   (11)  [0,1,8,27,64,125,216,343,512,729,...]
--R                                             Type: Stream(NonNegativeInteger)

--E 11
--S 12 of 55
[i**3 for i in 0..10]
--R
--R   (12)  [0,1,8,27,64,125,216,343,512,729,1000]
--R                                               Type: List(NonNegativeInteger)
--E 12
--S 13 of 55
[i**3 for i in 0.. while i < 11]
--R
--R   (13)  [0,1,8,27,64,125,216,343,512,729,...]
--R                                             Type: Stream(NonNegativeInteger)
--E 13
--S 14 of 55
[i**3 for i in 0.. for x in 0..10]
--R
--R   (14)  [0,1,8,27,64,125,216,343,512,729,...]
--R                                             Type: Stream(NonNegativeInteger)
--E 14
--S 15 of 55
[ [i**j for j in 0..3] for i in 0..]
--R
--R   (15)
--R   [[1,0,0,0], [1,1,1,1], [1,2,4,8], [1,3,9,27], [1,4,16,64], [1,5,25,125],
--R    [1,6,36,216], [1,7,49,343], [1,8,64,512], [1,9,81,729], ...]
--R                                       Type: Stream(List(NonNegativeInteger))
--E 15
--S 16 of 55
[ [i**j for j in 0..] for i in 0..3]
--R
--R   (16)
--R   [[1,0,0,0,0,0,0,0,0,0,...], [1,1,1,1,1,1,1,1,1,1,...],
--R    [1,2,4,8,16,32,64,128,256,512,...],
--R    [1,3,9,27,81,243,729,2187,6561,19683,...]]
--R                                        Type: List(Stream(Fraction(Integer)))
--E 16
--S 17 of 55
brace [i**3 for i in 10..0 by -2]
--R
--R   (17)  {0,8,64,216,512,1000}
--R                                                Type: Set(NonNegativeInteger)
--E 17
-- Input generated from ContinuedFractionXmpPage

)clear all
--S 18 of 55
c := continuedFraction(314159/100000)
--R
--R
--R              1 |     1  |     1 |     1  |     1 |     1 |     1 |
--R   (1)  3 + +---+ + +----+ + +---+ + +----+ + +---+ + +---+ + +---+
--R            | 7     | 15     | 1     | 25     | 1     | 7     | 4
--R                                             Type: ContinuedFraction(Integer)
--E 18
--S 19 of 55
partialQuotients c
--R
--R
--R   (2)  [3,7,15,1,25,1,7,4]
--R                                                        Type: Stream(Integer)
--E 19
--S 20 of 55
convergents c
--R
--R
--R           22 333 355 9208 9563 76149 314159
--R   (3)  [3,--,---,---,----,----,-----,------]
--R            7 106 113 2931 3044 24239 100000
--R                                              Type: Stream(Fraction(Integer))
--E 20
--S 21 of 55
approximants c
--R
--R
--R                                      ______
--R           22 333 355 9208 9563 76149 314159
--R   (4)  [3,--,---,---,----,----,-----,------]
--R            7 106 113 2931 3044 24239 100000
--R                                              Type: Stream(Fraction(Integer))
--E 21
--S 22 of 55
pq := partialQuotients(1/c)
--R
--R
--R   (5)  [0,3,7,15,1,25,1,7,4]
--R                                                        Type: Stream(Integer)
--E 22
--S 23 of 55

continuedFraction(first pq,repeating [1],rest pq)
--R
--R
--R          1 |     1 |     1  |     1 |     1  |     1 |     1 |     1 |
--R   (6)  +---+ + +---+ + +----+ + +---+ + +----+ + +---+ + +---+ + +---+
--R        | 3     | 7     | 15     | 1     | 25     | 1     | 7     | 4
--R                                             Type: ContinuedFraction(Integer)
--E 23
--S 24 of 55
z:=continuedFraction(3,repeating [1],repeating [3,6])
--R
--R
--R   (7)
--R           1 |     1 |     1 |     1 |     1 |     1 |     1 |     1 |     1 |
--R     3 + +---+ + +---+ + +---+ + +---+ + +---+ + +---+ + +---+ + +---+ + +---+
--R         | 3     | 6     | 3     | 6     | 3     | 6     | 3     | 6     | 3
--R   +
--R       1 |
--R     +---+ + ...
--R     | 6
--R                                             Type: ContinuedFraction(Integer)
--E 24
--S 25 of 55
dens:Stream Integer := cons(1,generate((x+->x+4),6))
--R
--R
--R   (8)  [1,6,10,14,18,22,26,30,34,38,...]
--R                                                        Type: Stream(Integer)
--E 25
--S 26 of 55
cf := continuedFraction(0,repeating [1],dens)
--R
--R
--R   (9)
--R       1 |     1 |     1  |     1  |     1  |     1  |     1  |     1  |
--R     +---+ + +---+ + +----+ + +----+ + +----+ + +----+ + +----+ + +----+
--R     | 1     | 6     | 10     | 14     | 18     | 22     | 26     | 30
--R   +
--R       1  |     1  |
--R     +----+ + +----+ + ...
--R     | 34     | 38
--R                                             Type: ContinuedFraction(Integer)
--E 26
--S 27 of 55
ccf := convergents cf
--R

--R
--R              6 61  860 15541 342762  8927353 268163352  9126481321
--R   (10)  [0,1,-,--,----,-----,------,--------,---------,-----------,...]
--R              7 71 1001 18089 398959 10391023 312129649 10622799089
--R                                              Type: Stream(Fraction(Integer))
--E 27
--S 28 of 55
eConvergents := [2*e + 1 for e in ccf]
--R
--R
--R              19 193 2721 49171 1084483 28245729 848456353 28875761731
--R   (11)  [1,3,--,---,----,-----,-------,--------,---------,-----------,...]
--R               7  71 1001 18089  398959 10391023 312129649 10622799089
--R                                              Type: Stream(Fraction(Integer))
--E 28
--S 29 of 55
eConvergents :: Stream Float
--R
--R
--R   (12)
--R   [1.0, 3.0, 2.7142857142 857142857, 2.7183098591 549295775,
--R    2.7182817182 817182817, 2.7182818287 356957267, 2.7182818284 585634113,
--R    2.7182818284 590458514, 2.7182818284 590452348, 2.7182818284 590452354,
--R    ...]
--R                                                          Type: Stream(Float)
--E 29
--S 30 of 55
exp 1.0
--R
--R
--R   (13)  2.7182818284 590452354
--R                                                                  Type: Float
--E 30
--S 31 of 55
cf := continuedFraction(1,[(2*i+1)**2 for i in 0..],repeating [2])
--R
--R
--R   (14)
--R           1 |     9 |     25 |     49 |     81 |     121 |     169 |     225 |
--R     1 + +---+ + +---+ + +----+ + +----+ + +----+ + +-----+ + +-----+ + +-----+
--R         | 2     | 2     | 2      | 2      | 2      |  2      |  2      |  2
--R   +
--R       289 |     361 |
--R     +-----+ + +-----+ + ...
--R     |  2      |  2
--R                                             Type: ContinuedFraction(Integer)

--E 31
--S 32 of 55
ccf := convergents cf
--R
--R
--R            3 15 105 315 3465 45045 45045 765765 14549535
--R   (15)  [1,-,--,---,---,----,-----,-----,------,--------,...]
--R            2 13  76 263 2578 36979 33976 622637 11064338
--R                                              Type: Stream(Fraction(Integer))
--E 32
--S 33 of 55
piConvergents := [4/p for p in ccf]
--R
--R
--R            8 52 304 1052 10312 147916 135904 2490548 44257352
--R   (16)  [4,-,--,---,----,-----,------,------,-------,--------,...]
--R            3 15 105  315  3465  45045  45045  765765 14549535
--R                                              Type: Stream(Fraction(Integer))
--E 33
--S 34 of 55
piConvergents :: Stream Float
--R
--R
--R   (17)
--R   [4.0, 2.6666666666 666666667, 3.4666666666 666666667,
--R    2.8952380952 380952381, 3.3396825396 825396825, 2.9760461760 461760462,
--R    3.2837384837 384837385, 3.0170718170 718170718, 3.2523659347 188758953,
--R    3.0418396189 294022111, ...]
--R                                                          Type: Stream(Float)
--E 34
--S 35 of 55
continuedFraction((- 122 + 597*%i)/(4 - 4*%i))
--R
--R
--R                            1    |         1     |
--R   (18)  - 90 + 59%i + +---------+ + +-----------+
--R                       | 1 - 2%i     | - 1 + 2%i
--R                                    Type: ContinuedFraction(Complex(Integer))
--E 35
--S 36 of 55
r : Fraction UnivariatePolynomial(x,Fraction Integer)
--R
--R                                                                   Type: Void
--E 36

--S 37 of 55
r := ((x - 1) * (x - 2)) / ((x-3) * (x-4))
--R
--R
--R           2
--R          x  - 3x + 2
--R   (20)  ------------
--R          2
--R         x  - 7x + 12
--R                    Type: Fraction(UnivariatePolynomial(x,Fraction(Integer)))
--E 37
--S 38 of 55
continuedFraction r
--R
--R
--R                  1    |         1     |
--R   (21)  1 + +---------+ + +-----------+
--R             | 1     9     | 16     40
--R             | - x - -     | -- x - --
--R             | 4     8     |  3      3
--R           Type: ContinuedFraction(UnivariatePolynomial(x,Fraction(Integer)))
--E 38
--S 39 of 55
[i*i for i in convergents(z) :: Stream Float]
--R
--R
--R   (22)
--R   [9.0, 11.1111111111 11111111, 10.9944598337 9501385, 11.0002777777 77777778,
--R    10.9999860763 98799786, 11.0000006979 29731039, 10.9999999650 15834446,
--R    11.0000000017 53603304, 10.9999999999 12099531, 11.0000000000 04406066,
--R    ...]
--R                                                          Type: Stream(Float)
--E 39
-- Input for page ForCollectionDetailPage
)clear all
--S 40 of 55
u := [i**3 for i in 1..10]
--R
--R
--R   (1)  [1,8,27,64,125,216,343,512,729,1000]
--R                                                  Type: List(PositiveInteger)
--E 40
--S 41 of 55
u(4)
--R

--R
--R   (2)  64
--R                                                        Type: PositiveInteger
--E 41
--S 42 of 55
[8*i**3 for n in 1..5]
--R
--R
--R           3   3   3   3   3
--R   (3)  [8i ,8i ,8i ,8i ,8i ]
--R                                              Type: List(Polynomial(Integer))
--E 42
--S 43 of 55
[u(2*n) for n in 1..5]
--R
--R
--R   (4)  [8,64,216,512,1000]
--R                                                  Type: List(PositiveInteger)
--E 43
--S 44 of 55
[u(i) for i in 1..10 | even? i]
--R
--R
--R   (5)  [8,64,216,512,1000]
--R                                                  Type: List(PositiveInteger)
--E 44
--S 45 of 55
[x for x in u | even? x]
--R
--R
--R   (6)  [8,64,216,512,1000]
--R                                                  Type: List(PositiveInteger)
--E 45
-- Input for page ForStreamDetailPage
)clear all
--S 46 of 55
u := [i**3 for i in 1..]
--R
--R
--R   (1)  [1,8,27,64,125,216,343,512,729,1000,...]
--R                                                Type: Stream(PositiveInteger)
--E 46
--S 47 of 55

u(4)
--R
--R
--R   (2)  64
--R                                                        Type: PositiveInteger
--E 47
--S 48 of 55
u
--R
--R
--R   (3)  [1,8,27,64,125,216,343,512,729,1000,...]
--R                                                Type: Stream(PositiveInteger)
--E 48
--S 49 of 55
u(16)
--R
--R
--R   (4)  4096
--R                                                        Type: PositiveInteger
--E 49
--S 50 of 55
[i**3 for i in 0.. | even? i]
--R
--R
--R   (5)  [0,8,64,216,512,1000,1728,2744,4096,5832,...]
--R                                             Type: Stream(NonNegativeInteger)
--E 50
--S 51 of 55
[8*i**3 for i in 0..]
--R
--R
--R   (6)  [0,8,64,216,512,1000,1728,2744,4096,5832,...]
--R                                             Type: Stream(NonNegativeInteger)
--E 51
--S 52 of 55
[i**3 for i in 0.. by 2]
--R
--R
--R   (7)  [0,8,64,216,512,1000,1728,2744,4096,5832,...]
--R                                             Type: Stream(NonNegativeInteger)
--E 52
--S 53 of 55
[u(i) for i in 1.. | even? i]
--R

--R
--R   (8)  [8,64,216,512,1000,1728,2744,4096,5832,8000,...]
--R                                                Type: Stream(PositiveInteger)
--E 53
--S 54 of 55
[u(2*i) for i in 1..]
--R
--R
--R   (9)  [8,64,216,512,1000,1728,2744,4096,5832,8000,...]
--R                                                Type: Stream(PositiveInteger)
--E 54
--S 55 of 55
[x for x in u | even? x]
--R
--R
--R   (10)  [8,64,216,512,1000,1728,2744,4096,5832,8000,...]
--R                                                Type: Stream(PositiveInteger)
--E 55
)spool
)lisp (bye)

———-

References^{[1] nothing}

14