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