Metropoli BBS
VIEWER: sam286.txt MODE: TEXT (ASCII)
apl>" <-APL2-------------------- sam286.txt ---------------------------->


apl>" Following is main test of trig functions for complex numbers.


apl>" Different methods are tried to ensure they come up with the same answers.


apl>Lfx 'z#sin x'   'z#1 O x'

sin

apl>Lfx 'z#cos x'   'z#2 O x'

cos

apl>Lfx 'z#tan x'   'z#3 O x'

tan

apl>Lfx 'z#sinh x'  'z#5 O x'

sinh

apl>Lfx 'z#cosh x'  'z#6 O x'

cosh

apl>Lfx 'z#tanh x'  'z#7 O x'

tanh

apl>Lfx 'z#asin x'  'z#-1 O x'

asin

apl>Lfx 'z#acos x'  'z#-2 O x'

acos

apl>Lfx 'z#atan x'  'z#-3 O x'

atan

apl>Lfx 'z#asinh x' 'z#-5 O x'

asinh

apl>Lfx 'z#acosh x' 'z#-6 O x'

acosh

apl>Lfx 'z#atanh x' 'z#-7 O x'

atanh

apl>Lfx 'getxy' 'x#9 O r' 'y#11 O r'

getxy

apl>i#0j1 " square root of -1


apl>Lfx 'z#sina r;x;y' 'getxy' 'z#((sin x)Xcosh y)+iX(cos x)Xsinh y'

sina

apl>Lfx 'z#sinb r;s' 'z#(s_1%s#*iXr)%2Xi'

sinb

apl>Lfx 'z#sinc r;s' 'z#_i X sinh iXr'

sinc

apl>Lfx 'z#cosa r;x;y' 'getxy' 'z#((cos x)Xcosh y)_iX(sin x)Xsinh y'

cosa

apl>Lfx 'z#cosb r;s' 'z#(s+1%s#*iXr)%2'

cosb

apl>Lfx 'z#cosc r;s' 'z#cosh iXr'

cosc

apl>src#'z#tana r;x;y' 'getxy'


apl>Lfx src,`Z'z#((sin x)+iX(cos x)X(tanh y))%(cos x)_iX(sin x)Xtanh y'

tana

apl>Lfx 'z#tanb r' 'z#(sin r)%(cos r)'

tanb

apl>Lfx 'z#tanc r' 'z#_iXtanh iXr'

tanc

apl>src#'z#sinha r;x;y;s' 'getxy' 'y#yXs#Xy'


apl>Lfx src,`Z'z#((sinh x)Xcos y)+sXiX(cosh x)Xsin y'

sinha

apl>Lfx 'z#sinhb r' 'z#_iXsin iXr'

sinhb

apl>Lfx 'z#sinhc r;x' 'x#r%2' 'z#2X(sinh x)Xcosh x'

sinhc

apl>src#'z#cosha r;x;y;s' 'getxy' 'y#yXs#Xy'


apl>Lfx src,`Z'z#((cosh x)Xcos y)+sXiX(sinh x)Xsin y'

cosha

apl>Lfx 'z#coshb r' 'z#cos iXr'

coshb

apl>Lfx 'z#coshc r;x' 'x#r%2' 'z#((cosh x)*2)+(sinh x)*2'

coshc

apl>src#'z#tanha r;x;y;s' 'getxy' 'y#iXyXs#Xy'


apl>Lfx src,`Z'z#((tanh x)+sXtanh y)%1+sX(tanh x)Xtanh y'

tanha

apl>Lfx 'z#tanhb r;s;t' 'z#(t_s)%t+s#1%t#*r'

tanhb

apl>Lfx 'z#tanhc r' 'z#(sinh r)%cosh r'

tanhc

apl>Lfx 'z#tanhd r' 'z#_iXtan iXr'

tanhd

apl>Lfx 'z#asina r' 'z#_iXasinh iXr'

asina

apl>Lfx 'z#asinb r' 'z#_iX@(iXr)+(1_r*2)*.5'

asinb

apl>Lfx 'z#acosa r' 'z#_(.5XO1)_asin r'

acosa

apl>Lfx 'z#acosb r' 'z#_iX@r_iX(1_r*2)*.5'

acosb

apl>Lfx 'z#atana r' 'z#_iXatanh iXr'

atana

apl>Lfx 'z#atanb r' 'z#_iX@(1+iXr)%(1+r*2)*.5'

atanb

apl>Lfx 'z#atanc r' 'z#(iX@(1_iXr)%(1+iXr))%2'

atanc

apl>Lfx 'z#asinha r' 'z#_iXasin iXr'

asinha

apl>Lfx 'z#asinhb r' 'z#@r+(1+r*2)*.5'

asinhb

apl>Lfx 'z#acosha r' 'z#@(r+-4Or)'

acosha

apl>Lfx 'z#acoshb r' 'z#@r+(-1+r*2)*.5'

acoshb

apl>Lfx 'z#atanha r' 'z#_iXatan iXr'

atanha

apl>Lfx 'z#atanhb r' 'z#(@(1+r)%(1_r))%2'

atanhb

apl>Lex 'demo'

1

apl>Gname demo r;x;y;z


[1]       y#C`1x#((1Yname),`1' ',`Z`12`Xname),`1`Z' r'


[2]       $goodXI&/`Xy=1Yy


[3]       'oops, methods don''t agree on the answer to "',name,' ',(,Fr),'"'


[4]       y#F`1y


[5]       z#((-1Y`1R`1x)S-1Y`1R`1y)R`1'-'


[6]       ' ',[1]x,[1]z,[.5]y


[7]       $0


[8]       good: 'all methods agree on the answer to "',(1`Xname),' ',(,Fr),'" = ',F1Yy


[9]       G


apl>" <----------------------------------------------------------------->


apl>Lpp#5


apl>'sin'  'abc'  demo 3j4

all methods agree on the answer to "sin 3j4" =  3.854j-27.02 

apl>'cos'  'abc'  demo 3j4

all methods agree on the answer to "cos 3j4" =  -27.03j-3.851 

apl>'tan'  'abc'  demo 3j4

all methods agree on the answer to "tan 3j4" =  -0.00019j.999  

apl>'sinh' 'abc'  demo 3j4

all methods agree on the answer to "sinh 3j4" =  -6.548j-7.619 

apl>'cosh' 'abc'  demo 3j4

all methods agree on the answer to "cosh 3j4" =  -6.58j-7.582 

apl>'tanh' 'abcd' demo 3j4

all methods agree on the answer to "tanh 3j4" =  1j.0049  

apl>'asin' 'ab'   demo 1O.2j1

all methods agree on the answer to "asin .30656j1.152 " =  .2j1  

apl>'acos' 'ab'   demo 2O-1j1.2

all methods agree on the answer to "acos .978j1.27 " =  -1j1.2 

apl>'atan' 'abc'  demo 3O1.1j.8

all methods agree on the answer to "atan .40649j1.194 " =  1.1j.8  

apl>'asinh' 'ab'  demo 5O.2j1.2

all methods agree on the answer to "asinh .07296j.95  " =  .2j1.2  

apl>'acosh' 'ab'  demo 6O.5j1

all methods agree on the answer to "acosh .609j.43849  " =  .5j1  

apl>'atanh' 'ab'  demo 7O.2j1.1

all methods agree on the answer to "atanh .834j1.641 " =  .2j1.1  

apl>)off

[ RETURN TO DIRECTORY ]