$SPAD/src/input elemnum.input

Stephen Watt and Timothy Daly

December 3, 2016

Abstract

Contents

2

1 License

— license —

--Copyright The Numerical Algorithms Group Limited 1991.

———-

— * —

)spool elemnum.output
)set message test on
)set message auto off
)clear all
)set break resume

———-

Test numeric evaluation of elementary functions. SMW June 26, 1991.

— * —

--S 1  of 50
x := 0.7::Float
--R
--R
--R   (1)  0.7
--R                                                                  Type: Float
--E 1
--S 2 of 50
[exp log x]
--R
--R
--R   (2)  [0.7]
--R                                                            Type: List(Float)
--E 2
--S 3 of 50
[log exp x]
--R
--R
--R   (3)  [0.7]
--R                                                            Type: List(Float)
--E 3
--S 4 of 50
[sin asin x,  cos acos x,  tan atan x,  cot acot x]
--R
--R
--R   (4)  [0.7,0.7,0.7,0.7]

--R                                                            Type: List(Float)
--E 4
--S 5 of 50
[asin sin x,  acos cos x,  atan tan x,  acot cot x, acsc csc x,   asec sec x  ]
--R
--R
--R   (5)  [0.7,0.7,0.7,0.7,0.7,0.7]
--R                                                            Type: List(Float)
--E 5
--S 6 of 50
[sinh asinh x,             tanh atanh x,             csch acsch x,sech asech x]
--R
--R
--R   (6)  [0.7,0.7,0.7,0.7]
--R                                                            Type: List(Float)
--E 6
--S 7 of 50
[asinh sinh x,acosh cosh x,atanh tanh x,acoth coth x,acsch csch x,asech sech x]
--R
--R
--R   (7)  [0.7,0.7,0.7,0.7,0.7,0.7]
--R                                                            Type: List(Float)
--E 7
--should give errors:
--acsc  x
--asec  x
--acosh x
--acoth x
--S 8 of 50
x := 1.1::Float
--R
--R
--R   (8)  1.1
--R                                                                  Type: Float
--E 8
--S 9 of 50
[exp log x]
--R
--R
--R   (9)  [1.1]
--R                                                            Type: List(Float)
--E 9
--S 10 of 50

[log exp x]
--R
--R
--R   (10)  [1.1]
--R                                                            Type: List(Float)
--E 10
--S 11 of 50
[                          tan atan x,  cot acot x, csc acsc x,   sec asec x  ]
--R
--R
--R   (11)  [1.1,1.1,1.1,1.1]
--R                                                            Type: List(Float)
--E 11
--S 12 of 50
[asin sin x,  acos cos x,  atan tan x,  acot cot x, acsc csc x,   asec sec x  ]
--R
--R
--R   (12)  [1.1,1.1,1.1,1.1,1.1,1.1]
--R                                                            Type: List(Float)
--E 12
--S 13 of 50
[sinh asinh x,cosh acosh x,             coth acoth x,csch acsch x             ]
--R
--R
--R   (13)  [1.1,1.1,1.1,1.1]
--R                                                            Type: List(Float)
--E 13
--S 14 of 50
[asinh sinh x,acosh cosh x,atanh tanh x,acoth coth x,acsch csch x,asech sech x]
--R
--R
--R   (14)  [1.1,1.1,1.1,1.1,1.1,1.1]
--R                                                            Type: List(Float)
--E 14
--should give errors:
--asin x
--acos x
--atanh x
--asech x
--S 15 of 50
x := 0.7::DoubleFloat
--R
--R
--R   (15)  0.69999999999999996

--R                                                            Type: DoubleFloat
--E 15
--S 16 of 50
[exp log x]
--R
--R
--R   (16)  [0.69999999999999996]
--R                                                      Type: List(DoubleFloat)
--E 16
--S 17 of 50
[log exp x]
--R
--R
--R   (17)  [0.70000000000000007]
--R                                                      Type: List(DoubleFloat)
--E 17
--S 18 of 50
[sin asin x,  cos acos x,  tan atan x,  cot acot x]
--R
--R
--R   (18)
--R   [0.69999999999999996, 0.70000000000000007, 0.69999999999999996,
--R    0.69999999999999996]
--R                                                      Type: List(DoubleFloat)
--E 18
--S 19 of 50
[asin sin x,  acos cos x,  atan tan x,  acot cot x, acsc csc x,   asec sec x  ]
--R
--R
--R   (19)
--R   [0.69999999999999996, 0.69999999999999996, 0.69999999999999996,
--R    0.69999999999999996, 0.69999999999999996, 0.69999999999999996]
--R                                                      Type: List(DoubleFloat)
--E 19
--S 20 of 50
[sinh asinh x,             tanh atanh x,             csch acsch x,sech asech x]
--R
--R
--R   (20)
--R   [0.69999999999999996, 0.69999999999999996, 0.69999999999999984,
--R    0.69999999999999996]
--R                                                      Type: List(DoubleFloat)
--E 20
--S 21 of 50

