Menu ▾ ▴

#5702 carg() of tan() or tanh() of a complex number is off by %pi when the real part of the result is negative

None
duplicate
nobody
5
5 hours ago
5 hours ago
No

By Claude:

The same code makes cabs and carg divide by zero where the real part of the result is zero, as for tan(log(%i)), whose value is %i*tanh(%pi/2):

(%i1) display2d : false$
(%i2) cabs(tan(log(%i)));
expt: undefined: 0 to a negative exponent.
(%i3) carg(tan(log(%i)));
expt: undefined: 0 to a negative exponent.
(%i4) float(tan(log(%i)));
(%o4) 0.9171523356672743*%i

cot and coth have the same wrong argument, and so do rectform of log and of powers such as tan(z)^(1/3), which use it. The imaginary part of log(tanh(-1 + %i)) is off by %pi, and the cube of the cube root of tan(-1 + %i) is -tan(-1 + %i):

(%i5) float(rectform(log(tanh(-1 + %i))));
(%o5) 0.11106722003707165-0.24564866849382744*%i
(%i6) log(float(tanh(-1 + %i)));
(%o6) 2.8959439850959656*%i+0.11106722003707165
(%i7) float(rectform(tan(-1 + %i)^(1/3)))^3, rectform;
(%o7) 0.2717525853195117-1.0839233273386943*%i
(%i8) float(rectform(tan(-1 + %i)));
(%o8) 1.0839233273386946*%i-0.27175258531951174

Discussion

  • David Scherfgen

    David Scherfgen - 5 hours ago
    • status: open --> duplicate
     
  • David Scherfgen

    David Scherfgen - 5 hours ago

    This was already reported as bug #5078.

     

Log in to post a comment.