Introduction to the Hyperbolic Secant Function in Mathematica
Overview
The following shows how the hyperbolic secant function is realized in Mathematica. Examples of evaluating Mathematica functions applied to various numeric and exact expressions that involve the hyperbolic secant function or return it are shown. These involve numeric and symbolic calculations and plots.
Notations
Mathematica forms of notations
Following Mathematica's general naming convention, function names in StandardForm are just the capitalized versions of their traditional mathematics names. This shows the hyperbolic secant function in StandardForm.
This shows the hyperbolic secant function in TraditionalForm.
Additional forms of notations
Mathematica also knows the most popular forms of notations for the hyperbolic secant function that are used in other programming languages. Here are three examples: CForm, TeXForm, and FortranForm.
Automatic evaluations and transformations
Evaluation for exact and machinenumber values of arguments
For the exact argument , Mathematica returns an exact result.
For a machine‐number argument (numerical argument with a decimal point), a machine number is also returned.
The next inputs calculate 100‐digit approximations at and .
It is possible to calculate thousands of digits for the hyperbolic secant function in less than a second. The next input calculates 10000 digits for and analyzes the frequency of the digit in the resulting decimal number.
Here is a 50‐digit approximation to the hyperbolic secant function at the complex argument .
Mathematica automatically evaluates mathematical functions with machine precision, if the arguments of the function are numerical values and include machine‐number elements. In this case, only six digits after the decimal point are shown in the results. The remaining digits are suppressed, but can be displayed using the function InputForm.
Simplification of the argument
Mathematica knows the symmetry and periodicity of the hyperbolic secant function. Here are some examples.
Mathematica automatically simplifies the composition of the direct and the inverse hyperbolic secant functions to the inner argument.
Mathematica also automatically simplifies the composition of the direct and any of the inverse hyperbolic functions into algebraic functions of the argument.
In cases where the argument has the structure or , and or with integer , the hyperbolic secant function can be automatically transformed into hyperbolic or trigonometric secant or cosecant functions.
Simplification of combination of hyperbolic secant functions
Sometimes simple arithmetic operations containing the hyperbolic secant function can automatically generate other equal hyperbolic functions.
The hyperbolic secant function arising as special cases from more general functions
The hyperbolic secant function can be treated as a particular case of other, more general special functions. For example, appears automatically from Bessel, Struve, Mathieu, Jacobi, hypergeometric, and Meijer functions or their reciprocals for appropriate parameters.
Equivalence transformations using specialized Mathematica functions
General remarks
Almost everybody prefers using instead of . Mathematica automatically transforms the second expression into the first one. The automatic application of transformation rules to mathematical expressions can give overly complicated results. Compact expressions like should not be automatically expanded into the more complicated expression . Mathematica has special functions that produce such expansions. Some are demonstrated in the next section.
TrigExpand
The function TrigExpand expands out trigonometric and hyperbolic functions. In more detail, it splits up sums and integer multiples that appear in the arguments of trigonometric and hyperbolic functions, and then expands out products of the trigonometric and hyperbolic functions into sums of powers, using trigonometric and hyperbolic identities where possible. Here are some examples.
TrigFactor
The function TrigFactor factors trigonometric and hyperbolic functions. In more detail, it splits up sums and integer multiples that appear in the arguments of trigonometric and hyperbolic functions, and then factors the resulting polynomials into trigonometric and hyperbolic functions, using trigonometric and hyperbolic identities where possible. Here are some examples.
TrigReduce
The function TrigReduce rewrites the products and powers of trigonometric and hyperbolic functions in terms of trigonometric and hyperbolic functions with combined arguments. In more detail, it typically yields a linear expression involving trigonometric and hyperbolic functions with more complicated arguments. TrigReduce is approximately opposite to TrigExpand and TrigFactor. Here are some examples.
TrigToExp
The function TrigToExp converts trigonometric and hyperbolic functions to exponentials. It tries, where possible, to give results that do not involve explicit complex numbers. Here are some examples.
ExpToTrig
The function ExpToTrig converts exponentials to trigonometric and hyperbolic functions. It is approximately opposite to TrigToExp. Here are some examples.
ComplexExpand
The function ComplexExpand expands expressions assuming that all the variables are real. The option TargetFunctions can be given as a list of functions from the set {Re, Im, Abs, Arg, Conjugate, Sign}. ComplexExpand will try to give results in terms of the functions specified. Here are some examples.
Simplify
The function Simplify performs a sequence of algebraic transformations on the expression, and returns the simplest form it finds. Here are some examples.
Here is a collection of hyperbolic identities. Each is written as a logical conjunction.
The command Simplify has the Assumption option. For example, Mathematica recognizes the periodicity of the hyperbolic function for the symbolic integer coefficient of .
Mathematica also knows that the composition of inverse and direct hyperbolic functions produces the value of the internal argument under the corresponding restriction.
FunctionExpand (and Together)
While the hyperbolic secant function auto‐evaluates for simple fractions of , for more complicated cases it stays as a hyperbolic secant function to avoid the build up of large expressions. Using the function FunctionExpand, the hyperbolic secant function can sometimes be transformed into explicit radicals. Here are some examples.
If the denominator contains squares of integers other than 2, the results always contain complex numbers deeply inside of the expression (meaning that the imaginary number appears unavoidably).
The function RootReduce allows for writing the previous algebraic numbers as the roots of polynomial equations.
The function FunctionExpand also reduces hyperbolic expressions with compound arguments or compositions, including hyperbolic functions, to simpler ones. Here are some examples.
Applying Simplify to the previous expression gives a more compact result.
FullSimplify
The function FullSimplify tries a wider range of transformations than Simplify and returns the simplest form it finds. Here are some examples that compare the results of applying these functions to the same expressions.
Operations under special Mathematica functions Series expansions Calculating the series expansion of a hyperbolic secant function to hundreds of terms can be done in seconds. Mathematica comes with the add‐on package DiscreteMath`RSolve` that allows finding the general terms of series for many functions. After loading this package, and using the package function SeriesTerm, the following term of can be evaluated. Here is a quick check of the last result. This series should be evaluated to , which can be concluded from the following relation. Differentiation Mathematica can evaluate derivatives of the hyperbolic secant function of an arbitrary positive integer order. Indefinite integration Mathematica can calculate a huge set of doable indefinite integrals that contain the hyperbolic secant function. The results can contain special functions. Here are some examples. Definite integration Mathematica can calculate wide classes of definite integrals that contain the hyperbolic secant function. Here are some examples. Limit operation Mathematica can calculate limits that contain the hyperbolic secant function. Here are some examples. Solving equations The next inputs solve two equations that contain the hyperbolic secant function. Because of the multivalued nature of the inverse hyperbolic secant function, a message is printed indicating that only some of the possible solutions are returned. A complete solution of the previous equation can be obtained using the function Reduce. Solving differential equations Here is a linear firstorder differential equation that is obeyed by the hyperbolic secant function. Here is a nonlinear secondorder differential equation that is obeyed by the hyperbolic secant function. Mathematica solves the differential equation as a rational function of . But it is straightforward to show that a hyperbolic secant function is also a solution. Plotting Mathematica has built‐in functions for 2D and 3D graphics. Here are some examples.
