1*0Sstevel@tonic-gate#!./perl 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gate# $RCSfile: complex.t,v $ 4*0Sstevel@tonic-gate# 5*0Sstevel@tonic-gate# Regression tests for the Math::Complex pacakge 6*0Sstevel@tonic-gate# -- Raphael Manfredi since Sep 1996 7*0Sstevel@tonic-gate# -- Jarkko Hietaniemi since Mar 1997 8*0Sstevel@tonic-gate# -- Daniel S. Lewart since Sep 1997 9*0Sstevel@tonic-gate 10*0Sstevel@tonic-gateBEGIN { 11*0Sstevel@tonic-gate chdir 't' if -d 't'; 12*0Sstevel@tonic-gate @INC = '../lib'; 13*0Sstevel@tonic-gate} 14*0Sstevel@tonic-gate 15*0Sstevel@tonic-gateuse Math::Complex; 16*0Sstevel@tonic-gate 17*0Sstevel@tonic-gateuse vars qw($VERSION); 18*0Sstevel@tonic-gate 19*0Sstevel@tonic-gate$VERSION = 1.92; 20*0Sstevel@tonic-gate 21*0Sstevel@tonic-gatemy ($args, $op, $target, $test, $test_set, $try, $val, $zvalue, @set, @val); 22*0Sstevel@tonic-gate 23*0Sstevel@tonic-gate$test = 0; 24*0Sstevel@tonic-gate$| = 1; 25*0Sstevel@tonic-gatemy @script = ( 26*0Sstevel@tonic-gate 'my ($res, $s0,$s1,$s2,$s3,$s4,$s5,$s6,$s7,$s8,$s9,$s10, $z0,$z1,$z2);' . 27*0Sstevel@tonic-gate "\n\n" 28*0Sstevel@tonic-gate); 29*0Sstevel@tonic-gatemy $eps = 1e-13; 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gateif ($^O eq 'unicos') { # For some reason root() produces very inaccurate 32*0Sstevel@tonic-gate $eps = 1e-10; # results in Cray UNICOS, and occasionally also 33*0Sstevel@tonic-gate} # cos(), sin(), cosh(), sinh(). The division 34*0Sstevel@tonic-gate # of doubles is the current suspect. 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gatewhile (<DATA>) { 37*0Sstevel@tonic-gate s/^\s+//; 38*0Sstevel@tonic-gate next if $_ eq '' || /^\#/; 39*0Sstevel@tonic-gate chomp; 40*0Sstevel@tonic-gate $test_set = 0; # Assume not a test over a set of values 41*0Sstevel@tonic-gate if (/^&(.+)/) { 42*0Sstevel@tonic-gate $op = $1; 43*0Sstevel@tonic-gate next; 44*0Sstevel@tonic-gate } 45*0Sstevel@tonic-gate elsif (/^\{(.+)\}/) { 46*0Sstevel@tonic-gate set($1, \@set, \@val); 47*0Sstevel@tonic-gate next; 48*0Sstevel@tonic-gate } 49*0Sstevel@tonic-gate elsif (s/^\|//) { 50*0Sstevel@tonic-gate $test_set = 1; # Requests we loop over the set... 51*0Sstevel@tonic-gate } 52*0Sstevel@tonic-gate my @args = split(/:/); 53*0Sstevel@tonic-gate if ($test_set == 1) { 54*0Sstevel@tonic-gate my $i; 55*0Sstevel@tonic-gate for ($i = 0; $i < @set; $i++) { 56*0Sstevel@tonic-gate # complex number 57*0Sstevel@tonic-gate $target = $set[$i]; 58*0Sstevel@tonic-gate # textual value as found in set definition 59*0Sstevel@tonic-gate $zvalue = $val[$i]; 60*0Sstevel@tonic-gate test($zvalue, $target, @args); 61*0Sstevel@tonic-gate } 62*0Sstevel@tonic-gate } else { 63*0Sstevel@tonic-gate test($op, undef, @args); 64*0Sstevel@tonic-gate } 65*0Sstevel@tonic-gate} 66*0Sstevel@tonic-gate 67*0Sstevel@tonic-gate# 68*0Sstevel@tonic-gate 69*0Sstevel@tonic-gatesub test_mutators { 70*0Sstevel@tonic-gate my $op; 71*0Sstevel@tonic-gate 72*0Sstevel@tonic-gate $test++; 73*0Sstevel@tonic-gatepush(@script, <<'EOT'); 74*0Sstevel@tonic-gate{ 75*0Sstevel@tonic-gate my $z = cplx( 1, 1); 76*0Sstevel@tonic-gate $z->Re(2); 77*0Sstevel@tonic-gate $z->Im(3); 78*0Sstevel@tonic-gate print "# $test Re(z) = ",$z->Re(), " Im(z) = ", $z->Im(), " z = $z\n"; 79*0Sstevel@tonic-gate print 'not ' unless Re($z) == 2 and Im($z) == 3; 80*0Sstevel@tonic-gateEOT 81*0Sstevel@tonic-gate push(@script, qq(print "ok $test\\n"}\n)); 82*0Sstevel@tonic-gate 83*0Sstevel@tonic-gate $test++; 84*0Sstevel@tonic-gatepush(@script, <<'EOT'); 85*0Sstevel@tonic-gate{ 86*0Sstevel@tonic-gate my $z = cplx( 1, 1); 87*0Sstevel@tonic-gate $z->abs(3 * sqrt(2)); 88*0Sstevel@tonic-gate print "# $test Re(z) = ",$z->Re(), " Im(z) = ", $z->Im(), " z = $z\n"; 89*0Sstevel@tonic-gate print 'not ' unless (abs($z) - 3 * sqrt(2)) < $eps and 90*0Sstevel@tonic-gate (arg($z) - pi / 4 ) < $eps and 91*0Sstevel@tonic-gate (Re($z) - 3 ) < $eps and 92*0Sstevel@tonic-gate (Im($z) - 3 ) < $eps; 93*0Sstevel@tonic-gateEOT 94*0Sstevel@tonic-gate push(@script, qq(print "ok $test\\n"}\n)); 95*0Sstevel@tonic-gate 96*0Sstevel@tonic-gate $test++; 97*0Sstevel@tonic-gatepush(@script, <<'EOT'); 98*0Sstevel@tonic-gate{ 99*0Sstevel@tonic-gate my $z = cplx( 1, 1); 100*0Sstevel@tonic-gate $z->arg(-3 / 4 * pi); 101*0Sstevel@tonic-gate print "# $test Re(z) = ",$z->Re(), " Im(z) = ", $z->Im(), " z = $z\n"; 102*0Sstevel@tonic-gate print 'not ' unless (arg($z) + 3 / 4 * pi) < $eps and 103*0Sstevel@tonic-gate (abs($z) - sqrt(2) ) < $eps and 104*0Sstevel@tonic-gate (Re($z) + 1 ) < $eps and 105*0Sstevel@tonic-gate (Im($z) + 1 ) < $eps; 106*0Sstevel@tonic-gateEOT 107*0Sstevel@tonic-gate push(@script, qq(print "ok $test\\n"}\n)); 108*0Sstevel@tonic-gate} 109*0Sstevel@tonic-gate 110*0Sstevel@tonic-gatetest_mutators(); 111*0Sstevel@tonic-gate 112*0Sstevel@tonic-gatemy $constants = ' 113*0Sstevel@tonic-gatemy $i = cplx(0, 1); 114*0Sstevel@tonic-gatemy $pi = cplx(pi, 0); 115*0Sstevel@tonic-gatemy $pii = cplx(0, pi); 116*0Sstevel@tonic-gatemy $pip2 = cplx(pi/2, 0); 117*0Sstevel@tonic-gatemy $zero = cplx(0, 0); 118*0Sstevel@tonic-gate'; 119*0Sstevel@tonic-gate 120*0Sstevel@tonic-gatepush(@script, $constants); 121*0Sstevel@tonic-gate 122*0Sstevel@tonic-gate 123*0Sstevel@tonic-gate# test the divbyzeros 124*0Sstevel@tonic-gate 125*0Sstevel@tonic-gatesub test_dbz { 126*0Sstevel@tonic-gate for my $op (@_) { 127*0Sstevel@tonic-gate $test++; 128*0Sstevel@tonic-gate push(@script, <<EOT); 129*0Sstevel@tonic-gate eval '$op'; 130*0Sstevel@tonic-gate (\$bad) = (\$@ =~ /(.+)/); 131*0Sstevel@tonic-gate print "# $test op = $op divbyzero? \$bad...\n"; 132*0Sstevel@tonic-gate print 'not ' unless (\$@ =~ /Division by zero/); 133*0Sstevel@tonic-gateEOT 134*0Sstevel@tonic-gate push(@script, qq(print "ok $test\\n";\n)); 135*0Sstevel@tonic-gate } 136*0Sstevel@tonic-gate} 137*0Sstevel@tonic-gate 138*0Sstevel@tonic-gate# test the logofzeros 139*0Sstevel@tonic-gate 140*0Sstevel@tonic-gatesub test_loz { 141*0Sstevel@tonic-gate for my $op (@_) { 142*0Sstevel@tonic-gate $test++; 143*0Sstevel@tonic-gate push(@script, <<EOT); 144*0Sstevel@tonic-gate eval '$op'; 145*0Sstevel@tonic-gate (\$bad) = (\$@ =~ /(.+)/); 146*0Sstevel@tonic-gate print "# $test op = $op logofzero? \$bad...\n"; 147*0Sstevel@tonic-gate print 'not ' unless (\$@ =~ /Logarithm of zero/); 148*0Sstevel@tonic-gateEOT 149*0Sstevel@tonic-gate push(@script, qq(print "ok $test\\n";\n)); 150*0Sstevel@tonic-gate } 151*0Sstevel@tonic-gate} 152*0Sstevel@tonic-gate 153*0Sstevel@tonic-gatetest_dbz( 154*0Sstevel@tonic-gate 'i/0', 155*0Sstevel@tonic-gate 'acot(0)', 156*0Sstevel@tonic-gate 'acot(+$i)', 157*0Sstevel@tonic-gate# 'acoth(-1)', # Log of zero. 158*0Sstevel@tonic-gate 'acoth(0)', 159*0Sstevel@tonic-gate 'acoth(+1)', 160*0Sstevel@tonic-gate 'acsc(0)', 161*0Sstevel@tonic-gate 'acsch(0)', 162*0Sstevel@tonic-gate 'asec(0)', 163*0Sstevel@tonic-gate 'asech(0)', 164*0Sstevel@tonic-gate 'atan($i)', 165*0Sstevel@tonic-gate# 'atanh(-1)', # Log of zero. 166*0Sstevel@tonic-gate 'atanh(+1)', 167*0Sstevel@tonic-gate 'cot(0)', 168*0Sstevel@tonic-gate 'coth(0)', 169*0Sstevel@tonic-gate 'csc(0)', 170*0Sstevel@tonic-gate 'csch(0)', 171*0Sstevel@tonic-gate ); 172*0Sstevel@tonic-gate 173*0Sstevel@tonic-gatetest_loz( 174*0Sstevel@tonic-gate 'log($zero)', 175*0Sstevel@tonic-gate 'atan(-$i)', 176*0Sstevel@tonic-gate 'acot(-$i)', 177*0Sstevel@tonic-gate 'atanh(-1)', 178*0Sstevel@tonic-gate 'acoth(-1)', 179*0Sstevel@tonic-gate ); 180*0Sstevel@tonic-gate 181*0Sstevel@tonic-gate# test the bad roots 182*0Sstevel@tonic-gate 183*0Sstevel@tonic-gatesub test_broot { 184*0Sstevel@tonic-gate for my $op (@_) { 185*0Sstevel@tonic-gate $test++; 186*0Sstevel@tonic-gate push(@script, <<EOT); 187*0Sstevel@tonic-gate eval 'root(2, $op)'; 188*0Sstevel@tonic-gate (\$bad) = (\$@ =~ /(.+)/); 189*0Sstevel@tonic-gate print "# $test op = $op badroot? \$bad...\n"; 190*0Sstevel@tonic-gate print 'not ' unless (\$@ =~ /root rank must be/); 191*0Sstevel@tonic-gateEOT 192*0Sstevel@tonic-gate push(@script, qq(print "ok $test\\n";\n)); 193*0Sstevel@tonic-gate } 194*0Sstevel@tonic-gate} 195*0Sstevel@tonic-gate 196*0Sstevel@tonic-gatetest_broot(qw(-3 -2.1 0 0.99)); 197*0Sstevel@tonic-gate 198*0Sstevel@tonic-gatesub test_display_format { 199*0Sstevel@tonic-gate $test++; 200*0Sstevel@tonic-gate push @script, <<EOS; 201*0Sstevel@tonic-gate print "# package display_format cartesian?\n"; 202*0Sstevel@tonic-gate print "not " unless Math::Complex->display_format eq 'cartesian'; 203*0Sstevel@tonic-gate print "ok $test\n"; 204*0Sstevel@tonic-gateEOS 205*0Sstevel@tonic-gate 206*0Sstevel@tonic-gate push @script, <<EOS; 207*0Sstevel@tonic-gate my \$j = (root(1,3))[1]; 208*0Sstevel@tonic-gate 209*0Sstevel@tonic-gate \$j->display_format('polar'); 210*0Sstevel@tonic-gateEOS 211*0Sstevel@tonic-gate 212*0Sstevel@tonic-gate $test++; 213*0Sstevel@tonic-gate push @script, <<EOS; 214*0Sstevel@tonic-gate print "# j display_format polar?\n"; 215*0Sstevel@tonic-gate print "not " unless \$j->display_format eq 'polar'; 216*0Sstevel@tonic-gate print "ok $test\n"; 217*0Sstevel@tonic-gateEOS 218*0Sstevel@tonic-gate 219*0Sstevel@tonic-gate $test++; 220*0Sstevel@tonic-gate push @script, <<EOS; 221*0Sstevel@tonic-gate print "# j = \$j\n"; 222*0Sstevel@tonic-gate print "not " unless "\$j" eq "[1,2pi/3]"; 223*0Sstevel@tonic-gate print "ok $test\n"; 224*0Sstevel@tonic-gate 225*0Sstevel@tonic-gate my %display_format; 226*0Sstevel@tonic-gate 227*0Sstevel@tonic-gate %display_format = \$j->display_format; 228*0Sstevel@tonic-gateEOS 229*0Sstevel@tonic-gate 230*0Sstevel@tonic-gate $test++; 231*0Sstevel@tonic-gate push @script, <<EOS; 232*0Sstevel@tonic-gate print "# display_format{style} polar?\n"; 233*0Sstevel@tonic-gate print "not " unless \$display_format{style} eq 'polar'; 234*0Sstevel@tonic-gate print "ok $test\n"; 235*0Sstevel@tonic-gateEOS 236*0Sstevel@tonic-gate 237*0Sstevel@tonic-gate $test++; 238*0Sstevel@tonic-gate push @script, <<EOS; 239*0Sstevel@tonic-gate print "# keys %display_format == 2?\n"; 240*0Sstevel@tonic-gate print "not " unless keys %display_format == 2; 241*0Sstevel@tonic-gate print "ok $test\n"; 242*0Sstevel@tonic-gate 243*0Sstevel@tonic-gate \$j->display_format('style' => 'cartesian', 'format' => '%.5f'); 244*0Sstevel@tonic-gateEOS 245*0Sstevel@tonic-gate 246*0Sstevel@tonic-gate $test++; 247*0Sstevel@tonic-gate push @script, <<EOS; 248*0Sstevel@tonic-gate print "# j = \$j\n"; 249*0Sstevel@tonic-gate print "not " unless "\$j" eq "-0.50000+0.86603i"; 250*0Sstevel@tonic-gate print "ok $test\n"; 251*0Sstevel@tonic-gate 252*0Sstevel@tonic-gate %display_format = \$j->display_format; 253*0Sstevel@tonic-gateEOS 254*0Sstevel@tonic-gate 255*0Sstevel@tonic-gate $test++; 256*0Sstevel@tonic-gate push @script, <<EOS; 257*0Sstevel@tonic-gate print "# display_format{format} %.5f?\n"; 258*0Sstevel@tonic-gate print "not " unless \$display_format{format} eq '%.5f'; 259*0Sstevel@tonic-gate print "ok $test\n"; 260*0Sstevel@tonic-gateEOS 261*0Sstevel@tonic-gate 262*0Sstevel@tonic-gate $test++; 263*0Sstevel@tonic-gate push @script, <<EOS; 264*0Sstevel@tonic-gate print "# keys %display_format == 3?\n"; 265*0Sstevel@tonic-gate print "not " unless keys %display_format == 3; 266*0Sstevel@tonic-gate print "ok $test\n"; 267*0Sstevel@tonic-gate 268*0Sstevel@tonic-gate \$j->display_format('format' => undef); 269*0Sstevel@tonic-gateEOS 270*0Sstevel@tonic-gate 271*0Sstevel@tonic-gate $test++; 272*0Sstevel@tonic-gate push @script, <<EOS; 273*0Sstevel@tonic-gate print "# j = \$j\n"; 274*0Sstevel@tonic-gate print "not " unless "\$j" =~ /^-0(?:\\.5(?:0000\\d+)?|\\.49999\\d+)\\+0.86602540\\d+i\$/; 275*0Sstevel@tonic-gate print "ok $test\n"; 276*0Sstevel@tonic-gate 277*0Sstevel@tonic-gate \$j->display_format('style' => 'polar', 'polar_pretty_print' => 0); 278*0Sstevel@tonic-gateEOS 279*0Sstevel@tonic-gate 280*0Sstevel@tonic-gate $test++; 281*0Sstevel@tonic-gate push @script, <<EOS; 282*0Sstevel@tonic-gate print "# j = \$j\n"; 283*0Sstevel@tonic-gate print "not " unless "\$j" =~ /^\\[1,2\\.09439510\\d+\\]\$/; 284*0Sstevel@tonic-gate print "ok $test\n"; 285*0Sstevel@tonic-gate 286*0Sstevel@tonic-gate \$j->display_format('style' => 'cartesian', 'format' => '(%.5g)'); 287*0Sstevel@tonic-gateEOS 288*0Sstevel@tonic-gate 289*0Sstevel@tonic-gate $test++; 290*0Sstevel@tonic-gate push @script, <<EOS; 291*0Sstevel@tonic-gate print "# j = \$j\n"; 292*0Sstevel@tonic-gate print "not " unless "\$j" eq "(-0.5)+(0.86603)i"; 293*0Sstevel@tonic-gate print "ok $test\n"; 294*0Sstevel@tonic-gateEOS 295*0Sstevel@tonic-gate 296*0Sstevel@tonic-gate $test++; 297*0Sstevel@tonic-gate push @script, <<EOS; 298*0Sstevel@tonic-gate print "# j display_format cartesian?\n"; 299*0Sstevel@tonic-gate print "not " unless \$j->display_format eq 'cartesian'; 300*0Sstevel@tonic-gate print "ok $test\n"; 301*0Sstevel@tonic-gateEOS 302*0Sstevel@tonic-gate} 303*0Sstevel@tonic-gate 304*0Sstevel@tonic-gatetest_display_format(); 305*0Sstevel@tonic-gate 306*0Sstevel@tonic-gatesub test_remake { 307*0Sstevel@tonic-gate $test++; 308*0Sstevel@tonic-gate push @script, <<EOS; 309*0Sstevel@tonic-gate print "# remake 2+3i\n"; 310*0Sstevel@tonic-gate my \$z = cplx('2+3i'); 311*0Sstevel@tonic-gate print "not " unless \$z == Math::Complex->make(2,3); 312*0Sstevel@tonic-gate print "ok $test\n"; 313*0Sstevel@tonic-gateEOS 314*0Sstevel@tonic-gate 315*0Sstevel@tonic-gate $test++; 316*0Sstevel@tonic-gate push @script, <<EOS; 317*0Sstevel@tonic-gate print "# remake 3i\n"; 318*0Sstevel@tonic-gate my \$z = Math::Complex->make('3i'); 319*0Sstevel@tonic-gate print "not " unless \$z == cplx(0,3); 320*0Sstevel@tonic-gate print "ok $test\n"; 321*0Sstevel@tonic-gateEOS 322*0Sstevel@tonic-gate 323*0Sstevel@tonic-gate $test++; 324*0Sstevel@tonic-gate push @script, <<EOS; 325*0Sstevel@tonic-gate print "# remake [2,3]\n"; 326*0Sstevel@tonic-gate my \$z = cplxe('[2,3]'); 327*0Sstevel@tonic-gate print "not " unless \$z == Math::Complex->emake(2,3); 328*0Sstevel@tonic-gate print "ok $test\n"; 329*0Sstevel@tonic-gateEOS 330*0Sstevel@tonic-gate 331*0Sstevel@tonic-gate $test++; 332*0Sstevel@tonic-gate push @script, <<EOS; 333*0Sstevel@tonic-gate print "# remake [2]\n"; 334*0Sstevel@tonic-gate my \$z = Math::Complex->emake('[2]'); 335*0Sstevel@tonic-gate print "not " unless \$z == cplxe(2); 336*0Sstevel@tonic-gate print "ok $test\n"; 337*0Sstevel@tonic-gateEOS 338*0Sstevel@tonic-gate} 339*0Sstevel@tonic-gate 340*0Sstevel@tonic-gatetest_remake(); 341*0Sstevel@tonic-gate 342*0Sstevel@tonic-gateprint "1..$test\n"; 343*0Sstevel@tonic-gateeval join '', @script; 344*0Sstevel@tonic-gatedie $@ if $@; 345*0Sstevel@tonic-gate 346*0Sstevel@tonic-gatesub abop { 347*0Sstevel@tonic-gate my ($op) = @_; 348*0Sstevel@tonic-gate 349*0Sstevel@tonic-gate push(@script, qq(print "# $op=\n";)); 350*0Sstevel@tonic-gate} 351*0Sstevel@tonic-gate 352*0Sstevel@tonic-gatesub test { 353*0Sstevel@tonic-gate my ($op, $z, @args) = @_; 354*0Sstevel@tonic-gate my ($baop) = 0; 355*0Sstevel@tonic-gate $test++; 356*0Sstevel@tonic-gate my $i; 357*0Sstevel@tonic-gate $baop = 1 if ($op =~ s/;=$//); 358*0Sstevel@tonic-gate for ($i = 0; $i < @args; $i++) { 359*0Sstevel@tonic-gate $val = value($args[$i]); 360*0Sstevel@tonic-gate push @script, "\$z$i = $val;\n"; 361*0Sstevel@tonic-gate } 362*0Sstevel@tonic-gate if (defined $z) { 363*0Sstevel@tonic-gate $args = "'$op'"; # Really the value 364*0Sstevel@tonic-gate $try = "abs(\$z0 - \$z1) <= $eps ? \$z1 : \$z0"; 365*0Sstevel@tonic-gate push @script, "\$res = $try; "; 366*0Sstevel@tonic-gate push @script, "check($test, $args[0], \$res, \$z$#args, $args);\n"; 367*0Sstevel@tonic-gate } else { 368*0Sstevel@tonic-gate my ($try, $args); 369*0Sstevel@tonic-gate if (@args == 2) { 370*0Sstevel@tonic-gate $try = "$op \$z0"; 371*0Sstevel@tonic-gate $args = "'$args[0]'"; 372*0Sstevel@tonic-gate } else { 373*0Sstevel@tonic-gate $try = ($op =~ /^\w/) ? "$op(\$z0, \$z1)" : "\$z0 $op \$z1"; 374*0Sstevel@tonic-gate $args = "'$args[0]', '$args[1]'"; 375*0Sstevel@tonic-gate } 376*0Sstevel@tonic-gate push @script, "\$res = $try; "; 377*0Sstevel@tonic-gate push @script, "check($test, '$try', \$res, \$z$#args, $args);\n"; 378*0Sstevel@tonic-gate if (@args > 2 and $baop) { # binary assignment ops 379*0Sstevel@tonic-gate $test++; 380*0Sstevel@tonic-gate # check the op= works 381*0Sstevel@tonic-gate push @script, <<EOB; 382*0Sstevel@tonic-gate{ 383*0Sstevel@tonic-gate my \$za = cplx(ref \$z0 ? \@{\$z0->cartesian} : (\$z0, 0)); 384*0Sstevel@tonic-gate 385*0Sstevel@tonic-gate my (\$z1r, \$z1i) = ref \$z1 ? \@{\$z1->cartesian} : (\$z1, 0); 386*0Sstevel@tonic-gate 387*0Sstevel@tonic-gate my \$zb = cplx(\$z1r, \$z1i); 388*0Sstevel@tonic-gate 389*0Sstevel@tonic-gate \$za $op= \$zb; 390*0Sstevel@tonic-gate my (\$zbr, \$zbi) = \@{\$zb->cartesian}; 391*0Sstevel@tonic-gate 392*0Sstevel@tonic-gate check($test, '\$z0 $op= \$z1', \$za, \$z$#args, $args); 393*0Sstevel@tonic-gateEOB 394*0Sstevel@tonic-gate $test++; 395*0Sstevel@tonic-gate # check that the rhs has not changed 396*0Sstevel@tonic-gate push @script, qq(print "not " unless (\$zbr == \$z1r and \$zbi == \$z1i);); 397*0Sstevel@tonic-gate push @script, qq(print "ok $test\\n";\n); 398*0Sstevel@tonic-gate push @script, "}\n"; 399*0Sstevel@tonic-gate } 400*0Sstevel@tonic-gate } 401*0Sstevel@tonic-gate} 402*0Sstevel@tonic-gate 403*0Sstevel@tonic-gatesub set { 404*0Sstevel@tonic-gate my ($set, $setref, $valref) = @_; 405*0Sstevel@tonic-gate @{$setref} = (); 406*0Sstevel@tonic-gate @{$valref} = (); 407*0Sstevel@tonic-gate my @set = split(/;\s*/, $set); 408*0Sstevel@tonic-gate my @res; 409*0Sstevel@tonic-gate my $i; 410*0Sstevel@tonic-gate for ($i = 0; $i < @set; $i++) { 411*0Sstevel@tonic-gate push(@{$valref}, $set[$i]); 412*0Sstevel@tonic-gate my $val = value($set[$i]); 413*0Sstevel@tonic-gate push @script, "\$s$i = $val;\n"; 414*0Sstevel@tonic-gate push @{$setref}, "\$s$i"; 415*0Sstevel@tonic-gate } 416*0Sstevel@tonic-gate} 417*0Sstevel@tonic-gate 418*0Sstevel@tonic-gatesub value { 419*0Sstevel@tonic-gate local ($_) = @_; 420*0Sstevel@tonic-gate if (/^\s*\((.*),(.*)\)/) { 421*0Sstevel@tonic-gate return "cplx($1,$2)"; 422*0Sstevel@tonic-gate } 423*0Sstevel@tonic-gate elsif (/^\s*([\-\+]?(?:\d+(\.\d+)?|\.\d+)(?:[e[\-\+]\d+])?)/) { 424*0Sstevel@tonic-gate return "cplx($1,0)"; 425*0Sstevel@tonic-gate } 426*0Sstevel@tonic-gate elsif (/^\s*\[(.*),(.*)\]/) { 427*0Sstevel@tonic-gate return "cplxe($1,$2)"; 428*0Sstevel@tonic-gate } 429*0Sstevel@tonic-gate elsif (/^\s*'(.*)'/) { 430*0Sstevel@tonic-gate my $ex = $1; 431*0Sstevel@tonic-gate $ex =~ s/\bz\b/$target/g; 432*0Sstevel@tonic-gate $ex =~ s/\br\b/abs($target)/g; 433*0Sstevel@tonic-gate $ex =~ s/\bt\b/arg($target)/g; 434*0Sstevel@tonic-gate $ex =~ s/\ba\b/Re($target)/g; 435*0Sstevel@tonic-gate $ex =~ s/\bb\b/Im($target)/g; 436*0Sstevel@tonic-gate return $ex; 437*0Sstevel@tonic-gate } 438*0Sstevel@tonic-gate elsif (/^\s*"(.*)"/) { 439*0Sstevel@tonic-gate return "\"$1\""; 440*0Sstevel@tonic-gate } 441*0Sstevel@tonic-gate return $_; 442*0Sstevel@tonic-gate} 443*0Sstevel@tonic-gate 444*0Sstevel@tonic-gatesub check { 445*0Sstevel@tonic-gate my ($test, $try, $got, $expected, @z) = @_; 446*0Sstevel@tonic-gate 447*0Sstevel@tonic-gate print "# @_\n"; 448*0Sstevel@tonic-gate 449*0Sstevel@tonic-gate if ("$got" eq "$expected" 450*0Sstevel@tonic-gate || 451*0Sstevel@tonic-gate ($expected =~ /^-?\d/ && $got == $expected) 452*0Sstevel@tonic-gate || 453*0Sstevel@tonic-gate (abs($got - $expected) < $eps) 454*0Sstevel@tonic-gate ) { 455*0Sstevel@tonic-gate print "ok $test\n"; 456*0Sstevel@tonic-gate } else { 457*0Sstevel@tonic-gate print "not ok $test\n"; 458*0Sstevel@tonic-gate my $args = (@z == 1) ? "z = $z[0]" : "z0 = $z[0], z1 = $z[1]"; 459*0Sstevel@tonic-gate print "# '$try' expected: '$expected' got: '$got' for $args\n"; 460*0Sstevel@tonic-gate } 461*0Sstevel@tonic-gate} 462*0Sstevel@tonic-gate 463*0Sstevel@tonic-gatesub addsq { 464*0Sstevel@tonic-gate my ($z1, $z2) = @_; 465*0Sstevel@tonic-gate return ($z1 + i*$z2) * ($z1 - i*$z2); 466*0Sstevel@tonic-gate} 467*0Sstevel@tonic-gate 468*0Sstevel@tonic-gatesub subsq { 469*0Sstevel@tonic-gate my ($z1, $z2) = @_; 470*0Sstevel@tonic-gate return ($z1 + $z2) * ($z1 - $z2); 471*0Sstevel@tonic-gate} 472*0Sstevel@tonic-gate 473*0Sstevel@tonic-gate__END__ 474*0Sstevel@tonic-gate&+;= 475*0Sstevel@tonic-gate(3,4):(3,4):(6,8) 476*0Sstevel@tonic-gate(-3,4):(3,-4):(0,0) 477*0Sstevel@tonic-gate(3,4):-3:(0,4) 478*0Sstevel@tonic-gate1:(4,2):(5,2) 479*0Sstevel@tonic-gate[2,0]:[2,pi]:(0,0) 480*0Sstevel@tonic-gate 481*0Sstevel@tonic-gate&++ 482*0Sstevel@tonic-gate(2,1):(3,1) 483*0Sstevel@tonic-gate 484*0Sstevel@tonic-gate&-;= 485*0Sstevel@tonic-gate(2,3):(-2,-3) 486*0Sstevel@tonic-gate[2,pi/2]:[2,-(pi)/2] 487*0Sstevel@tonic-gate2:[2,0]:(0,0) 488*0Sstevel@tonic-gate[3,0]:2:(1,0) 489*0Sstevel@tonic-gate3:(4,5):(-1,-5) 490*0Sstevel@tonic-gate(4,5):3:(1,5) 491*0Sstevel@tonic-gate(2,1):(3,5):(-1,-4) 492*0Sstevel@tonic-gate 493*0Sstevel@tonic-gate&-- 494*0Sstevel@tonic-gate(1,2):(0,2) 495*0Sstevel@tonic-gate[2,pi]:[3,pi] 496*0Sstevel@tonic-gate 497*0Sstevel@tonic-gate&*;= 498*0Sstevel@tonic-gate(0,1):(0,1):(-1,0) 499*0Sstevel@tonic-gate(4,5):(1,0):(4,5) 500*0Sstevel@tonic-gate[2,2*pi/3]:(1,0):[2,2*pi/3] 501*0Sstevel@tonic-gate2:(0,1):(0,2) 502*0Sstevel@tonic-gate(0,1):3:(0,3) 503*0Sstevel@tonic-gate(0,1):(4,1):(-1,4) 504*0Sstevel@tonic-gate(2,1):(4,-1):(9,2) 505*0Sstevel@tonic-gate 506*0Sstevel@tonic-gate&/;= 507*0Sstevel@tonic-gate(3,4):(3,4):(1,0) 508*0Sstevel@tonic-gate(4,-5):1:(4,-5) 509*0Sstevel@tonic-gate1:(0,1):(0,-1) 510*0Sstevel@tonic-gate(0,6):(0,2):(3,0) 511*0Sstevel@tonic-gate(9,2):(4,-1):(2,1) 512*0Sstevel@tonic-gate[4,pi]:[2,pi/2]:[2,pi/2] 513*0Sstevel@tonic-gate[2,pi/2]:[4,pi]:[0.5,-(pi)/2] 514*0Sstevel@tonic-gate 515*0Sstevel@tonic-gate&**;= 516*0Sstevel@tonic-gate(2,0):(3,0):(8,0) 517*0Sstevel@tonic-gate(3,0):(2,0):(9,0) 518*0Sstevel@tonic-gate(2,3):(4,0):(-119,-120) 519*0Sstevel@tonic-gate(0,0):(1,0):(0,0) 520*0Sstevel@tonic-gate(0,0):(2,3):(0,0) 521*0Sstevel@tonic-gate(1,0):(0,0):(1,0) 522*0Sstevel@tonic-gate(1,0):(1,0):(1,0) 523*0Sstevel@tonic-gate(1,0):(2,3):(1,0) 524*0Sstevel@tonic-gate(2,3):(0,0):(1,0) 525*0Sstevel@tonic-gate(2,3):(1,0):(2,3) 526*0Sstevel@tonic-gate(0,0):(0,0):(1,0) 527*0Sstevel@tonic-gate 528*0Sstevel@tonic-gate&Re 529*0Sstevel@tonic-gate(3,4):3 530*0Sstevel@tonic-gate(-3,4):-3 531*0Sstevel@tonic-gate[1,pi/2]:0 532*0Sstevel@tonic-gate 533*0Sstevel@tonic-gate&Im 534*0Sstevel@tonic-gate(3,4):4 535*0Sstevel@tonic-gate(3,-4):-4 536*0Sstevel@tonic-gate[1,pi/2]:1 537*0Sstevel@tonic-gate 538*0Sstevel@tonic-gate&abs 539*0Sstevel@tonic-gate(3,4):5 540*0Sstevel@tonic-gate(-3,4):5 541*0Sstevel@tonic-gate 542*0Sstevel@tonic-gate&arg 543*0Sstevel@tonic-gate[2,0]:0 544*0Sstevel@tonic-gate[-2,0]:pi 545*0Sstevel@tonic-gate 546*0Sstevel@tonic-gate&~ 547*0Sstevel@tonic-gate(4,5):(4,-5) 548*0Sstevel@tonic-gate(-3,4):(-3,-4) 549*0Sstevel@tonic-gate[2,pi/2]:[2,-(pi)/2] 550*0Sstevel@tonic-gate 551*0Sstevel@tonic-gate&< 552*0Sstevel@tonic-gate(3,4):(1,2):0 553*0Sstevel@tonic-gate(3,4):(3,2):0 554*0Sstevel@tonic-gate(3,4):(3,8):1 555*0Sstevel@tonic-gate(4,4):(5,129):1 556*0Sstevel@tonic-gate 557*0Sstevel@tonic-gate&== 558*0Sstevel@tonic-gate(3,4):(4,5):0 559*0Sstevel@tonic-gate(3,4):(3,5):0 560*0Sstevel@tonic-gate(3,4):(2,4):0 561*0Sstevel@tonic-gate(3,4):(3,4):1 562*0Sstevel@tonic-gate 563*0Sstevel@tonic-gate&sqrt 564*0Sstevel@tonic-gate-9:(0,3) 565*0Sstevel@tonic-gate(-100,0):(0,10) 566*0Sstevel@tonic-gate(16,-30):(5,-3) 567*0Sstevel@tonic-gate 568*0Sstevel@tonic-gate&stringify_cartesian 569*0Sstevel@tonic-gate(-100,0):"-100" 570*0Sstevel@tonic-gate(0,1):"i" 571*0Sstevel@tonic-gate(4,-3):"4-3i" 572*0Sstevel@tonic-gate(4,0):"4" 573*0Sstevel@tonic-gate(-4,0):"-4" 574*0Sstevel@tonic-gate(-2,4):"-2+4i" 575*0Sstevel@tonic-gate(-2,-1):"-2-i" 576*0Sstevel@tonic-gate 577*0Sstevel@tonic-gate&stringify_polar 578*0Sstevel@tonic-gate[-1, 0]:"[1,pi]" 579*0Sstevel@tonic-gate[1, pi/3]:"[1,pi/3]" 580*0Sstevel@tonic-gate[6, -2*pi/3]:"[6,-2pi/3]" 581*0Sstevel@tonic-gate[0.5, -9*pi/11]:"[0.5,-9pi/11]" 582*0Sstevel@tonic-gate 583*0Sstevel@tonic-gate{ (4,3); [3,2]; (-3,4); (0,2); [2,1] } 584*0Sstevel@tonic-gate 585*0Sstevel@tonic-gate|'z + ~z':'2*Re(z)' 586*0Sstevel@tonic-gate|'z - ~z':'2*i*Im(z)' 587*0Sstevel@tonic-gate|'z * ~z':'abs(z) * abs(z)' 588*0Sstevel@tonic-gate 589*0Sstevel@tonic-gate{ (0.5, 0); (-0.5, 0); (2,3); [3,2]; (-3,2); (0,2); 3; 1.2; (-3, 0); (-2, -1); [2,1] } 590*0Sstevel@tonic-gate 591*0Sstevel@tonic-gate|'(root(z, 4))[1] ** 4':'z' 592*0Sstevel@tonic-gate|'(root(z, 5))[3] ** 5':'z' 593*0Sstevel@tonic-gate|'(root(z, 8))[7] ** 8':'z' 594*0Sstevel@tonic-gate|'abs(z)':'r' 595*0Sstevel@tonic-gate|'acot(z)':'acotan(z)' 596*0Sstevel@tonic-gate|'acsc(z)':'acosec(z)' 597*0Sstevel@tonic-gate|'acsc(z)':'asin(1 / z)' 598*0Sstevel@tonic-gate|'asec(z)':'acos(1 / z)' 599*0Sstevel@tonic-gate|'cbrt(z)':'cbrt(r) * exp(i * t/3)' 600*0Sstevel@tonic-gate|'cos(acos(z))':'z' 601*0Sstevel@tonic-gate|'addsq(cos(z), sin(z))':1 602*0Sstevel@tonic-gate|'cos(z)':'cosh(i*z)' 603*0Sstevel@tonic-gate|'subsq(cosh(z), sinh(z))':1 604*0Sstevel@tonic-gate|'cot(acot(z))':'z' 605*0Sstevel@tonic-gate|'cot(z)':'1 / tan(z)' 606*0Sstevel@tonic-gate|'cot(z)':'cotan(z)' 607*0Sstevel@tonic-gate|'csc(acsc(z))':'z' 608*0Sstevel@tonic-gate|'csc(z)':'1 / sin(z)' 609*0Sstevel@tonic-gate|'csc(z)':'cosec(z)' 610*0Sstevel@tonic-gate|'exp(log(z))':'z' 611*0Sstevel@tonic-gate|'exp(z)':'exp(a) * exp(i * b)' 612*0Sstevel@tonic-gate|'ln(z)':'log(z)' 613*0Sstevel@tonic-gate|'log(exp(z))':'z' 614*0Sstevel@tonic-gate|'log(z)':'log(r) + i*t' 615*0Sstevel@tonic-gate|'log10(z)':'log(z) / log(10)' 616*0Sstevel@tonic-gate|'logn(z, 2)':'log(z) / log(2)' 617*0Sstevel@tonic-gate|'logn(z, 3)':'log(z) / log(3)' 618*0Sstevel@tonic-gate|'sec(asec(z))':'z' 619*0Sstevel@tonic-gate|'sec(z)':'1 / cos(z)' 620*0Sstevel@tonic-gate|'sin(asin(z))':'z' 621*0Sstevel@tonic-gate|'sin(i * z)':'i * sinh(z)' 622*0Sstevel@tonic-gate|'sqrt(z) * sqrt(z)':'z' 623*0Sstevel@tonic-gate|'sqrt(z)':'sqrt(r) * exp(i * t/2)' 624*0Sstevel@tonic-gate|'tan(atan(z))':'z' 625*0Sstevel@tonic-gate|'z**z':'exp(z * log(z))' 626*0Sstevel@tonic-gate 627*0Sstevel@tonic-gate{ (1,1); [1,0.5]; (-2, -1); 2; -3; (-1,0.5); (0,0.5); 0.5; (2, 0); (-1, -2) } 628*0Sstevel@tonic-gate 629*0Sstevel@tonic-gate|'cosh(acosh(z))':'z' 630*0Sstevel@tonic-gate|'coth(acoth(z))':'z' 631*0Sstevel@tonic-gate|'coth(z)':'1 / tanh(z)' 632*0Sstevel@tonic-gate|'coth(z)':'cotanh(z)' 633*0Sstevel@tonic-gate|'csch(acsch(z))':'z' 634*0Sstevel@tonic-gate|'csch(z)':'1 / sinh(z)' 635*0Sstevel@tonic-gate|'csch(z)':'cosech(z)' 636*0Sstevel@tonic-gate|'sech(asech(z))':'z' 637*0Sstevel@tonic-gate|'sech(z)':'1 / cosh(z)' 638*0Sstevel@tonic-gate|'sinh(asinh(z))':'z' 639*0Sstevel@tonic-gate|'tanh(atanh(z))':'z' 640*0Sstevel@tonic-gate 641*0Sstevel@tonic-gate{ (0.2,-0.4); [1,0.5]; -1.2; (-1,0.5); 0.5; (1.1, 0) } 642*0Sstevel@tonic-gate 643*0Sstevel@tonic-gate|'acos(cos(z)) ** 2':'z * z' 644*0Sstevel@tonic-gate|'acosh(cosh(z)) ** 2':'z * z' 645*0Sstevel@tonic-gate|'acoth(z)':'acotanh(z)' 646*0Sstevel@tonic-gate|'acoth(z)':'atanh(1 / z)' 647*0Sstevel@tonic-gate|'acsch(z)':'acosech(z)' 648*0Sstevel@tonic-gate|'acsch(z)':'asinh(1 / z)' 649*0Sstevel@tonic-gate|'asech(z)':'acosh(1 / z)' 650*0Sstevel@tonic-gate|'asin(sin(z))':'z' 651*0Sstevel@tonic-gate|'asinh(sinh(z))':'z' 652*0Sstevel@tonic-gate|'atan(tan(z))':'z' 653*0Sstevel@tonic-gate|'atanh(tanh(z))':'z' 654*0Sstevel@tonic-gate 655*0Sstevel@tonic-gate&log 656*0Sstevel@tonic-gate(-2.0,0):( 0.69314718055995, 3.14159265358979) 657*0Sstevel@tonic-gate(-1.0,0):( 0 , 3.14159265358979) 658*0Sstevel@tonic-gate(-0.5,0):( -0.69314718055995, 3.14159265358979) 659*0Sstevel@tonic-gate( 0.5,0):( -0.69314718055995, 0 ) 660*0Sstevel@tonic-gate( 1.0,0):( 0 , 0 ) 661*0Sstevel@tonic-gate( 2.0,0):( 0.69314718055995, 0 ) 662*0Sstevel@tonic-gate 663*0Sstevel@tonic-gate&log 664*0Sstevel@tonic-gate( 2, 3):( 1.28247467873077, 0.98279372324733) 665*0Sstevel@tonic-gate(-2, 3):( 1.28247467873077, 2.15879893034246) 666*0Sstevel@tonic-gate(-2,-3):( 1.28247467873077, -2.15879893034246) 667*0Sstevel@tonic-gate( 2,-3):( 1.28247467873077, -0.98279372324733) 668*0Sstevel@tonic-gate 669*0Sstevel@tonic-gate&sin 670*0Sstevel@tonic-gate(-2.0,0):( -0.90929742682568, 0 ) 671*0Sstevel@tonic-gate(-1.0,0):( -0.84147098480790, 0 ) 672*0Sstevel@tonic-gate(-0.5,0):( -0.47942553860420, 0 ) 673*0Sstevel@tonic-gate( 0.0,0):( 0 , 0 ) 674*0Sstevel@tonic-gate( 0.5,0):( 0.47942553860420, 0 ) 675*0Sstevel@tonic-gate( 1.0,0):( 0.84147098480790, 0 ) 676*0Sstevel@tonic-gate( 2.0,0):( 0.90929742682568, 0 ) 677*0Sstevel@tonic-gate 678*0Sstevel@tonic-gate&sin 679*0Sstevel@tonic-gate( 2, 3):( 9.15449914691143, -4.16890695996656) 680*0Sstevel@tonic-gate(-2, 3):( -9.15449914691143, -4.16890695996656) 681*0Sstevel@tonic-gate(-2,-3):( -9.15449914691143, 4.16890695996656) 682*0Sstevel@tonic-gate( 2,-3):( 9.15449914691143, 4.16890695996656) 683*0Sstevel@tonic-gate 684*0Sstevel@tonic-gate&cos 685*0Sstevel@tonic-gate(-2.0,0):( -0.41614683654714, 0 ) 686*0Sstevel@tonic-gate(-1.0,0):( 0.54030230586814, 0 ) 687*0Sstevel@tonic-gate(-0.5,0):( 0.87758256189037, 0 ) 688*0Sstevel@tonic-gate( 0.0,0):( 1 , 0 ) 689*0Sstevel@tonic-gate( 0.5,0):( 0.87758256189037, 0 ) 690*0Sstevel@tonic-gate( 1.0,0):( 0.54030230586814, 0 ) 691*0Sstevel@tonic-gate( 2.0,0):( -0.41614683654714, 0 ) 692*0Sstevel@tonic-gate 693*0Sstevel@tonic-gate&cos 694*0Sstevel@tonic-gate( 2, 3):( -4.18962569096881, -9.10922789375534) 695*0Sstevel@tonic-gate(-2, 3):( -4.18962569096881, 9.10922789375534) 696*0Sstevel@tonic-gate(-2,-3):( -4.18962569096881, -9.10922789375534) 697*0Sstevel@tonic-gate( 2,-3):( -4.18962569096881, 9.10922789375534) 698*0Sstevel@tonic-gate 699*0Sstevel@tonic-gate&tan 700*0Sstevel@tonic-gate(-2.0,0):( 2.18503986326152, 0 ) 701*0Sstevel@tonic-gate(-1.0,0):( -1.55740772465490, 0 ) 702*0Sstevel@tonic-gate(-0.5,0):( -0.54630248984379, 0 ) 703*0Sstevel@tonic-gate( 0.0,0):( 0 , 0 ) 704*0Sstevel@tonic-gate( 0.5,0):( 0.54630248984379, 0 ) 705*0Sstevel@tonic-gate( 1.0,0):( 1.55740772465490, 0 ) 706*0Sstevel@tonic-gate( 2.0,0):( -2.18503986326152, 0 ) 707*0Sstevel@tonic-gate 708*0Sstevel@tonic-gate&tan 709*0Sstevel@tonic-gate( 2, 3):( -0.00376402564150, 1.00323862735361) 710*0Sstevel@tonic-gate(-2, 3):( 0.00376402564150, 1.00323862735361) 711*0Sstevel@tonic-gate(-2,-3):( 0.00376402564150, -1.00323862735361) 712*0Sstevel@tonic-gate( 2,-3):( -0.00376402564150, -1.00323862735361) 713*0Sstevel@tonic-gate 714*0Sstevel@tonic-gate&sec 715*0Sstevel@tonic-gate(-2.0,0):( -2.40299796172238, 0 ) 716*0Sstevel@tonic-gate(-1.0,0):( 1.85081571768093, 0 ) 717*0Sstevel@tonic-gate(-0.5,0):( 1.13949392732455, 0 ) 718*0Sstevel@tonic-gate( 0.0,0):( 1 , 0 ) 719*0Sstevel@tonic-gate( 0.5,0):( 1.13949392732455, 0 ) 720*0Sstevel@tonic-gate( 1.0,0):( 1.85081571768093, 0 ) 721*0Sstevel@tonic-gate( 2.0,0):( -2.40299796172238, 0 ) 722*0Sstevel@tonic-gate 723*0Sstevel@tonic-gate&sec 724*0Sstevel@tonic-gate( 2, 3):( -0.04167496441114, 0.09061113719624) 725*0Sstevel@tonic-gate(-2, 3):( -0.04167496441114, -0.09061113719624) 726*0Sstevel@tonic-gate(-2,-3):( -0.04167496441114, 0.09061113719624) 727*0Sstevel@tonic-gate( 2,-3):( -0.04167496441114, -0.09061113719624) 728*0Sstevel@tonic-gate 729*0Sstevel@tonic-gate&csc 730*0Sstevel@tonic-gate(-2.0,0):( -1.09975017029462, 0 ) 731*0Sstevel@tonic-gate(-1.0,0):( -1.18839510577812, 0 ) 732*0Sstevel@tonic-gate(-0.5,0):( -2.08582964293349, 0 ) 733*0Sstevel@tonic-gate( 0.5,0):( 2.08582964293349, 0 ) 734*0Sstevel@tonic-gate( 1.0,0):( 1.18839510577812, 0 ) 735*0Sstevel@tonic-gate( 2.0,0):( 1.09975017029462, 0 ) 736*0Sstevel@tonic-gate 737*0Sstevel@tonic-gate&csc 738*0Sstevel@tonic-gate( 2, 3):( 0.09047320975321, 0.04120098628857) 739*0Sstevel@tonic-gate(-2, 3):( -0.09047320975321, 0.04120098628857) 740*0Sstevel@tonic-gate(-2,-3):( -0.09047320975321, -0.04120098628857) 741*0Sstevel@tonic-gate( 2,-3):( 0.09047320975321, -0.04120098628857) 742*0Sstevel@tonic-gate 743*0Sstevel@tonic-gate&cot 744*0Sstevel@tonic-gate(-2.0,0):( 0.45765755436029, 0 ) 745*0Sstevel@tonic-gate(-1.0,0):( -0.64209261593433, 0 ) 746*0Sstevel@tonic-gate(-0.5,0):( -1.83048772171245, 0 ) 747*0Sstevel@tonic-gate( 0.5,0):( 1.83048772171245, 0 ) 748*0Sstevel@tonic-gate( 1.0,0):( 0.64209261593433, 0 ) 749*0Sstevel@tonic-gate( 2.0,0):( -0.45765755436029, 0 ) 750*0Sstevel@tonic-gate 751*0Sstevel@tonic-gate&cot 752*0Sstevel@tonic-gate( 2, 3):( -0.00373971037634, -0.99675779656936) 753*0Sstevel@tonic-gate(-2, 3):( 0.00373971037634, -0.99675779656936) 754*0Sstevel@tonic-gate(-2,-3):( 0.00373971037634, 0.99675779656936) 755*0Sstevel@tonic-gate( 2,-3):( -0.00373971037634, 0.99675779656936) 756*0Sstevel@tonic-gate 757*0Sstevel@tonic-gate&asin 758*0Sstevel@tonic-gate(-2.0,0):( -1.57079632679490, 1.31695789692482) 759*0Sstevel@tonic-gate(-1.0,0):( -1.57079632679490, 0 ) 760*0Sstevel@tonic-gate(-0.5,0):( -0.52359877559830, 0 ) 761*0Sstevel@tonic-gate( 0.0,0):( 0 , 0 ) 762*0Sstevel@tonic-gate( 0.5,0):( 0.52359877559830, 0 ) 763*0Sstevel@tonic-gate( 1.0,0):( 1.57079632679490, 0 ) 764*0Sstevel@tonic-gate( 2.0,0):( 1.57079632679490, -1.31695789692482) 765*0Sstevel@tonic-gate 766*0Sstevel@tonic-gate&asin 767*0Sstevel@tonic-gate( 2, 3):( 0.57065278432110, 1.98338702991654) 768*0Sstevel@tonic-gate(-2, 3):( -0.57065278432110, 1.98338702991654) 769*0Sstevel@tonic-gate(-2,-3):( -0.57065278432110, -1.98338702991654) 770*0Sstevel@tonic-gate( 2,-3):( 0.57065278432110, -1.98338702991654) 771*0Sstevel@tonic-gate 772*0Sstevel@tonic-gate&acos 773*0Sstevel@tonic-gate(-2.0,0):( 3.14159265358979, -1.31695789692482) 774*0Sstevel@tonic-gate(-1.0,0):( 3.14159265358979, 0 ) 775*0Sstevel@tonic-gate(-0.5,0):( 2.09439510239320, 0 ) 776*0Sstevel@tonic-gate( 0.0,0):( 1.57079632679490, 0 ) 777*0Sstevel@tonic-gate( 0.5,0):( 1.04719755119660, 0 ) 778*0Sstevel@tonic-gate( 1.0,0):( 0 , 0 ) 779*0Sstevel@tonic-gate( 2.0,0):( 0 , 1.31695789692482) 780*0Sstevel@tonic-gate 781*0Sstevel@tonic-gate&acos 782*0Sstevel@tonic-gate( 2, 3):( 1.00014354247380, -1.98338702991654) 783*0Sstevel@tonic-gate(-2, 3):( 2.14144911111600, -1.98338702991654) 784*0Sstevel@tonic-gate(-2,-3):( 2.14144911111600, 1.98338702991654) 785*0Sstevel@tonic-gate( 2,-3):( 1.00014354247380, 1.98338702991654) 786*0Sstevel@tonic-gate 787*0Sstevel@tonic-gate&atan 788*0Sstevel@tonic-gate(-2.0,0):( -1.10714871779409, 0 ) 789*0Sstevel@tonic-gate(-1.0,0):( -0.78539816339745, 0 ) 790*0Sstevel@tonic-gate(-0.5,0):( -0.46364760900081, 0 ) 791*0Sstevel@tonic-gate( 0.0,0):( 0 , 0 ) 792*0Sstevel@tonic-gate( 0.5,0):( 0.46364760900081, 0 ) 793*0Sstevel@tonic-gate( 1.0,0):( 0.78539816339745, 0 ) 794*0Sstevel@tonic-gate( 2.0,0):( 1.10714871779409, 0 ) 795*0Sstevel@tonic-gate 796*0Sstevel@tonic-gate&atan 797*0Sstevel@tonic-gate( 2, 3):( 1.40992104959658, 0.22907268296854) 798*0Sstevel@tonic-gate(-2, 3):( -1.40992104959658, 0.22907268296854) 799*0Sstevel@tonic-gate(-2,-3):( -1.40992104959658, -0.22907268296854) 800*0Sstevel@tonic-gate( 2,-3):( 1.40992104959658, -0.22907268296854) 801*0Sstevel@tonic-gate 802*0Sstevel@tonic-gate&asec 803*0Sstevel@tonic-gate(-2.0,0):( 2.09439510239320, 0 ) 804*0Sstevel@tonic-gate(-1.0,0):( 3.14159265358979, 0 ) 805*0Sstevel@tonic-gate(-0.5,0):( 3.14159265358979, -1.31695789692482) 806*0Sstevel@tonic-gate( 0.5,0):( 0 , 1.31695789692482) 807*0Sstevel@tonic-gate( 1.0,0):( 0 , 0 ) 808*0Sstevel@tonic-gate( 2.0,0):( 1.04719755119660, 0 ) 809*0Sstevel@tonic-gate 810*0Sstevel@tonic-gate&asec 811*0Sstevel@tonic-gate( 2, 3):( 1.42041072246703, 0.23133469857397) 812*0Sstevel@tonic-gate(-2, 3):( 1.72118193112276, 0.23133469857397) 813*0Sstevel@tonic-gate(-2,-3):( 1.72118193112276, -0.23133469857397) 814*0Sstevel@tonic-gate( 2,-3):( 1.42041072246703, -0.23133469857397) 815*0Sstevel@tonic-gate 816*0Sstevel@tonic-gate&acsc 817*0Sstevel@tonic-gate(-2.0,0):( -0.52359877559830, 0 ) 818*0Sstevel@tonic-gate(-1.0,0):( -1.57079632679490, 0 ) 819*0Sstevel@tonic-gate(-0.5,0):( -1.57079632679490, 1.31695789692482) 820*0Sstevel@tonic-gate( 0.5,0):( 1.57079632679490, -1.31695789692482) 821*0Sstevel@tonic-gate( 1.0,0):( 1.57079632679490, 0 ) 822*0Sstevel@tonic-gate( 2.0,0):( 0.52359877559830, 0 ) 823*0Sstevel@tonic-gate 824*0Sstevel@tonic-gate&acsc 825*0Sstevel@tonic-gate( 2, 3):( 0.15038560432786, -0.23133469857397) 826*0Sstevel@tonic-gate(-2, 3):( -0.15038560432786, -0.23133469857397) 827*0Sstevel@tonic-gate(-2,-3):( -0.15038560432786, 0.23133469857397) 828*0Sstevel@tonic-gate( 2,-3):( 0.15038560432786, 0.23133469857397) 829*0Sstevel@tonic-gate 830*0Sstevel@tonic-gate&acot 831*0Sstevel@tonic-gate(-2.0,0):( -0.46364760900081, 0 ) 832*0Sstevel@tonic-gate(-1.0,0):( -0.78539816339745, 0 ) 833*0Sstevel@tonic-gate(-0.5,0):( -1.10714871779409, 0 ) 834*0Sstevel@tonic-gate( 0.5,0):( 1.10714871779409, 0 ) 835*0Sstevel@tonic-gate( 1.0,0):( 0.78539816339745, 0 ) 836*0Sstevel@tonic-gate( 2.0,0):( 0.46364760900081, 0 ) 837*0Sstevel@tonic-gate 838*0Sstevel@tonic-gate&acot 839*0Sstevel@tonic-gate( 2, 3):( 0.16087527719832, -0.22907268296854) 840*0Sstevel@tonic-gate(-2, 3):( -0.16087527719832, -0.22907268296854) 841*0Sstevel@tonic-gate(-2,-3):( -0.16087527719832, 0.22907268296854) 842*0Sstevel@tonic-gate( 2,-3):( 0.16087527719832, 0.22907268296854) 843*0Sstevel@tonic-gate 844*0Sstevel@tonic-gate&sinh 845*0Sstevel@tonic-gate(-2.0,0):( -3.62686040784702, 0 ) 846*0Sstevel@tonic-gate(-1.0,0):( -1.17520119364380, 0 ) 847*0Sstevel@tonic-gate(-0.5,0):( -0.52109530549375, 0 ) 848*0Sstevel@tonic-gate( 0.0,0):( 0 , 0 ) 849*0Sstevel@tonic-gate( 0.5,0):( 0.52109530549375, 0 ) 850*0Sstevel@tonic-gate( 1.0,0):( 1.17520119364380, 0 ) 851*0Sstevel@tonic-gate( 2.0,0):( 3.62686040784702, 0 ) 852*0Sstevel@tonic-gate 853*0Sstevel@tonic-gate&sinh 854*0Sstevel@tonic-gate( 2, 3):( -3.59056458998578, 0.53092108624852) 855*0Sstevel@tonic-gate(-2, 3):( 3.59056458998578, 0.53092108624852) 856*0Sstevel@tonic-gate(-2,-3):( 3.59056458998578, -0.53092108624852) 857*0Sstevel@tonic-gate( 2,-3):( -3.59056458998578, -0.53092108624852) 858*0Sstevel@tonic-gate 859*0Sstevel@tonic-gate&cosh 860*0Sstevel@tonic-gate(-2.0,0):( 3.76219569108363, 0 ) 861*0Sstevel@tonic-gate(-1.0,0):( 1.54308063481524, 0 ) 862*0Sstevel@tonic-gate(-0.5,0):( 1.12762596520638, 0 ) 863*0Sstevel@tonic-gate( 0.0,0):( 1 , 0 ) 864*0Sstevel@tonic-gate( 0.5,0):( 1.12762596520638, 0 ) 865*0Sstevel@tonic-gate( 1.0,0):( 1.54308063481524, 0 ) 866*0Sstevel@tonic-gate( 2.0,0):( 3.76219569108363, 0 ) 867*0Sstevel@tonic-gate 868*0Sstevel@tonic-gate&cosh 869*0Sstevel@tonic-gate( 2, 3):( -3.72454550491532, 0.51182256998738) 870*0Sstevel@tonic-gate(-2, 3):( -3.72454550491532, -0.51182256998738) 871*0Sstevel@tonic-gate(-2,-3):( -3.72454550491532, 0.51182256998738) 872*0Sstevel@tonic-gate( 2,-3):( -3.72454550491532, -0.51182256998738) 873*0Sstevel@tonic-gate 874*0Sstevel@tonic-gate&tanh 875*0Sstevel@tonic-gate(-2.0,0):( -0.96402758007582, 0 ) 876*0Sstevel@tonic-gate(-1.0,0):( -0.76159415595576, 0 ) 877*0Sstevel@tonic-gate(-0.5,0):( -0.46211715726001, 0 ) 878*0Sstevel@tonic-gate( 0.0,0):( 0 , 0 ) 879*0Sstevel@tonic-gate( 0.5,0):( 0.46211715726001, 0 ) 880*0Sstevel@tonic-gate( 1.0,0):( 0.76159415595576, 0 ) 881*0Sstevel@tonic-gate( 2.0,0):( 0.96402758007582, 0 ) 882*0Sstevel@tonic-gate 883*0Sstevel@tonic-gate&tanh 884*0Sstevel@tonic-gate( 2, 3):( 0.96538587902213, -0.00988437503832) 885*0Sstevel@tonic-gate(-2, 3):( -0.96538587902213, -0.00988437503832) 886*0Sstevel@tonic-gate(-2,-3):( -0.96538587902213, 0.00988437503832) 887*0Sstevel@tonic-gate( 2,-3):( 0.96538587902213, 0.00988437503832) 888*0Sstevel@tonic-gate 889*0Sstevel@tonic-gate&sech 890*0Sstevel@tonic-gate(-2.0,0):( 0.26580222883408, 0 ) 891*0Sstevel@tonic-gate(-1.0,0):( 0.64805427366389, 0 ) 892*0Sstevel@tonic-gate(-0.5,0):( 0.88681888397007, 0 ) 893*0Sstevel@tonic-gate( 0.0,0):( 1 , 0 ) 894*0Sstevel@tonic-gate( 0.5,0):( 0.88681888397007, 0 ) 895*0Sstevel@tonic-gate( 1.0,0):( 0.64805427366389, 0 ) 896*0Sstevel@tonic-gate( 2.0,0):( 0.26580222883408, 0 ) 897*0Sstevel@tonic-gate 898*0Sstevel@tonic-gate&sech 899*0Sstevel@tonic-gate( 2, 3):( -0.26351297515839, -0.03621163655877) 900*0Sstevel@tonic-gate(-2, 3):( -0.26351297515839, 0.03621163655877) 901*0Sstevel@tonic-gate(-2,-3):( -0.26351297515839, -0.03621163655877) 902*0Sstevel@tonic-gate( 2,-3):( -0.26351297515839, 0.03621163655877) 903*0Sstevel@tonic-gate 904*0Sstevel@tonic-gate&csch 905*0Sstevel@tonic-gate(-2.0,0):( -0.27572056477178, 0 ) 906*0Sstevel@tonic-gate(-1.0,0):( -0.85091812823932, 0 ) 907*0Sstevel@tonic-gate(-0.5,0):( -1.91903475133494, 0 ) 908*0Sstevel@tonic-gate( 0.5,0):( 1.91903475133494, 0 ) 909*0Sstevel@tonic-gate( 1.0,0):( 0.85091812823932, 0 ) 910*0Sstevel@tonic-gate( 2.0,0):( 0.27572056477178, 0 ) 911*0Sstevel@tonic-gate 912*0Sstevel@tonic-gate&csch 913*0Sstevel@tonic-gate( 2, 3):( -0.27254866146294, -0.04030057885689) 914*0Sstevel@tonic-gate(-2, 3):( 0.27254866146294, -0.04030057885689) 915*0Sstevel@tonic-gate(-2,-3):( 0.27254866146294, 0.04030057885689) 916*0Sstevel@tonic-gate( 2,-3):( -0.27254866146294, 0.04030057885689) 917*0Sstevel@tonic-gate 918*0Sstevel@tonic-gate&coth 919*0Sstevel@tonic-gate(-2.0,0):( -1.03731472072755, 0 ) 920*0Sstevel@tonic-gate(-1.0,0):( -1.31303528549933, 0 ) 921*0Sstevel@tonic-gate(-0.5,0):( -2.16395341373865, 0 ) 922*0Sstevel@tonic-gate( 0.5,0):( 2.16395341373865, 0 ) 923*0Sstevel@tonic-gate( 1.0,0):( 1.31303528549933, 0 ) 924*0Sstevel@tonic-gate( 2.0,0):( 1.03731472072755, 0 ) 925*0Sstevel@tonic-gate 926*0Sstevel@tonic-gate&coth 927*0Sstevel@tonic-gate( 2, 3):( 1.03574663776500, 0.01060478347034) 928*0Sstevel@tonic-gate(-2, 3):( -1.03574663776500, 0.01060478347034) 929*0Sstevel@tonic-gate(-2,-3):( -1.03574663776500, -0.01060478347034) 930*0Sstevel@tonic-gate( 2,-3):( 1.03574663776500, -0.01060478347034) 931*0Sstevel@tonic-gate 932*0Sstevel@tonic-gate&asinh 933*0Sstevel@tonic-gate(-2.0,0):( -1.44363547517881, 0 ) 934*0Sstevel@tonic-gate(-1.0,0):( -0.88137358701954, 0 ) 935*0Sstevel@tonic-gate(-0.5,0):( -0.48121182505960, 0 ) 936*0Sstevel@tonic-gate( 0.0,0):( 0 , 0 ) 937*0Sstevel@tonic-gate( 0.5,0):( 0.48121182505960, 0 ) 938*0Sstevel@tonic-gate( 1.0,0):( 0.88137358701954, 0 ) 939*0Sstevel@tonic-gate( 2.0,0):( 1.44363547517881, 0 ) 940*0Sstevel@tonic-gate 941*0Sstevel@tonic-gate&asinh 942*0Sstevel@tonic-gate( 2, 3):( 1.96863792579310, 0.96465850440760) 943*0Sstevel@tonic-gate(-2, 3):( -1.96863792579310, 0.96465850440761) 944*0Sstevel@tonic-gate(-2,-3):( -1.96863792579310, -0.96465850440761) 945*0Sstevel@tonic-gate( 2,-3):( 1.96863792579310, -0.96465850440760) 946*0Sstevel@tonic-gate 947*0Sstevel@tonic-gate&acosh 948*0Sstevel@tonic-gate(-2.0,0):( 1.31695789692482, 3.14159265358979) 949*0Sstevel@tonic-gate(-1.0,0):( 0, 3.14159265358979) 950*0Sstevel@tonic-gate(-0.5,0):( 0, 2.09439510239320) 951*0Sstevel@tonic-gate( 0.0,0):( 0, 1.57079632679490) 952*0Sstevel@tonic-gate( 0.5,0):( 0, 1.04719755119660) 953*0Sstevel@tonic-gate( 1.0,0):( 0 , 0 ) 954*0Sstevel@tonic-gate( 2.0,0):( 1.31695789692482, 0 ) 955*0Sstevel@tonic-gate 956*0Sstevel@tonic-gate&acosh 957*0Sstevel@tonic-gate( 2, 3):( 1.98338702991654, 1.00014354247380) 958*0Sstevel@tonic-gate(-2, 3):( 1.98338702991653, 2.14144911111600) 959*0Sstevel@tonic-gate(-2,-3):( 1.98338702991653, -2.14144911111600) 960*0Sstevel@tonic-gate( 2,-3):( 1.98338702991654, -1.00014354247380) 961*0Sstevel@tonic-gate 962*0Sstevel@tonic-gate&atanh 963*0Sstevel@tonic-gate(-2.0,0):( -0.54930614433405, 1.57079632679490) 964*0Sstevel@tonic-gate(-0.5,0):( -0.54930614433405, 0 ) 965*0Sstevel@tonic-gate( 0.0,0):( 0 , 0 ) 966*0Sstevel@tonic-gate( 0.5,0):( 0.54930614433405, 0 ) 967*0Sstevel@tonic-gate( 2.0,0):( 0.54930614433405, 1.57079632679490) 968*0Sstevel@tonic-gate 969*0Sstevel@tonic-gate&atanh 970*0Sstevel@tonic-gate( 2, 3):( 0.14694666622553, 1.33897252229449) 971*0Sstevel@tonic-gate(-2, 3):( -0.14694666622553, 1.33897252229449) 972*0Sstevel@tonic-gate(-2,-3):( -0.14694666622553, -1.33897252229449) 973*0Sstevel@tonic-gate( 2,-3):( 0.14694666622553, -1.33897252229449) 974*0Sstevel@tonic-gate 975*0Sstevel@tonic-gate&asech 976*0Sstevel@tonic-gate(-2.0,0):( 0 , 2.09439510239320) 977*0Sstevel@tonic-gate(-1.0,0):( 0 , 3.14159265358979) 978*0Sstevel@tonic-gate(-0.5,0):( 1.31695789692482, 3.14159265358979) 979*0Sstevel@tonic-gate( 0.5,0):( 1.31695789692482, 0 ) 980*0Sstevel@tonic-gate( 1.0,0):( 0 , 0 ) 981*0Sstevel@tonic-gate( 2.0,0):( 0 , 1.04719755119660) 982*0Sstevel@tonic-gate 983*0Sstevel@tonic-gate&asech 984*0Sstevel@tonic-gate( 2, 3):( 0.23133469857397, -1.42041072246703) 985*0Sstevel@tonic-gate(-2, 3):( 0.23133469857397, -1.72118193112276) 986*0Sstevel@tonic-gate(-2,-3):( 0.23133469857397, 1.72118193112276) 987*0Sstevel@tonic-gate( 2,-3):( 0.23133469857397, 1.42041072246703) 988*0Sstevel@tonic-gate 989*0Sstevel@tonic-gate&acsch 990*0Sstevel@tonic-gate(-2.0,0):( -0.48121182505960, 0 ) 991*0Sstevel@tonic-gate(-1.0,0):( -0.88137358701954, 0 ) 992*0Sstevel@tonic-gate(-0.5,0):( -1.44363547517881, 0 ) 993*0Sstevel@tonic-gate( 0.5,0):( 1.44363547517881, 0 ) 994*0Sstevel@tonic-gate( 1.0,0):( 0.88137358701954, 0 ) 995*0Sstevel@tonic-gate( 2.0,0):( 0.48121182505960, 0 ) 996*0Sstevel@tonic-gate 997*0Sstevel@tonic-gate&acsch 998*0Sstevel@tonic-gate( 2, 3):( 0.15735549884499, -0.22996290237721) 999*0Sstevel@tonic-gate(-2, 3):( -0.15735549884499, -0.22996290237721) 1000*0Sstevel@tonic-gate(-2,-3):( -0.15735549884499, 0.22996290237721) 1001*0Sstevel@tonic-gate( 2,-3):( 0.15735549884499, 0.22996290237721) 1002*0Sstevel@tonic-gate 1003*0Sstevel@tonic-gate&acoth 1004*0Sstevel@tonic-gate(-2.0,0):( -0.54930614433405, 0 ) 1005*0Sstevel@tonic-gate(-0.5,0):( -0.54930614433405, 1.57079632679490) 1006*0Sstevel@tonic-gate( 0.5,0):( 0.54930614433405, 1.57079632679490) 1007*0Sstevel@tonic-gate( 2.0,0):( 0.54930614433405, 0 ) 1008*0Sstevel@tonic-gate 1009*0Sstevel@tonic-gate&acoth 1010*0Sstevel@tonic-gate( 2, 3):( 0.14694666622553, -0.23182380450040) 1011*0Sstevel@tonic-gate(-2, 3):( -0.14694666622553, -0.23182380450040) 1012*0Sstevel@tonic-gate(-2,-3):( -0.14694666622553, 0.23182380450040) 1013*0Sstevel@tonic-gate( 2,-3):( 0.14694666622553, 0.23182380450040) 1014*0Sstevel@tonic-gate 1015*0Sstevel@tonic-gate# eof 1016