[asinh sinh x,acosh cosh x,atanh tanh x,acoth coth x,acsch csch x,asech sech x]
--R
--R
--R   (21)
--R   [0.70000000000000007, 0.70000000000000018, 0.70000000000000029,
--R    0.70000000000000029, 0.70000000000000007, 0.70000000000000018]
--R                                                      Type: List(DoubleFloat)
--E 21
--should give errors:
--acsc  x
--asec  x
--acosh x
--acoth x
--S 22 of 50
x := 1.1::DoubleFloat
--R
--R
--R   (22)  1.1000000000000001
--R                                                            Type: DoubleFloat
--E 22
--S 23 of 50
[exp log x]
--R
--R
--R   (23)  [1.1000000000000001]
--R                                                      Type: List(DoubleFloat)
--E 23
--S 24 of 50
[log exp x]
--R
--R
--R   (24)  [1.1000000000000001]
--R                                                      Type: List(DoubleFloat)
--E 24
--S 25 of 50
[                          tan atan x,  cot acot x, csc acsc x,   sec asec x  ]
--R
--R
--R   (25)
--R   [1.1000000000000001,1.0999999999999999,1.1000000000000001,1.1000000000000001]
--R                                                      Type: List(DoubleFloat)
--E 25
--S 26 of 50
[asin sin x,  acos cos x,  atan tan x,  acot cot x, acsc csc x,   asec sec x  ]

--R
--R
--R   (26)
--R   [1.1000000000000003, 1.1000000000000001, 1.1000000000000001,
--R    1.1000000000000001, 1.0999999999999999, 1.1000000000000001]
--R                                                      Type: List(DoubleFloat)
--E 26
--S 27 of 50
[sinh asinh x,cosh acosh x,             coth acoth x,csch acsch x             ]
--R
--R
--R   (27)
--R   [1.1000000000000001,1.1000000000000001,1.1000000000000001,1.1000000000000001]
--R                                                      Type: List(DoubleFloat)
--E 27
--S 28 of 50
[asinh sinh x,acosh cosh x,atanh tanh x,acoth coth x,acsch csch x,asech sech x]
--R
--R
--R   (28)
--R   [1.1000000000000001, 1.0999999999999999, 1.1000000000000001,
--R    1.1000000000000003, 1.1000000000000001, 1.0999999999999999]
--R                                                      Type: List(DoubleFloat)
--E 28
--should give errors:
--asin x
--acos x
--atanh x
--asech x
--S 29 of 50
qtest(a,b,n) ==
   m1 := if n = 1 or n = 4 then 0 else  1
   s1 := if n = 1 or n = 4 then 1 else -1
   s2 := if n = 1 or n = 2 then 1 else -1
   x := complex(s1*a, s2*b)
   [x- exp   log x, _
    x- sin   asin  x, x-    cos   acos  x, x- tan   atan  x , _
    x- csc   acsc  x, x-    sec   asec  x, x- cot   acot  x , _
    x- sinh  asinh x, x-    cosh  acosh x, x- tanh  atanh x , _
    x- csch  acsch x, x-    sech  asech x, x- coth  acoth x , _
    x- log   exp   x, _
    x- asin  sin   x, x- s1*acos  cos   x, x- atan  tan  x , _
    x- acsc  csc   x, x- s1*asec  sec   x, x- acot  cot  x + m1*%pi, _
    x- asinh sinh  x, x- s1*acosh cosh  x, x- atanh tanh x , _
    x- acsch csch  x, x- s1*asech sech  x, x- acoth coth x ]
--R

--R                                                                   Type: Void
--E 29
--S 30 of 50
qerr(l) ==
    reduce(+, [norm v for v in l])/#l
