1 (kill(all),reset(), 0);
16 conjugate(sqrt(3) + sqrt(7));
31 conjugate(1.4b0 + %i * 5.7b0);
34 conjugate(sqrt(7 + %i * 8));
37 conjugate(log(1 - %i));
61 conjugate(sqrt(1+x^2));
112 (declare(z,complex),0);
115 conjugate(conjugate(z));
118 conjugate(conjugate(conjugate(z)));
127 conjugate(5 + 7 * z);
128 5 + 7 * conjugate(z);
178 conjugate(realpart(z));
181 conjugate(imagpart(z));
196 (assume(imagpart(z) > 0),0);
205 conjugate(log(5 + z));
206 log(5 + conjugate(z))$
208 (declare(w,complex),0);
211 (assume(realpart(w) > 0),0);
220 conjugate(log(7 + w));
221 log(7 + conjugate(w))$
223 (declare(q,complex),0);
232 conjugate(1 + q + q^2);
233 1 + conjugate(q) + conjugate(q)^2$
236 conjugate(q) * (1 + conjugate(q))$
238 conjugate((1+q)/(1-q));
239 (1 + conjugate(q))/(1 - conjugate(q))$
241 (forget(imagpart(z) > 0), forget(realpart(w) > 0),0);
244 declare(p0, even, q1, odd, pq, rational, qp, irrational, rr, real, ii, imaginary);
247 conjugate (p0 + q1 + pq + qp + rr + ii);
248 p0 + q1 + pq + qp + rr - ii;
250 /* conjugate of sums and products */
252 (declare(n, real), declare(m,real),0);
255 conjugate(sum(cos(k),k,1,n));
258 conjugate(prod(cos(k),k,1,n));
261 conjugate(sum(log(k + %i), k, m, n));
262 sum(log(k - %i), k, m, n)$
264 conjugate(prod(log(k + %i), k, m, n));
265 prod(log(k - %i), k, m, n)$
267 (remove(n,real), remove(m,real),0);
270 /* conjugate of asin */
272 (assume(x > -1, x < 1),0);
281 conjugate(asin(x + %i));
284 conjugate(asin(x - %i));
287 conjugate(asin(x + %i * y));
290 conjugate(asin(x - %i * y));
310 conjugate(set(8, set(8, set(32 - %i))));
311 set(8, set(8, set(32 + %i)))$
316 conjugate(matrix([]));
319 conjugate(matrix([1,2,%i]));
322 conjugate(matrix([matrix([%i])]));
323 matrix([matrix([-%i])])$
330 conjugate(log(x + %i));
331 log(conjugate(x) - %i)$
333 conjugate(log(-1 + %i));
336 (assume(x > 0, notequal(www,0)), 0);
342 conjugate(log(-x + %i * www));
345 (forget(x > 0, notequal(www,0)),0);
348 /* exponential expressions */
353 conjugate(exp(y - %i * x));
356 (declare(z,complex),0);
362 (declare(n,integer,z,complex),0);
377 conjugate(sinh(cosh(z)));
378 sinh(cosh(conjugate(z)))$
380 /* Test for bug 1491486 */
382 conjugate((1+%i)^%i);
385 (declare(z,complex),0);
388 /* Test for bug 1489285 */
390 is(imagpart(conjugate(z)) # z);
393 (remove(z,complex),0);
396 /* Test for bug 1488344 */
398 matrixp(conjugate(genmatrix(a,100,100)));
401 /* Test for bug 1488359 */
403 is(op(conjugate(f[6](x))) = 'conjugate);
406 /* Tests for bug 1639890 */
407 (assume(notequal(y,0)),0);
410 conjugate(log(-1 + %i * y));
413 conjugate(log(x + %i * y));
416 conjugate(log(%pi + %i * y));
419 (forget(notequal(y,0)),0);
423 /* Test for bug (conjugate of atan) fixed by CVS revisions 1.9 and 1.11 */
428 /* Bug ID: 2886564 - conjugate(atan2(y,x)) not simplified */
430 conjugate(atan2(y,x));
433 (declare(z,complex), conjugate(signum(z)));
434 signum(conjugate(z))$
436 (remove(z,complex),0);
439 conjugate(ceiling(x));
448 conjugate(unit_step(x));
451 conjugate(charfun(x>0));
454 conjugate(log_gamma(2+%i*107));
457 conjugate(log_gamma(-2+%i*107));
458 log_gamma(-2-%i*107);
460 conjugate(li[2](42 + %i/2));
463 conjugate(psi[2](-42 + %i/2));
497 /* additional tests */
499 (declare(z,complex), declare(zz,complex), assume(-1<a, a<1, notequal(b,0)),0);
502 /* one of the few tests that check this case */
503 is(conjugate(z^zz) = conjugate(z)^conjugate(zz));
506 is(equal(conjugate(z^zz), conjugate(z)^conjugate(zz)));
509 is(conjugate(sqrt(x)) = sqrt(conjugate(x)));
512 is(equal(conjugate(sqrt(1+%i)), sqrt(conjugate(1+%i))));
515 is(equal(conjugate(sqrt(-1+%i)), sqrt(conjugate(-1+%i))));
518 is(conjugate(x^zz) = conjugate(x)^conjugate(zz));
521 is(conjugate(x^zz) = conjugate(x)^conjugate(zz));
524 (declare(n,integer),0);
527 is(equal(conjugate(z^n), conjugate(z)^n));
530 (remove(n,integer),0);
533 (assume(notequal(imagpart(z),0)),0);
536 is(equal(conjugate(z^zz), conjugate(z)^conjugate(zz)));
539 (forget(notequal(imagpart(z),0)),0);
542 is(equal(conjugate((x+%i*%pi)^zz), (x-%i*%pi)^conjugate(zz)));
545 is(equal(conjugate((x+%i/10)^zz), (x-%i/10)^conjugate(zz)));
551 conjugate(acsc(3/2 + %i));
554 conjugate(acsc(1/2 + %i));
560 conjugate(asec(3/2 + %i));
563 conjugate(asec(1/2 + %i));
566 /* functions that commute with conjugate */
567 map(lambda([fn], is(conjugate(apply(fn,[z])) = apply(fn, [conjugate(z)]))),
568 [cosh, sinh, tanh, sech, csch, coth, cos, sin, tan, sec, csc, cot,gamma]);
569 [true,true,true,true,true,true,true,true,true,true,true,true,true]$
571 conjugate(jacobi_cn(a,z));
572 jacobi_cn(a, conjugate(z))$
574 conjugate(jacobi_sn(a,z));
575 jacobi_sn(a, conjugate(z))$
577 conjugate(jacobi_dn(a,z));
578 jacobi_dn(a, conjugate(z))$
580 conjugate(pochhammer(z, n));
581 pochhammer(conjugate(z),n)$
586 conjugate(z # 46+107*%i);
587 conjugate(z) # 46 - 107*%i$
589 conjugate(transpose(z));
590 transpose(conjugate(z))$
592 conjugate(matrix([%i,5],[5,%i]));
593 matrix([-%i,5],[5,-%i])$
598 conjugate(set(a,b,%i));
601 conjugate(hankel_1(z,z^2));
602 conjugate(hankel_1(z,z^2))$
604 conjugate(hankel_1(z,x+%i));
605 hankel_2(conjugate(z),x-%i)$
607 conjugate(hankel_2(z,z^2));
608 conjugate(hankel_2(z,z^2))$
610 conjugate(hankel_2(z,x+%i));
611 hankel_1(conjugate(z),x-%i)$
613 map('conjugate, [log(5+%i), log(x^2+1), log(z), log(-(x^2+1))]);
614 [log(5-%i),log(x^2+1),conjugate(log(z)),log(x^2+1)-%i*%pi]$
616 conjugate(bessel_j(z,z^2));
617 conjugate(bessel_j(z,z^2))$
619 conjugate(bessel_j(z,x+%i));
620 bessel_j(conjugate(z),x-%i)$
622 conjugate(bessel_y(z,z^2));
623 conjugate(bessel_y(z,z^2))$
625 conjugate(bessel_y(z,x+%i));
626 bessel_y(conjugate(z),x-%i)$
628 conjugate(bessel_i(z,z^2));
629 conjugate(bessel_i(z,z^2))$
631 conjugate(bessel_i(z,x+%i));
632 bessel_i(conjugate(z),x-%i)$
634 conjugate(bessel_k(z,z^2));
635 conjugate(bessel_k(z,z^2))$
637 conjugate(bessel_k(z,x+%i));
638 bessel_k(conjugate(z),x-%i)$
640 conjugate(log_gamma(z));
641 conjugate(log_gamma(z))$
643 conjugate(log_gamma(1-%i));
649 conjugate(psi[2](z));
650 psi[2](conjugate(z))$
652 map('conjugate, [plog(5+%i), plog(x^2+1), plog(z), plog(-(x^2+1))]);
653 [plog(5-%i),plog(x^2+1),conjugate(plog(z)),plog(x^2+1)-%i*%pi]$
655 /* off (-infinity,-1) union (1,infinity), conjugate and asin commute */
656 map('conjugate,[asin(z), asin(a+%i*b), asin(1/2+%i), asin(107+%i*b),asin(107)]);
657 [conjugate(asin(z)), asin(a-%i*b), asin(1/2-%i), asin(107-%i*b), conjugate(asin(107))]$
659 /* off (-infinity,-1) union (1,infinity), conjugate and acos commute */
660 map('conjugate,[acos(z), acos(a+%i*b), acos(1/2+%i), acos(107+%i*b),acos(107)]);
661 [conjugate(acos(z)), acos(a-%i*b), acos(1/2-%i), acos(107-%i*b), conjugate(acos(107))]$
663 /* off (-infinity %i, -%i) union (%i, %i infinity), conjugate and atan commute */
664 map('conjugate, [atan(z), atan(1/2 + %i), atan(-1/3+%i)]);
665 [conjugate(atan(z)), atan(1/2-%i), atan(-1/3-%i)]$
667 conjugate([x,%i*x,0,1,-1,%i,-%i,%pi, %e, %phi,inf,minf]);
668 [x,-(%i*x),0,1,-1,-%i,%i,%pi,%e,%phi,inf,minf]$
673 conjugate(cos(exp(107)));
676 conjugate(conjugate(log(-1)));
679 conjugate(polarform(5+%i*7)) - polarform(5-%i*7);
683 conjugate(z)/conjugate(zz)$
685 (declare(nn,integer),0);
691 (forget(nn,integer),0);
697 conjugate(realpart(z));
700 conjugate(imagpart(z));
703 conjugate(conjugate(z));
709 conjugate(z*zz) - conjugate(z)*conjugate(zz);
721 (assume(notequal(imagpart(z),0)),0);
728 conjugate(z)^conjugate(zz)$
730 (forget(-1<a,a<1, notequal(b,0)), remove(z,complex), remove(zz,complex), 0);
733 /* #2179 conjugate of CRE matrix */
734 conjugate(matrix([rat(0)]));
737 /* #1982 conjugate(atan(x+%i*y)) wrong */
738 conjugate(atan(x+%i*y));
739 conjugate(atan(x+%i*y))$
741 /* #1801 conjugate(atan2(y,x)) not simplified */
742 conjugate(atan2(y,x));
745 /* #1211 conjugate error */
746 conjugate( atanh(1/4));
749 /* #1080 conjugate(log(-1 + %i * y)), with y # 0 */
750 (assume(notequal(y,0)),0);
753 conjugate(log(-1 + %i*y));
756 (forget(notequal(y,0)),0);
759 /* #1067 absolute value of conjugate */
763 /* #616 conjugate(complex) wrong */
767 /* #924 conjugate of subscripted function */
771 /* #932 conjugate of complex ^ complex */
772 conjugate((1+%i)^%i);
775 /* 1071 conjugate & ratsubst */
776 ratsubst(1,a, conjugate(log(-1 + %i*a)));
779 /* #1163 rational doesn't work */
780 conjugate( rat(1+%i));
783 /* conjugate of derivative */
785 conjugate(diff(f(x),x));
786 'diff(conjugate(f(x)),x);
788 conjugate(diff(f(x),x,107));
789 'diff(conjugate(f(x)),x,107);
791 conjugate(diff(f(x),x,n));
792 'diff(conjugate(f(x)),x,n);
794 op(conjugate(diff(f(x),x,%i)));
797 (declare(z,complex),0);
800 op(conjugate(diff(f(z),z)));
803 (remove(z,complex), conjugate(z));
809 /* did we really tidy the environment? */