Metropoli BBS
VIEWER: sam286.txt MODE: TEXT (ASCII)
" <-APL2-------------------- sam286.txt ---------------------------->
" Following is main test of trig functions for complex numbers.
" Different methods are tried to ensure they come up with the same answers.
Lfx 'z#sin x'   'z#1 O x'
Lfx 'z#cos x'   'z#2 O x'
Lfx 'z#tan x'   'z#3 O x'
Lfx 'z#sinh x'  'z#5 O x'
Lfx 'z#cosh x'  'z#6 O x'
Lfx 'z#tanh x'  'z#7 O x'
Lfx 'z#asin x'  'z#-1 O x'
Lfx 'z#acos x'  'z#-2 O x'
Lfx 'z#atan x'  'z#-3 O x'
Lfx 'z#asinh x' 'z#-5 O x'
Lfx 'z#acosh x' 'z#-6 O x'
Lfx 'z#atanh x' 'z#-7 O x'
Lfx 'getxy' 'x#9 O r' 'y#11 O r'
i#0j1 " square root of -1
Lfx 'z#sina r;x;y' 'getxy' 'z#((sin x)Xcosh y)+iX(cos x)Xsinh y'
Lfx 'z#sinb r;s' 'z#(s_1%s#*iXr)%2Xi'
Lfx 'z#sinc r;s' 'z#_i X sinh iXr'
Lfx 'z#cosa r;x;y' 'getxy' 'z#((cos x)Xcosh y)_iX(sin x)Xsinh y'
Lfx 'z#cosb r;s' 'z#(s+1%s#*iXr)%2'
Lfx 'z#cosc r;s' 'z#cosh iXr'
src#'z#tana r;x;y' 'getxy'
Lfx src,`Z'z#((sin x)+iX(cos x)X(tanh y))%(cos x)_iX(sin x)Xtanh y'
Lfx 'z#tanb r' 'z#(sin r)%(cos r)'
Lfx 'z#tanc r' 'z#_iXtanh iXr'
src#'z#sinha r;x;y;s' 'getxy' 'y#yXs#Xy'
Lfx src,`Z'z#((sinh x)Xcos y)+sXiX(cosh x)Xsin y'
Lfx 'z#sinhb r' 'z#_iXsin iXr'
Lfx 'z#sinhc r;x' 'x#r%2' 'z#2X(sinh x)Xcosh x'
src#'z#cosha r;x;y;s' 'getxy' 'y#yXs#Xy'
Lfx src,`Z'z#((cosh x)Xcos y)+sXiX(sinh x)Xsin y'
Lfx 'z#coshb r' 'z#cos iXr'
Lfx 'z#coshc r;x' 'x#r%2' 'z#((cosh x)*2)+(sinh x)*2'
src#'z#tanha r;x;y;s' 'getxy' 'y#iXyXs#Xy'
Lfx src,`Z'z#((tanh x)+sXtanh y)%1+sX(tanh x)Xtanh y'
Lfx 'z#tanhb r;s;t' 'z#(t_s)%t+s#1%t#*r'
Lfx 'z#tanhc r' 'z#(sinh r)%cosh r'
Lfx 'z#tanhd r' 'z#_iXtan iXr'
Lfx 'z#asina r' 'z#_iXasinh iXr'
Lfx 'z#asinb r' 'z#_iX@(iXr)+(1_r*2)*.5'
Lfx 'z#acosa r' 'z#_(.5XO1)_asin r'
Lfx 'z#acosb r' 'z#_iX@r_iX(1_r*2)*.5'
Lfx 'z#atana r' 'z#_iXatanh iXr'
Lfx 'z#atanb r' 'z#_iX@(1+iXr)%(1+r*2)*.5'
Lfx 'z#atanc r' 'z#(iX@(1_iXr)%(1+iXr))%2'
Lfx 'z#asinha r' 'z#_iXasin iXr'
Lfx 'z#asinhb r' 'z#@r+(1+r*2)*.5'
Lfx 'z#acosha r' 'z#@(r+-4Or)'
Lfx 'z#acoshb r' 'z#@r+(-1+r*2)*.5'
Lfx 'z#atanha r' 'z#_iXatan iXr'
Lfx 'z#atanhb r' 'z#(@(1+r)%(1_r))%2'
Lex 'demo'
Gname demo r;x;y;z
y#C`1x#((1Yname),`1' ',`Z`12`Xname),`1`Z' r'
$goodXI&/`Xy=1Yy
'oops, methods don''t agree on the answer to "',name,' ',(,Fr),'"'
y#F`1y
z#((-1Y`1R`1x)S-1Y`1R`1y)R`1'-'
' ',[1]x,[1]z,[.5]y
$0
good: 'all methods agree on the answer to "',(1`Xname),' ',(,Fr),'" = ',F1Yy
G
" <----------------------------------------------------------------->
Lpp#5
'sin'  'abc'  demo 3j4
'cos'  'abc'  demo 3j4
'tan'  'abc'  demo 3j4
'sinh' 'abc'  demo 3j4
'cosh' 'abc'  demo 3j4
'tanh' 'abcd' demo 3j4
'asin' 'ab'   demo 1O.2j1
'acos' 'ab'   demo 2O-1j1.2
'atan' 'abc'  demo 3O1.1j.8
'asinh' 'ab'  demo 5O.2j1.2
'acosh' 'ab'  demo 6O.5j1
'atanh' 'ab'  demo 7O.2j1.1
)off
[ RETURN TO DIRECTORY ]