--R
--R                                                                   Type: Void
--E 30
--S 31 of 50
sa := 0.7::DoubleFloat
--R
--R
--R   (31)  0.69999999999999996
--R                                                            Type: DoubleFloat
--E 31
--S 32 of 50
sb := 1.1::DoubleFloat
--R
--R
--R   (32)  1.1000000000000001
--R                                                            Type: DoubleFloat
--E 32
--S 33 of 50
ba := 0.7::Float
--R
--R
--R   (33)  0.7
--R                                                                  Type: Float
--E 33
--S 34 of 50
bb := 1.1::Float
--R
--R
--R   (34)  1.1
--R                                                                  Type: Float
--E 34
--S 35 of 50
qtest(sa, sb, 1)
--R
--R   Compiling function qtest with type (DoubleFloat,DoubleFloat,
--R      PositiveInteger) -> List(Complex(DoubleFloat))
--R
--R   (35)
--R   [1.1102230246251565E-16, 2.2204460492503131E-16 - 4.4408920985006262E-16 %i,

--R    - 2.2204460492503131E-16,
--R    - 4.4408920985006262E-16 - 2.2204460492503131E-16 %i,
--R    4.4408920985006262E-16, - 1.1102230246251565E-16,
--R    - 2.2204460492503131E-16 - 2.2204460492503131E-16 %i,
--R    1.1102230246251565E-16,
--R    - 2.2204460492503131E-16 - 2.2204460492503131E-16 %i,
--R    2.2204460492503131E-16 + 2.2204460492503131E-16 %i,
--R    1.1102230246251565E-16 - 2.2204460492503131E-16 %i, 0.,
--R    - 6.6613381477509392E-16 %i, - 1.1102230246251565E-16,
--R    - 4.4408920985006262E-16 - 4.4408920985006262E-16 %i,
--R    3.3306690738754696E-16 - 2.2204460492503131E-16 %i,
--R    - 3.3306690738754696E-16,
--R    - 4.4408920985006262E-16 - 4.4408920985006262E-16 %i,
--R    3.3306690738754696E-16 - 2.2204460492503131E-16 %i,
--R    - 5.5511151231257827E-16, - 2.2204460492503131E-16,
--R    - 1.1102230246251565E-16, 1.1102230246251565E-16, 0.,
--R    - 1.1102230246251565E-16, - 1.1102230246251565E-16]
--R                                             Type: List(Complex(DoubleFloat))
--E 35
--S 36 of 50
qerr %
--R
--R   Compiling function qerr with type List(Complex(DoubleFloat)) ->
--R      DoubleFloat
--R
--R   (36)  1.2373359150401687E-31
--R                                                            Type: DoubleFloat
--E 36
--S 37 of 50
qtest(ba, bb, 1)
--R
--R   Compiling function qtest with type (Float,Float,PositiveInteger) ->
--R      List(Complex(Float))
--R
--R   (37)
--R   [- 0.3 E -20, 0.7 E -20, 0.7 E -20, 0.7 E -20 + 0.7 E -20 %i,
--R    - 0.7 E -20 %i, - 0.1 E -19, 0.3 E -20 - 0.7 E -20 %i,
--R    - 0.3 E -20 - 0.7 E -20 %i, 0.0, - 0.3 E -20, 0.1 E -19 %i,
--R    0.3 E -19 + 0.2 E -19 %i, - 0.3 E -20, 0.0, 0.2 E -19, - 0.3 E -20,
--R    - 0.7 E -20 - 0.1 E -19 %i, 0.2 E -19, - 0.2 E -19 - 0.7 E -20 %i,
--R    0.1 E -19 - 0.1 E -19 %i, - 0.7 E -20, - 0.7 E -20 - 0.7 E -20 %i, 0.0,
--R    - 0.7 E -20, 0.0, - 0.3 E -20]
--R                                                   Type: List(Complex(Float))
--E 37
--S 38 of 50
qerr %
--R

