Skip to content

Commit

Permalink
Trac #20098: doctest fix for: Re/Im(tanh) wrong formula
Browse files Browse the repository at this point in the history
In analogy to #19791:
{{{
sage: tanh(1+2*I).n()
1.16673625724092 - 0.243458201185725*I
sage: tanh(1+2*I).real().n()
0.202053272732553
sage: tanh(1+2*I).imag().n()
-0.579697798322816
sage: tanh(x).real()
tanh(real_part(x))/(tan(imag_part(x))^2*tanh(real_part(x))^2 + 1)
sage: tanh(x).imag()
tan(imag_part(x))/(tan(imag_part(x))^2*tanh(real_part(x))^2 + 1)
}}}
See for example http://dlmf.nist.gov/4.35.E36

Will be fixed in Pynac-0.6.3 and should be doctested here.

URL: http://trac.sagemath.org/20098
Reported by: rws
Ticket author(s): Ralf Stephan
Reviewer(s): Marc Mezzarobba
  • Loading branch information
Release Manager authored and vbraun committed Mar 27, 2016
2 parents 807846b + 9eafdee commit 0fd2759
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/sage/functions/hyperbolic.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,19 @@ def __init__(self):
sage: latex(tanh(x))
\tanh\left(x\right)
Check that real/imaginary parts are correct (:trac:`20098`)::
sage: tanh(1+2*I).n()
1.16673625724092 - 0.243458201185725*I
sage: tanh(1+2*I).real().n()
1.16673625724092
sage: tanh(1+2*I).imag().n()
-0.243458201185725
sage: tanh(x).real()
sinh(2*real_part(x))/(cos(2*imag_part(x)) + cosh(2*real_part(x)))
sage: tanh(x).imag()
sin(2*imag_part(x))/(cos(2*imag_part(x)) + cosh(2*real_part(x)))
"""
GinacFunction.__init__(self, "tanh", latex_name=r"\tanh")

Expand Down

0 comments on commit 0fd2759

Please sign in to comment.