• what is the correct anti-derivative for 2*cot(2*x) ?

    From Nasser M. Abbasi@21:1/5 to All on Mon Mar 18 14:36:36 2024
    For int(2*cot(2*x),x)

    Maple 2024: -1/2*ln(cot(2*x)^2+1)
    MMA 14 : ln(sin(2*x))
    Fricas : 1/2*ln( (1-cos(4*x))/2)
    giac: log(abs(sin(2*x)))
    maxima: ln(sin(2*x))
    sympy: ln(sin(2*x))

    The plot of these over say x=-4*Pi..4*Pi is not the same.

    Maple and Fricas give same plot. But Mathematica gives
    differet plot. There are gaps in the plot of ln(sin(2*x))
    compared to Maple's and Fricas version.

    When differentiating these, I get back the integrand. So
    they are all correct in this sense.

    This PDF file has the code and the plots.

    <https://12000.org/tmp/03182024/different_anti.pdf>

    Any comment on which is the better anti-derivative here?

    --Nasser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From nobody@nowhere.invalid@21:1/5 to Nasser M. Abbasi on Sat Mar 23 10:09:53 2024
    "Nasser M. Abbasi" schrieb:

    For int(2*cot(2*x),x)

    Maple 2024: -1/2*ln(cot(2*x)^2+1)
    MMA 14 : ln(sin(2*x))
    Fricas : 1/2*ln( (1-cos(4*x))/2)
    giac: log(abs(sin(2*x)))
    maxima: ln(sin(2*x))
    sympy: ln(sin(2*x))

    The plot of these over say x=-4*Pi..4*Pi is not the same.

    Maple and Fricas give same plot. But Mathematica gives
    differet plot. There are gaps in the plot of ln(sin(2*x))
    compared to Maple's and Fricas version.

    When differentiating these, I get back the integrand. So
    they are all correct in this sense.

    This PDF file has the code and the plots.

    <https://12000.org/tmp/03182024/different_anti.pdf>

    Any comment on which is the better anti-derivative here?


    Derive 6.10 returns LN(SIN(2*x)), like MMA 14, Maxima, and SymPy do.
    Along the real axis, the imaginary part of this antiderivative jumps
    between zero and pi at each 1/x type pole of the integrand. This is
    entirely acceptable in my view.

    Maple's -1/2*ln(cot(2*x)^2+1) avoids the jumps on the real axis by
    effectively squaring the logarithmic argument. This is nice, but
    definite integrals that straddle one of the poles are still meaningless
    of course.

    The reciprocal of Maple's logarithmic argument is used in the FriCAS
    result 1/2*ln((1-cos(4*x))/2), where the trigonometric argument is
    doubled rather than the trigonometric function squared. This is just an equivalent formulation of the Maple antiderivative.

    Giac's log(abs(sin(2*x))) needlessly introduces the abs() function
    which is not analytic. This should be avoided when the integrand itself
    is analytic, as the antiderivative then will not be valid everywhere
    on the complex plane. I would prefer it to be avoided even if the
    integration variable had been declared real, but others may prefer that
    their students not be exposed to an incomprehensible complex unit.

    So, all of the results are good in my view, with the exception of that
    by Giac.

    Martin.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)