--R   Compiling function qerr with type List(Complex(Float)) -> Float
--R
--R   (38)  0.1355456601 9472741322 E -39
--R                                                                  Type: Float
--E 38
--S 39 of 50
qtest(sa, sb, 2)
--R
--R
--R   (39)
--R   [- 1.1102230246251565E-16,
--R    - 2.2204460492503131E-16 - 4.4408920985006262E-16 %i,
--R    - 3.3306690738754696E-16,
--R    4.4408920985006262E-16 - 2.2204460492503131E-16 %i,
--R    - 4.4408920985006262E-16,
--R    1.1102230246251565E-16 - 2.2204460492503131E-16 %i,
--R    3.3306690738754696E-16 - 2.2204460492503131E-16 %i,
--R    - 1.1102230246251565E-16,
--R    4.4408920985006262E-16 - 2.2204460492503131E-16 %i,
--R    - 2.2204460492503131E-16 + 2.2204460492503131E-16 %i,
--R    2.2204460492503131E-16 - 2.2204460492503131E-16 %i,
--R    - 1.1102230246251565E-16 - 2.2204460492503131E-16 %i,
--R    2.2204460492503131E-16 - 2.2204460492503131E-16 %i, 0.,
--R    4.4408920985006262E-16 - 4.4408920985006262E-16 %i, 0.,
--R    3.3306690738754696E-16, 4.4408920985006262E-16 - 4.4408920985006262E-16 %i,
--R    0., 8.8817841970012523E-16, 2.2204460492503131E-16, 1.1102230246251565E-16,
--R    3.3306690738754696E-16, - 1.1102230246251565E-16, 1.1102230246251565E-16,
--R    2.2204460492503131E-16 - 2.2204460492503131E-16 %i]
--R                                             Type: List(Complex(DoubleFloat))
--E 39
--S 40 of 50
qerr %
--R
--R
--R   (40)  1.3985214365396544E-31
--R                                                            Type: DoubleFloat
--E 40
--S 41 of 50
qtest(ba, bb, 2)
--R
--R
--R   (41)
--R   [0.3 E -20, - 0.7 E -20, - 0.3 E -20, - 0.7 E -20 + 0.7 E -20 %i,
--R    - 0.7 E -20 %i, - 0.3 E -20, - 0.7 E -20 %i, 0.1 E -19 + 0.1 E -19 %i,
--R    - 0.3 E -20, 0.0, 0.2 E -19 - 0.1 E -19 %i, - 0.2 E -19 + 0.7 E -20 %i,
--R    - 0.7 E -20, 0.0, - 0.2 E -19, 0.3 E -20, 0.7 E -20 - 0.1 E -19 %i,
--R    - 0.2 E -19, 0.2 E -19 - 0.7 E -20 %i, - 0.1 E -19 - 0.1 E -19 %i,

--R    0.3 E -20 - 0.7 E -20 %i, 0.7 E -20 - 0.7 E -20 %i, 0.0,
--R    0.3 E -20 - 0.7 E -20 %i, 0.7 E -20 - 0.7 E -20 %i, - 0.3 E -20]
--R                                                   Type: List(Complex(Float))
--E 41
--S 42 of 50
qerr %
--R
--R
--R   (42)  0.1351041433 8627553239 E -39
--R                                                                  Type: Float
--E 42
--S 43 of 50
qtest(sa, sb, 3)
--R
--R
--R   (43)
--R   [- 1.1102230246251565E-16, 0.,
--R    - 2.2204460492503131E-16 + 4.4408920985006262E-16 %i,
--R    - 2.2204460492503131E-16, 1.1102230246251565E-16, - 4.4408920985006262E-16,
--R    - 1.1102230246251565E-16, - 1.1102230246251565E-16,
--R    4.4408920985006262E-16 + 2.2204460492503131E-16 %i,
--R    - 2.2204460492503131E-16 - 2.2204460492503131E-16 %i,
--R    2.2204460492503131E-16 + 2.2204460492503131E-16 %i,
--R    - 1.1102230246251565E-16 + 2.2204460492503131E-16 %i,
--R    2.2204460492503131E-16 + 2.2204460492503131E-16 %i, 0., 0.,
--R    - 3.3306690738754696E-16 + 2.2204460492503131E-16 %i,
--R    2.2204460492503131E-16 %i, 0.,
--R    - 3.3306690738754696E-16 + 2.2204460492503131E-16 %i,
--R    8.8817841970012523E-16, 2.2204460492503131E-16, 1.1102230246251565E-16,
--R    3.3306690738754696E-16, - 1.1102230246251565E-16, 1.1102230246251565E-16,
--R    2.2204460492503131E-16 + 2.2204460492503131E-16 %i]
--R                                             Type: List(Complex(DoubleFloat))
--E 43
--S 44 of 50
qerr %
--R
--R
--R   (44)  1.0002983834232781E-31
--R                                                            Type: DoubleFloat
--E 44
--S 45 of 50
qtest(ba, bb, 3)
--R
--R
--R   (45)
--R   [0.3 E -20, - 0.3 E -20, - 0.7 E -20, - 0.3 E -20 - 0.7 E -20 %i,

--R    - 0.3 E -20, 0.7 E -20 %i, - 0.3 E -20 + 0.1 E -19 %i,
--R    0.1 E -19 - 0.1 E -19 %i, - 0.3 E -20, 0.0, 0.2 E -19 + 0.1 E -19 %i,
--R    - 0.2 E -19 - 0.7 E -20 %i, - 0.7 E -20, 0.0, - 0.2 E -19, 0.3 E -20,
--R    - 0.3 E -20 + 0.1 E -19 %i, - 0.1 E -19 + 0.7 E -20 %i,
--R    0.3 E -20 + 0.7 E -20 %i, 0.1 E -19 %i, 0.3 E -20 + 0.7 E -20 %i,
--R    0.7 E -20 + 0.7 E -20 %i, 0.0, 0.3 E -20 + 0.7 E -20 %i,
--R    0.7 E -20 + 0.7 E -20 %i, - 0.3 E -20]
--R                                                   Type: List(Complex(Float))
--E 45
--S 46 of 50
qerr %
--R
--R
--R   (46)  0.1258322904 0878603507 E -39
--R                                                                  Type: Float
--E 46
--S 47 of 50
qtest(sa, sb, 4)
--R
--R
--R   (47)
--R   [1.1102230246251565E-16, 0.,
--R    3.3306690738754696E-16 + 4.4408920985006262E-16 %i, 2.2204460492503131E-16,
--R    - 1.1102230246251565E-16,
--R    2.2204460492503131E-16 - 2.2204460492503131E-16 %i,
--R    2.2204460492503131E-16 + 2.2204460492503131E-16 %i, 1.1102230246251565E-16,
--R    - 2.2204460492503131E-16 + 2.2204460492503131E-16 %i,
--R    2.2204460492503131E-16 - 2.2204460492503131E-16 %i,
--R    1.1102230246251565E-16 + 2.2204460492503131E-16 %i, 0.,
--R    6.6613381477509392E-16 %i, - 1.1102230246251565E-16, 0., 0.,
--R    2.2204460492503131E-16 %i, 0., 0., - 6.6613381477509392E-16,
--R    - 2.2204460492503131E-16, - 1.1102230246251565E-16, 1.1102230246251565E-16,
--R    0., - 1.1102230246251565E-16, - 1.1102230246251565E-16]
--R                                             Type: List(Complex(DoubleFloat))
--E 47
--S 48 of 50
qerr %
--R
--R
--R   (48)  7.3007559738002298E-32
--R                                                            Type: DoubleFloat
--E 48
--S 49 of 50
qtest(ba, bb, 4)
--R
--R

--R   (49)
--R   [- 0.3 E -20, 0.3 E -20, 0.7 E -20, 0.3 E -20 - 0.7 E -20 %i, 0.3 E -20,
--R    - 0.3 E -20, 0.0, - 0.3 E -20 + 0.7 E -20 %i, 0.0, - 0.3 E -20,
--R    - 0.1 E -19 %i, 0.3 E -19 - 0.2 E -19 %i, - 0.3 E -20, 0.0, 0.2 E -19,
--R    - 0.3 E -20, 0.3 E -20 + 0.1 E -19 %i, 0.1 E -19 + 0.7 E -20 %i,
--R    - 0.3 E -20 + 0.7 E -20 %i, - 0.3 E -20 + 0.1 E -19 %i, - 0.7 E -20,
--R    - 0.7 E -20 + 0.7 E -20 %i, 0.0, - 0.7 E -20, 0.0, - 0.3 E -20]
--R                                                   Type: List(Complex(Float))
--E 49
--S 50 of 50
qerr %
--R
--R
--R   (50)  0.1125867861 5522961033 E -39
--R                                                                  Type: Float
--E 50
)spool
)lisp (bye)

———-

References^{[1] nothing}

15