Skip to content

Commit

Permalink
Merge pull request #1536 from mathics/add-GudermannianRules
Browse files Browse the repository at this point in the history
Add GudermannianRules
  • Loading branch information
rocky authored Aug 9, 2021
2 parents dd5d666 + a692711 commit af36515
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ CHANGES
New builtins
++++++++++++

* ``Guidermannian``

Tensor functions:

* ``RotationTransform``
Expand Down
16 changes: 16 additions & 0 deletions mathics/autoload/rules/GudermannianRules.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Begin["System`"]
Gudermannian[Undefined]=Undefined;
Gudermannian[0]=0;
Gudermannian[2*Pi*I]=0;
Gudermannian[6/4*Pi*I]=DirectedInfinity[-I];
Gudermannian[Infinity]=Pi/2;
Gudermannian[-Infinity]=-Pi/2;
Gudermannian[ComplexInfinity]=Indeterminate;
Gudermannian[z_]=2 ArcTan[Tanh[z / 2]];
(*
Gudermannian[z_] := Piecewise[{{1/2*[Pi - 4*ArcCot[E^z]], Re[z]>0||(Re[z]==0&&Im[z]>=0 )}}, 1/2 (-Pi + 4 ArcTan[E^z])];
D[Gudermannian[f_],x_?NotListQ] := Sech[f] D[f,x];
Derivative[1][InverseGudermannian] := Sec[#] &;
Derivative[1][Gudermannian] := Sech[#] &;
*)
End[]
17 changes: 17 additions & 0 deletions test/test_gudermannian.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
"""
Unit tests from autoload/GudermannianRules.m
"""

from .helper import check_evaluation


def test_gudermannian():
for str_expr, str_expected, message in (
(
"Gudermannian[4.2]",
"1.54081",
"https://reference.wolfram.com/language/ref/Gudermannian.html",
),
):
check_evaluation(str_expr, str_expected, message)

0 comments on commit af36515

Please sign in to comment.