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));
646 /* #4373 conjugate doesn't know li[n](x) is complex in general */
647 block([w : conjugate(li[2](z))], [inpart(w,0), args(w)]);
648 [conjugate,[li[2](z)]]$
650 conjugate(psi[2](z));
651 psi[2](conjugate(z))$
653 map('conjugate, [plog(5+%i), plog(x^2+1), plog(z), plog(-(x^2+1))]);
654 [plog(5-%i),plog(x^2+1),conjugate(plog(z)),plog(x^2+1)-%i*%pi]$
656 /* off (-infinity,-1) union (1,infinity), conjugate and asin commute */
657 map('conjugate,[asin(z), asin(a+%i*b), asin(1/2+%i), asin(107+%i*b),asin(107)]);
658 [conjugate(asin(z)), asin(a-%i*b), asin(1/2-%i), asin(107-%i*b), conjugate(asin(107))]$
660 /* off (-infinity,-1) union (1,infinity), conjugate and acos commute */
661 map('conjugate,[acos(z), acos(a+%i*b), acos(1/2+%i), acos(107+%i*b),acos(107)]);
662 [conjugate(acos(z)), acos(a-%i*b), acos(1/2-%i), acos(107-%i*b), conjugate(acos(107))]$
664 /* off (-infinity %i, -%i) union (%i, %i infinity), conjugate and atan commute */
665 map('conjugate, [atan(z), atan(1/2 + %i), atan(-1/3+%i)]);
666 [conjugate(atan(z)), atan(1/2-%i), atan(-1/3-%i)]$
668 conjugate([x,%i*x,0,1,-1,%i,-%i,%pi, %e, %phi,inf,minf]);
669 [x,-(%i*x),0,1,-1,-%i,%i,%pi,%e,%phi,inf,minf]$
674 conjugate(cos(exp(107)));
677 conjugate(conjugate(log(-1)));
680 conjugate(polarform(5+%i*7)) - polarform(5-%i*7);
684 conjugate(z)/conjugate(zz)$
686 (declare(nn,integer),0);
692 (forget(nn,integer),0);
698 conjugate(realpart(z));
701 conjugate(imagpart(z));
704 conjugate(conjugate(z));
710 conjugate(z*zz) - conjugate(z)*conjugate(zz);
722 (assume(notequal(imagpart(z),0)),0);
729 conjugate(z)^conjugate(zz)$
731 (forget(-1<a,a<1, notequal(b,0)), remove(z,complex), remove(zz,complex), 0);
734 /* #2179 conjugate of CRE matrix */
735 conjugate(matrix([rat(0)]));
738 /* #1982 conjugate(atan(x+%i*y)) wrong */
739 conjugate(atan(x+%i*y));
740 conjugate(atan(x+%i*y))$
742 /* #1801 conjugate(atan2(y,x)) not simplified */
743 conjugate(atan2(y,x));
746 /* #1211 conjugate error */
747 conjugate( atanh(1/4));
750 /* #1080 conjugate(log(-1 + %i * y)), with y # 0 */
751 (assume(notequal(y,0)),0);
754 conjugate(log(-1 + %i*y));
757 (forget(notequal(y,0)),0);
760 /* #1067 absolute value of conjugate */
764 /* #616 conjugate(complex) wrong */
768 /* #924 conjugate of subscripted function */
772 /* #932 conjugate of complex ^ complex */
773 conjugate((1+%i)^%i);
776 /* 1071 conjugate & ratsubst */
777 ratsubst(1,a, conjugate(log(-1 + %i*a)));
780 /* #1163 rational doesn't work */
781 conjugate( rat(1+%i));
784 /* conjugate of derivative */
786 conjugate(diff(f(x),x));
787 'diff(conjugate(f(x)),x);
789 conjugate(diff(f(x),x,107));
790 'diff(conjugate(f(x)),x,107);
792 conjugate(diff(f(x),x,n));
793 'diff(conjugate(f(x)),x,n);
795 op(conjugate(diff(f(x),x,%i)));
798 (declare(z,complex),0);
801 op(conjugate(diff(f(z),z)));
804 (remove(z,complex), conjugate(z));
807 /* More conjugate of li; see #4373 conjugate doesn't know li[n](x) is complex in general */
808 (declare(n,integer), assume(n > 0), assume(xx < 1),0);
811 conjugate(li[n](2/3));
814 conjugate(li[2](2/3));
817 conjugate(li[n](2/3));
820 conjugate(li[n](xx));
823 conjugate(li[n](x+%i));
826 conjugate(li[3](x+%i));
829 (declare(z,complex),0);
832 tex1(conjugate(z + F(z)));
833 "F\\left(z\\right)^{\\ast}+z^{\\ast}"$
835 block([xxx : conjugate(sum(f(x),x,%i,inf))], [op(xxx), args(first(xxx))]);
836 [conjugate,[f(x),x,%i,inf]]$
838 block([xxx : conjugate(product(f(x),x,%i,inf))], [op(xxx), args(first(xxx))]);
839 [conjugate,[f(x),x,%i,inf]]$
841 block([xxx : conjugate(atanh(s))], [op(xxx), args(xxx)]);
842 [conjugate, [atanh(s)]]$
844 (forget(z,complex), forget(n,integer), forget(n > 0),forget(xx < 1),0);
850 /* did we really tidy the environment? */