Introductions to Tan

Introduction to the trigonometric functions

General

The six trigonometric functions sine sin(z), cosine cos(z), tangent tan(z), cotangent cot(z), cosecant csc(z), and secant sec(z) are well known and among the most frequently used elementary functions. The most popular functions sin(z), cos(z), tan(z), and cot(z) are taught worldwide in high school programs because of their natural appearance in problems involving angle measurement and their wide applications in the quantitative sciences.

The trigonometric functions share many common properties.

Definitions of trigonometric functions

All trigonometric functions can be defined as simple rational functions of the exponential function of i z:

The functions tan(z), cot(z), csc(z), and sec(z) can also be defined through the functions sin(z) and cos(z) using the following formulas:

A quick look at the trigonometric functions

Here is a quick look at the graphics for the six trigonometric functions along the real axis.

Connections within the group of trigonometric functions and with other function groups

Representations through more general functions

The trigonometric functions are particular cases of more general functions. Among these more general functions, four different classes of special functions are particularly relevant: Bessel, Jacobi, Mathieu, and hypergeometric functions.

For example, sin(z) and cos(z) have the following representations through Bessel, Mathieu, and hypergeometric functions:

On the other hand, all trigonometric functions can be represented as degenerate cases of the corresponding doubly periodic Jacobi elliptic functions when their second parameter is equal to 0 or 1:

Representations through related equivalent functions

Each of the six trigonometric functions can be represented through the corresponding hyperbolic function:

Relations to inverse functions

Each of the six trigonometric functions is connected with its corresponding inverse trigonometric function by two formulas. One is a simple formula, and the other is much more complicated because of the multivalued nature of the inverse function:

Representations through other trigonometric functions

Each of the six trigonometric functions can be represented by any other trigonometric function as a rational function of that function with linear arguments. For example, the sine function can be representative as a group-defining function because the other five functions can be expressed as follows:

All six trigonometric functions can be transformed into any other trigonometric function of this group if the argument z is replaced by p π/2 +q z with (q^2)==1∧p∈ℤ:

The best-known properties and formulas for trigonometric functions

Real values for real arguments

For real values of argument z, the values of all the trigonometric functions are real (or infinity).

In the points z=2π n/m/;n∈ℤ∧m∈ℤ, the values of trigonometric functions are algebraic. In several cases they can even be rational numbers or integers (like sin(π/2)=1 or sin(π/6)=1/2). The values of trigonometric functions can be expressed using only square roots if n∈ℤ and m is a product of a power of 2 and distinct Fermat primes {3, 5, 17, 257, …}.

Simple values at zero

All trigonometric functions have rather simple values for arguments z==0 and z==π/2:

Analyticity

All trigonometric functions are defined for all complex values of z, and they are analytical functions of z over the whole complex z-plane and do not have branch cuts or branch points. The two functions sin(z) and cos(z) are entire functions with an essential singular point at z = (OverTilde[∞]). All other trigonometric functions are meromorphic functions with simple poles at points z==π k/;k∈ℤ for csc(z) and cot(z), and at points z==π/2+π k/;k∈ℤ for sec(z) and tan(z).

Periodicity

All trigonometric functions are periodic functions with a real period (2π or π):

Parity and symmetry

All trigonometric functions have parity (either odd or even) and mirror symmetry:

Simple representations of derivatives

The derivatives of all trigonometric functions have simple representations that can be expressed through other trigonometric functions:

Simple differential equations

The solutions of the simplest second-order linear ordinary differential equation with constant coefficients can be represented through sin(z) and cos(z):

All six trigonometric functions satisfy first-order nonlinear differential equations:

Applications of trigonometric functions

Triangle theorems

The prime application of the trigonometric functions are triangle theorems. In a triangle, a, b, and c represent the lengths of the sides opposite to the angles, Δ the area , R the circumradius, and r the inradius. Then the following identities hold:

For a right-angle triangle the following relations hold:

Other applications

Because the trigonometric functions appear virtually everywhere in quantitative sciences, it is impossible to list their numerous applications in teaching, science, engineering, and art.

Introduction to the Tangent Function

Defining the tangent function

The tangent function is an old mathematical function. It was mentioned in 1583 by T. Fincke who introduced the word "tangens" in Latin. E. Gunter (1624) used the notation "tan", and J. H. Lambert (1770) discovered the continued fraction representation of this function.

The classical definition of the tangent function for real arguments is: "the tangent of an angle α in a right-angle triangle is the ratio of the length of the opposite leg to the length of the adjacent leg." This description of tan(α) is valid for 0<α<π/2 when the triangle is nondegenerate. This approach to the tangent can be expanded to arbitrary real values of α if consideration is given to the arbitrary point {x,y} in the x,y-Cartesian plane and tan(α) is defined as the ratio y/x, assuming that α is the value of the angle between the positive direction of the x-axis and the direction from the origin to the point {x,y}.

Comparing this definition with definitions of the sine and cosine functions shows that the following formula can also be used as a definition of the tangent function:

A quick look at the tangent function

Here is a graphic of the tangent function f(x)=tan(x) for real values of its argument x.

Representation through more general functions

The tangent function tan(z) can be represented using more general mathematical functions. As the ratio of the sine and cosine functions that are particular cases of the generalized hypergeometric, Bessel, Struve, and Mathieu functions, the tangent function can also be represented as ratios of those special functions. But these representations are not very useful. It is more useful to write the tangent function as particular cases of one special function. That can be done using doubly periodic Jacobi elliptic functions that degenerate into the tangent function when their second parameter is equal to 0 or 1:

Definition of the tangent function for a complex argument

In the complex z-plane, the function tan(z) is defined using sin(z) and cos(z) or the exponential function (e^w) in the points i z and -i z through the formula:

In the points z==π/2+π k/;k∈ℤ, where cos(z) has zeros, the denominator of the last formula equals zero and tan(z) has singularities (poles of the first order).

Here are two graphics showing the real and imaginary parts of the tangent function over the complex plane.

The best-known properties and formulas for the tangent function

Values in points

Students usually learn the following basic table of tangent function values for special points of the circle:

General characteristics

For real values of argument z, the values of tan(z) are real.

In the points z=π n/m/;n∈ℤ∧m∈ℤ, the values of tan(z) are algebraic. In several cases they can be integers -1, 0, or 1:

The values of tan(((n π)/m)) can be expressed using only square roots if n∈ℤ and m is a product of a power of 2 and distinct Fermat primes {3, 5, 17, 257, …}.

The function tan(z) is an analytical function of z that is defined over the whole complex z-plane and does not have branch cuts and branch points. It has an infinite set of singular points:

(a) z==π/2+π k/;k∈ℤ are the simple poles with residues –1.
(b) z== (OverTilde[∞]) is an essential singular point.

It is a periodic function with the real period π:

The function tan(z) is an odd function with mirror symmetry:

Differentiation

The first derivative of tan(z) has simple representations using either the cos(z) function or the sec(z) function:

The n(^th) derivative of tan(z) has much more complicated representations than symbolic n(^th) derivatives for sin(z) and cos(z):

where (Subscript[δ, n]) is the Kronecker delta symbol: (Subscript[δ, 0])==1 and (Subscript[δ, n])==0/;n≠0.

Ordinary differential equation

The function tan(z) satisfies the following first-order nonlinear differential equation:

Series representation

The function tan(z) has a simple series expansion at the origin that converges for all finite values z with |z|<(π/2):

where (Subscript[B, 2 k]) are the Bernoulli numbers.

Integral representation

The function tan(z) has a well-known integral representation through the following definite integral along the positive part of the real axis:

Continued fraction representations

The function tan(z) has the following simple continued fraction representations:

Indefinite integration

Indefinite integrals of expressions involving the tangent function can sometimes be expressed using elementary functions. However, special functions are frequently needed to express the results even when the integrands have a simple form (if they can be evaluated in closed form). Here are some examples:

Definite integration

Definite integrals that contain the tangent function are sometimes simple. For example, the famous Catalan constant C can be defined as the value of the following integral:

This constant also appears in the following integral:

Some special functions can be used to evaluate more complicated definite integrals. For example, the generalized hypergeometric and polygamma functions are needed to express the following integral:

Finite summation

The following finite sums that contain the tangent function can be expressed using cotangent functions:

Other finite sums that contain the tangent function can be expressed using polynomial functions:

Infinite summation

The evaluation limit of the first formula from the previous subsubsection for n->∞ gives the following value for the corresponding infinite sum from the tangent:

Other infinite sums that contain the tangent can also be expressed using elementary functions:

Finite products

The following finite product from the tangent has a very simple value:

Addition formulas

The tangent of a sum can be represented by the rule: "the tangent of a sum is equal to the sum of tangents divided by one minus the product of tangents." A similar rule is valid for the tangent of the difference:

Multiple arguments

In the case of multiple arguments z, 2z, 3z, …, the function tan(z) can be represented as the ratio of the finite sums including powers of tangents:

Half-angle formulas

The tangent of the half-angle can be represented using two trigonometric functions by the following simple formulas:

The sine function in the last formula can be replaced by the cosine function. But it leads to a more complicated representation that is valid in some vertical strips:

To make this formula correct for all complex z, a complicated prefactor is needed:

where c(z) contains the unit step, real part, imaginary part, the floor, and the round functions.

Sums of two direct functions

The sum of two tangent functions can be described by the rule: "the sum of tangents is equal to the sine of the sum multiplied by the secants." A similar rule is valid for the difference of two tangents:

Products involving the direct function

The product of two tangent functions and the product of the tangent and cotangent have the following representations:

Inequalities

The most famous inequality for the tangent function is the following:

Relations with its inverse function

There are simple relations between the function tan(z) and its inverse function (tan^(-1))(z):

The second formula is valid at least in the vertical strip -(π/2)<Re(z)<(π/2). Outside of this strip a much more complicated relation (that contain the unit step, real part, and the floor functions) holds:

Representations through other trigonometric functions

Tangent and cotangent functions are connected by a very simple formula that contains the linear function in the argument:

The tangent function can also be represented using other trigonometric functions by the following formulas:

Representations through hyperbolic functions

The tangent function has representations using the hyperbolic functions:

Applications

The tangent function is used throughout mathematics, the exact sciences, and engineering.

Introduction to the Trigonometric Functions in Mathematica

Overview

The following shows how the six trigonometric functions are realized in Mathematica. Examples of evaluating Mathematica functions applied to various numeric and exact expressions that involve the trigonometric functions or return them are shown. These involve numeric and symbolic calculations and plots.

Notations

Mathematica forms of notations

All six trigonometric functions are represented as built-in functions in Mathematica. Following Mathematica's general naming convention, the StandardForm function names are simply capitalized versions of the traditional mathematics names. Here is a list trigFunctions of the six trigonometric functions in StandardForm.

trigFunctions={Sin[z],Cos[z],Tan[z],Cot[z],Sec[z],Cos[z]}

Here is a list trigFunctions of the six trigonometric functions in TraditionalForm.

trigFunctions//TraditionalForm

Additional forms of notations

Mathematica also knows the most popular forms of notations for the trigonometric functions that are used in other programming languages. Here are three examples: CForm, TeXForm, and FortranForm.

trigFunctions/.{z->2π z}//(CForm /@ #)&

trigFunctions/.{z->2π z}//(TeXForm /@ #)&

trigFunctions/.{z->2π z}//(FortranForm /@ #)&

Automatic evaluations and transformations

Evaluation for exact, machine-number, and high-precision arguments

For a simple exact argument, Mathematica returns exact results. For instance, for the argument π/6, the Sin function evaluates to 1/2.

Sin[(π/6)]

{Sin[z],Cos[z],Tan[z],Cot[z],Csc[z],Sec[z]}/.z->(π/6)

For a generic machine-number argument (a numerical argument with a decimal point and not too many digits), a machine number is returned.

Cos[3.]

{Sin[z],Cos[z],Tan[z],Cot[z],Csc[z],Sec[z]}/.z->2.

The next inputs calculate 100-digit approximations of the six trigonometric functions at z=1.

N[Tan[1],40]

Cot[1]//N[#,50]&

N[{Sin[z],Cos[z],Tan[z],Cot[z],Csc[z],Sec[z]}/.z->1,100]

Within a second, it is possible to calculate thousands of digits for the trigonometric functions. The next input calculates 10000 digits for sin(1), cos(1), tan(1), cot(1), sec(1), and csc(1) and analyzes the frequency of the occurrence of the digit k in the resulting decimal number.

Map[Function[w, {First[#],Length[#]}&/@Split[Sort[First[RealDigits[w]]]]], N[{Sin[z],Cos[z],Tan[z],Cot[z],Csc[z],Sec[z]}/.z->1,10000]]

Here are 50-digit approximations to the six trigonometric functions at the complex argument z=3+5i.

N[Csc[3+5I],100]

N[{Sin[z],Cos[z],Tan[z],Cot[z],Csc[z],Sec[z]}/.z->3+5I,50]

Mathematica always evaluates mathematical functions with machine precision, if the arguments are machine numbers. 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.

{Sin[2.],N[Sin[2]],N[Sin[2],16],N[Sin[2],5],N[Sin[2],20]}

%//InputForm

Precision[%%]

Simplification of the argument

Mathematica uses symmetries and periodicities of all the trigonometric functions to simplify expressions. Here are some examples.

Sin[-z]

Sin[z+π]

Sin[z+2π]

Sin[z+34π]

{Sin[-z],Cos[-z],Tan[-z],Cot[-z],Csc[-z],Sec[-z]}

{Sin[z+π],Cos[z+π],Tan[z+π],Cot[z+π],Csc[z+π],Sec[z+π]}

{Sin[z+2π],Cos[z+2π],Tan[z+2π],Cot[z+2π],Csc[z+2π],Sec[z+2π]}

{Sin[z+342π],Cos[z+342π],Tan[z+342π],Cot[z+342π],Csc[z+342π],Sec[z+342π]}

Mathematica automatically simplifies the composition of the direct and the inverse trigonometric functions into the argument.

{Sin[ArcSin[z]],Cos[ArcCos[z]],Tan[ArcTan[z]],Cot[ArcCot[z]],Csc[ArcCsc[z]],Sec[ArcSec[z]]}

Mathematica also automatically simplifies the composition of the direct and any of the inverse trigonometric functions into algebraic functions of the argument.

{Sin[ArcSin[z]],Sin[ArcCos[z]],Sin[ArcTan[z]], Sin[ArcCot[z]],Sin[ArcCsc[z]], Sin[ArcSec[z]]}

{Cos[ArcSin[z]],Cos[ArcCos[z]],Cos[ArcTan[z]], Cos[ArcCot[z]],Cos[ArcCsc[z]], Cos[ArcSec[z]]}

{Tan[ArcSin[z]],Tan[ArcCos[z]],Tan[ArcTan[z]], Tan[ArcCot[z]],Tan[ArcCsc[z]], Tan[ArcSec[z]]}

{Cot[ArcSin[z]],Cot[ArcCos[z]],Cot[ArcTan[z]], Cot[ArcCot[z]],Cot[ArcCsc[z]], Cot[ArcSec[z]]}

{Csc[ArcSin[z]],Csc[ArcCos[z]],Csc[ArcTan[z]], Csc[ArcCot[z]],Csc[ArcCsc[z]], Csc[ArcSec[z]]}

{Sec[ArcSin[z]],Sec[ArcCos[z]],Sec[ArcTan[z]], Sec[ArcCot[z]],Sec[ArcCsc[z]], Sec[ArcSec[z]]}

In cases where the argument has the structure π k/2+z or π k/2-z, and π k/2+i z or π k/2-i z with integer k, trigonometric functions can be automatically transformed into other trigonometric or hyperbolic functions. Here are some examples.

Tan[(π/2)-z]

Csc[I z]

{Sin[(π/2)-z],Cos[(π/2)-z],Tan[(π/2)-z],Cot[(π/2)-z],Csc[(π/2)-z],Sec[(π/2)-z]}

{Sin[I z],Cos[I z],Tan[I z],Cot[I z],Csc[I z],Sec[I z]}

Simplification of simple expressions containing trigonometric functions

Sometimes simple arithmetic operations containing trigonometric functions can automatically produce other trigonometric functions.

1/Sec[z]

{1/Sin[z],1/Cos[z],1/Tan[z],1/Cot[z],1/Csc[z],1/Sec[z],Sin[z]/Cos[z],Cos[z]/Sin[z],Sin[z]/Sin[π/2-z],Cos[z]/Sin[z]^2}

Trigonometric functions arising as special cases from more general functions

All trigonometric functions can be treated as particular cases of some more advanced special functions. For example, sin(z) and cos(z) are sometimes the results of auto-simplifications from Bessel, Mathieu, Jacobi, hypergeometric, and Meijer functions (for appropriate values of their parameters).

BesselJ[(1/2),z]

MathieuC[1,0,z]

JacobiSC[z,0]

{BesselJ[(1/2),z],MathieuS[1,0,z],JacobiSN[z,0], HypergeometricPFQ[{},{(3/2)},-((z^2)/4)],MeijerG[{{},{}},{{(1/2)},{0}},((z^2)/4)]}

{BesselJ[-(1/2),z],MathieuC[1,0,z],JacobiCD[z,0], Hypergeometric0F1[(1/2),-((z^2)/4)],MeijerG[{{},{}},{{0},{(1/2)}},((z^2)/4)]}

{JacobiSC[z,0],JacobiCS[z,0],JacobiDS[z,0],JacobiDC[z,0]}

Equivalence transformations carried out by specialized Mathematica functions

General remarks

Almost everybody prefers using sin(z)/2 instead of cos(π/2-z)sin(π/6). 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 sin(2z)sin(π/16) should not be automatically expanded into the more complicated expression sin(z)cos(z)(((2-(((2+(2^(1/2))))^(1/2))))^(1/2)). Mathematica has special commands that produce these types of expansions. Some of them 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 the products of the trigonometric and hyperbolic functions into sums of powers, using the trigonometric and hyperbolic identities where possible. Here are some examples.

TrigExpand[Sin[x-y]]

Cos[4z]//TrigExpand

TrigExpand[{{Sin[x+y],Sin[3 z]},
                        {Cos[x+y],Cos[3 z]},
                        {Tan[x+y],Tan[3 z]},
                        {Cot[x+y],Cot[3 z]},
                        {Csc[x+y],Csc[3 z]},
                        {Sec[x+y],Sec[3 z]}}]

TableForm[(#==TrigExpand[#])&/@Flatten[{{Sin[x+y],Sin[3 z]},{Cos[x+y],Cos[3 z]},{Tan[x+y],Tan[3 z]},{Cot[x+y],Cot[3 z]},{Csc[x+y],Csc[3 z]},{Sec[x+y],Sec[3 z]}}]]

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 in the trigonometric and hyperbolic functions, using the corresponding identities where possible. Here are some examples.

TrigFactor[Sin[x]+Cos[y]]

Tan[x]-Cot[y]//TrigFactor

TrigFactor[{Sin[x]+Sin[y],
                       Cos[x]+Cos[y],
                       Tan[x]+Tan[y],
                       Cot[x]+Cot[y],
                       Csc[x]+Csc[y],
                       Sec[x]+Sec[y]}]

TrigReduce

The function TrigReduce rewrites products and powers of trigonometric and hyperbolic functions in terms of those 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 inverse to TrigExpand and TrigFactor. Here are some examples.

TrigReduce[Sin[z]^3]

Sin[x]Cos[y]//TrigReduce

TrigReduce[{Sin[z]^2,Cos[z]^2,Tan[z]^2,Cot[z]^2,Csc[z]^2,Sec[z]^2}]

TrigReduce[TrigExpand[{{Sin[x+y],Sin[3 z],Sin[x]Sin[y]},
                                                {Cos[x+y],Cos[3 z],Cos[x]Cos[y]},
                                                {Tan[x+y],Tan[3 z],Tan[x]Tan[y]},
                                                {Cot[x+y],Cot[3 z],Cot[x]Cot[y]},
                                                {Csc[x+y],Csc[3 z],Csc[x]Csc[y]},
                                                {Sec[x+y],Sec[3 z],Sec[x]Sec[y]}}]]

TrigReduce[TrigFactor[{Sin[x]+Sin[y],Cos[x]+Cos[y],Tan[x]+Tan[y],Cot[x]+Cot[y],Csc[x]+Csc[y],Sec[x]+Sec[y]}]]

TrigToExp

The function TrigToExp converts direct and inverse trigonometric and hyperbolic functions to exponential or logarithmic functions. It tries, where possible, to give results that do not involve explicit complex numbers. Here are some examples.

TrigToExp[Sin[2z]]

Sin[z]Tan[2z]//TrigToExp

TrigToExp[{Sin[z],Cos[z],Tan[z],Cot[z],Csc[z],Sec[z]}]

ExpToTrig

The function ExpToTrig converts exponentials to trigonometric or hyperbolic functions. It tries, where possible, to give results that do not involve explicit complex numbers. It is approximately inverse to TrigToExp. Here are some examples.

ExpToTrig[(E^(I x β))]

(((E^(I x α))-(E^(I x β)))/((E^(I x γ))+(E^(I x δ))))//ExpToTrig

ExpToTrig[TrigToExp[{Sin[z],Cos[z],Tan[z],Cot[z],Csc[z],Sec[z]}]]

ExpToTrig[{α (E^(-I x β))+α (E^(I x β)),α (E^(-I x β))+γ (E^(I x β))}]

ComplexExpand

The function ComplexExpand expands expressions assuming that all the occurring variables are real. The value option TargetFunctions is a list of functions from the set {Re, Im, Abs, Arg, Conjugate, Sign}. ComplexExpand tries to give results in terms of the specified functions. Here are some examples

ComplexExpand[Sin[x+I y]Cos[x-I y]]

Csc[x+I y]Sec[x-I y]//ComplexExpand

li1={Sin[x+I y],Cos[x+I y],Tan[x+I y],Cot[x+I y],Csc[x+I y],Sec[x+I y]}

ComplexExpand[li1]

ComplexExpand[Re[#]&/@li1,TargetFunctions->{Re,Im}]

ComplexExpand[Im[#]&/@li1,TargetFunctions->{Re,Im}]

ComplexExpand[Abs[#]&/@li1,TargetFunctions->{Re,Im}]

%//Simplify[#,{x,y}∈Reals]&

ComplexExpand[Arg[#]&/@li1,TargetFunctions->{Re,Im}]

ComplexExpand[Conjugate[#]&/@li1,TargetFunctions->{Re,Im}]//Simplify

Simplify

The function Simplify performs a sequence of algebraic transformations on its argument, and returns the simplest form it finds. Here are two examples.

Simplify[Sin[2z]/Sin[z]]

Sin[2z]/Cos[z]//Simplify

Here is a large collection of trigonometric identities. All are written as one large logical conjunction.

Simplify[#]&/@(((Cos[z])^2)+((Sin[z])^2)==1∧
((Sin[z])^2)==((1-Cos[2 z])/2)∧((Cos[z])^2)==((1+Cos[2 z])/2)∧
((Tan[z])^2)==((1-Cos[2 z])/(1+Cos[2 z]))∧((Cot[z])^2)==((1+Cos[2 z])/(1-Cos[2 z]))∧
Sin[2z]==2Sin[z]Cos[z]∧Cos[2z]==((Cos[z])^2)-((Sin[z])^2)==2((Cos[z])^2)-1∧
Sin[a+b]==Sin[a]Cos[b]+Cos[a]Sin[b]∧Sin[a-b]==Sin[a]Cos[b]-Cos[a]Sin[b]∧
Cos[a+b]==Cos[a]Cos[b]-Sin[a]Sin[b]∧Cos[a-b]==Cos[a]Cos[b]+Sin[a]Sin[b]∧
Sin[a]+Sin[b]==2Sin[((a+b)/2)]Cos[((a-b)/2)]∧Sin[a]-Sin[b]==2Cos[((a+b)/2)]Sin[((a-b)/2)]∧
Cos[a]+Cos[b]==2Cos[((a+b)/2)]Cos[((a-b)/2)]∧Cos[a]-Cos[b]==2Sin[((a+b)/2)]Sin[((b-a)/2)]∧
Tan[a]+Tan[b]==((Sin[a+b])/(Cos[a]Cos[b]))∧Tan[a]-Tan[b]==((Sin[a-b])/(Cos[a]Cos[b]))∧
A Sin[z]+B Cos[z]==A (Sqrt[1+((B^2)/(A^2))]) Sin[z+ArcTan[(B/A)]]∧
Sin[a]Sin[b]==((Cos[a-b]-Cos[a+b])/2)∧Cos[a]Cos[b]==((Cos[a-b]+Cos[a+b])/2)∧Sin[a]Cos[b]==((Sin[a+b]+Sin[a-b])/2)∧
((Sin[(z/2)])^2)==((1-Cos[z])/2)∧((Cos[(z/2)])^2)==((1+Cos[z])/2)∧
Tan[(z/2)]==((1-Cos[z])/(Sin[z]))==((Sin[z])/(1+Cos[z]))∧Cot[(z/2)]==((Sin[z])/(1-Cos[z]))==((1+Cos[z])/(Sin[z])))

The function Simplify has the Assumption option. For example, Mathematica knows that -1≤sin(x)≤1 for all real x, and uses the periodicity of trigonometric functions for the symbolic integer coefficient k of k π.

Simplify[Abs[Sin[x]]≤1,x∈Reals]

Abs[Sin[x]]≤1//Simplify[#,x∈Reals]&

Simplify[{Sin[z+2 k π],Cos[z+2 k π],Tan[z+k π],Cot[z+k π],Csc[z+2 k π],Sec[z+2 k π]},k∈Integers]

Simplify[{Sin[z+k π]/Sin[z],Cos[z+k π]/Cos[z],Tan[z+k π]/Tan[z],Cot[z+k π]/Cot[z],Csc[z+k π]/Csc[z],Sec[z+k π]/Sec[z]},k∈Integers]

Mathematica also knows that the composition of inverse and direct trigonometric functions produces the value of the inner argument under the appropriate restriction. Here are some examples.

Simplify[{ArcSin[Sin[z]],ArcTan[Tan[z]],ArcCot[Cot[z]],ArcCsc[Csc[z]]},-π/2<Re[z]<π/2]

Simplify[{ArcCos[Cos[z]],ArcSec[Sec[z]]},0<Re[z]<π]

FunctionExpand (and Together)

While the trigonometric functions auto-evaluate for simple fractions of π, for more complicated cases they stay as trigonometric functions to avoid the build up of large expressions. Using the function FunctionExpand, such expressions can be transformed into explicit radicals.

Cos[(π/32)]

FunctionExpand[ Cos[(π/32)]]

Cot[(π/24)]//FunctionExpand

{Sin[(π/16)], Cos[(π/16)],Tan[(π/16)], Cot[(π/16)], Csc[(π/16)], Sec[(π/16)]}

FunctionExpand[%]

{Sin[(π/60)], Cos[(π/60)],Tan[(π/60)], Cot[(π/60)], Csc[(π/60)], Sec[(π/60)]}

Together[FunctionExpand[%]]

If the denominator contains squares of integers other than 2, the results always contain complex numbers (meaning that the imaginary number i=(Sqrt[-1]) appears unavoidably).

{Sin[(π/9)], Cos[(π/9)],Tan[(π/9)], Cot[(π/9)], Csc[(π/9)], Sec[(π/9)]}

FunctionExpand[%] // Together

Here the function RootReduce is used to express the previous algebraic numbers as numbered roots of polynomial equations.

RootReduce[Simplify[%]]

The function FunctionExpand also reduces trigonometric expressions with compound arguments or compositions, including hyperbolic functions, to simpler ones. Here are some examples.

FunctionExpand[Cot[(Sqrt[-(z^2)])]]

Tan[(Sqrt[I (z^2)])]//FunctionExpand

{Sin[(Sqrt[(z^2)])], Cos[(Sqrt[(z^2)])],Tan[(Sqrt[(z^2)])], Cot[(Sqrt[(z^2)])], Csc[(Sqrt[(z^2)])], Sec[(Sqrt[(z^2)])]}//FunctionExpand

Applying Simplify to the last expression gives a more compact result.

Simplify[%]

Here are some similar examples.

Sin[2ArcTan[z]]//FunctionExpand

Cos[((ArcCot[z])/2)]//FunctionExpand

{Sin[2ArcSin[z]],Cos[2ArcCos[z]],Tan[2ArcTan[z]],Cot[2ArcCot[z]],Csc[2ArcCsc[z]],Sec[2ArcSec[z]]}//FunctionExpand

{Sin[((ArcSin[z])/2)],Cos[((ArcCos[z])/2)],Tan[((ArcTan[z])/2)],Cot[((ArcCot[z])/2)],Csc[((ArcCsc[z])/2)],Sec[((ArcSec[z])/2)]}//FunctionExpand

Simplify[%]

FullSimplify

The function FullSimplify tries a wider range of transformations than Simplify and returns the simplest form it finds. Here are some examples that contrast the results of applying these functions to the same expressions.

Cos[(1/2) I Log[1-I z]-(1/2) I Log[1+I z]]//Simplify

Cos[(1/2) I Log[1-I z]-(1/2) I Log[1+I z]]//FullSimplify

{Sin[-I Log[I z+(Sqrt[1-(z^2)])]],Cos[-I Log[I z+(Sqrt[1-(z^2)])]],Tan[-I Log[I z+(Sqrt[1-(z^2)])]],Cot[-I Log[I z+(Sqrt[1-(z^2)])]],Csc[-I Log[I z+(Sqrt[1-(z^2)])]],Sec[-I Log[I z+(Sqrt[1-(z^2)])]]}//Simplify

{Sin[-I Log[I z+(Sqrt[1-(z^2)])]],Cos[-I Log[I z+(Sqrt[1-(z^2)])]],Tan[-I Log[I z+(Sqrt[1-(z^2)])]],Cot[-I Log[I z+(Sqrt[1-(z^2)])]],Csc[-I Log[I z+(Sqrt[1-(z^2)])]],Sec[-I Log[I z+(Sqrt[1-(z^2)])]]}//FullSimplify

Operations carried out by specialized Mathematica functions

Series expansions

Calculating the series expansion of trigonometric functions to hundreds of terms can be done in seconds. Here are some examples.

Series[Sin[z],{z,0,5}]

Normal[%]

Series[{Sin[z],Cos[z],Tan[z],Cot[z],Csc[z],Sec[z]},{z,0,3}]

Series[Cot[z],{z,0,100}]//Timing

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 n(^th) term for odd trigonometric functions can be evaluated.

<<DiscreteMath`RSolve`

SeriesTerm[{Sin[z],Tan[z],Cot[z],Csc[z], Cos[z],Sec[z]},{z,0,n}]

Differentiation

Mathematica can evaluate derivatives of trigonometric functions of an arbitrary positive integer order.

D[Sin[z],z]

Sin[z]//D[#,z]&

(∂_z){Sin[z],Cos[z],Tan[z],Cot[z],Csc[z],Sec[z]}

(∂_({z,2})){Sin[z],Cos[z],Tan[z],Cot[z],Csc[z],Sec[z]}

Table[D[{Sin[z],Cos[z],Tan[z],Cot[z],Csc[z],Sec[z]},{z,n}],{n,4}]

Finite summation

Mathematica can calculate finite sums that contain trigonometric functions. Here are two examples.

Sum[Sin[a k],{k,0,n}]

(∑_(k=0)^n)(((-1))^k) Sin[a k]

Infinite summation

Mathematica can calculate infinite sums that contain trigonometric functions. Here are some examples.

(∑_(k=1)^∞)(z^k) Sin[k x]

(∑_(k=1)^∞)((Sin[k x])/(k!))

(∑_(k=1)^∞)((Cos[k x])/k)

Finite products

Mathematica can calculate some finite symbolic products that contain the trigonometric functions. Here are two examples.

Product[Sin[((π k)/n)],{k,1,n-1}]

(∏_(k=1)^(n-1))Cos[z+((π k)/n)]

Infinite products

Mathematica can calculate infinite products that contain trigonometric functions. Here are some examples.

(∏_(k=1)^∞)Exp[(z^k) Sin[k x]]

(∏_(k=1)^∞)Exp[((Cos[k x])/(k!))]

Indefinite integration

Mathematica can calculate a huge number of doable indefinite integrals that contain trigonometric functions. Here are some examples.

∫Sin[7z]\[DifferentialD]z

∫{{Sin[z],((Sin[z])^a)},{Cos[z],((Cos[z])^a)},{Tan[z],((Tan[z])^a)},{Cot[z],((Cot[z])^a)},{Csc[z],((Csc[z])^a)},{Sec[z],((Sec[z])^a)}}\[DifferentialD]z

Definite integration

Mathematica can calculate wide classes of definite integrals that contain trigonometric functions. Here are some examples.

(∫_0^(π/2))((Sin[z])^(1/3))\[DifferentialD]z

(∫_0^(π/2)){(Sqrt[Sin[z]]),(Sqrt[Cos[z]]),(Sqrt[Tan[z]]),(Sqrt[Cot[z]]),(Sqrt[Csc[z]]),(Sqrt[Sec[z]])}\[DifferentialD]z

(∫_0^(π/2)){{Sin[z],((Sin[z])^a)},{Cos[z],((Cos[z])^a)},{Tan[z],((Tan[z])^a)},{Cot[z],((Cot[z])^a)},{Csc[z],((Csc[z])^a)},{Sec[z],((Sec[z])^a)}}\[DifferentialD]z

Limit operation

Mathematica can calculate limits that contain trigonometric functions.

Limit[((Sin[z])/z)+((Cos[z])^3),z->0]

Limit[(((((Tan[x])/x)))^(1/(x^2))),x->0]

Solving equations

The next input solves equations that contain trigonometric functions. The message indicates that the multivalued functions are used to express the result and that some solutions might be absent.

Solve[((Tan[z])^2)+3 Sin[z+Pi/6]==4,z]

Complete solutions can be obtained by using the function Reduce.

Reduce[Sin[x]==a,x]//TraditionalForm

Reduce[Cos[x]==a,x]//TraditionalForm

Reduce[Tan[x]==a,x]//TraditionalForm

Reduce[Cot[x]==a,x]//TraditionalForm

Reduce[Csc[x]==a,x]//TraditionalForm

Reduce[Sec[x]==a,x]//TraditionalForm

Solving differential equations

Here are differential equations whose linear-independent solutions are trigonometric functions. The solutions of the simplest second-order linear ordinary differential equation with constant coefficients can be represented through sin(z) and cos(z).

DSolve[w''[z]+w[z]==0,w[z],z]

dsol1=DSolve[2 w[z]+3 w''[z]+Derivative[4][w][z]==0,w[z],z]

In the last input, the differential equation was solved for w(z). If the argument is suppressed, the result is returned as a pure function (in the sense of the λ-calculus).

dsol2=DSolve[2 w[z]+3 w''[z]+Derivative[4][w][z]==0,w,z]

The advantage of such a pure function is that it can be used for different arguments, derivatives, and more.

w'[ζ] /.dsol1

w'[ζ] /.dsol2

All trigonometric functions satisfy first-order nonlinear differential equations. In carrying out the algorithm to solve the nonlinear differential equation, Mathematica has to solve a transcendental equation. In doing so, the generically multivariate inverse of a function is encountered, and a message is issued that a solution branch is potentially missed.

DSolve[{w'[z]==(Sqrt[1-((w[z])^2)]),w[0]==0},w[z],z]

DSolve[{w'[z]==(Sqrt[1-((w[z])^2)]),w[0]==1},w[z],z]

DSolve[{w'[z]-((w[z])^2)-1==0,w[0]==0},w[z],z]

DSolve[{w'[z]+((w[z])^2)+1==0,w[(π/2)]==0},w[z],z]

DSolve[{w'[z]==(Sqrt[((w[z])^4)-((w[z])^2)]),1/w[0]==0},w[z],z] //Simplify[#, 0 < z < Pi/2]&

DSolve[{w'[z]==(Sqrt[((w[z])^4)-((w[z])^2)]),1/w[(π/2)]==0},w[z],z] //Simplify[#, 0 < z < Pi/2]&

Integral transforms

Mathematica supports the main integral transforms like direct and inverse Fourier, Laplace, and Z transforms that can give results that contain classical or generalized functions. Here are some transforms of trigonometric functions.

LaplaceTransform[Sin[t],t,s]

FourierTransform[Sin[t],t,s]

FourierSinTransform[Sin[t],t,s]

FourierCosTransform[Sin[t],t,s]

ZTransform[Sin[π t],t,s]

Plotting

Mathematica has built-in functions for 2D and 3D graphics. Here are some examples.

Plot[Sin[(∑_(k=0)^5)(z^k)],{z,-((2 π)/3),((2 π)/3)}];

Plot3D[Re[Tan[x+I y]],{x,-π,π},{y,0,π},
PlotPoints->240,PlotRange->{-5,5},ClipFill->None,Mesh->False,AxesLabel->{"x","y",None}];

ContourPlot[Arg[Sec[(1/(x+I y))]],{x,-(1/2),(1/2)},{y,-(1/2),(1/2)},PlotPoints->400,PlotRange->{-π,π},FrameLabel->{"x","y",None,None},ColorFunction->Hue,ContourLines->False,Contours->200];

Introduction to the Tangent Function in Mathematica

Overview

The following shows how the tangent function is realized in Mathematica. Examples of evaluating Mathematica functions applied to various numeric and exact expressions that involve the tangent 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 tangent function in StandardForm.

Tan[z]

This shows the tangent function in TraditionalForm.

%//TraditionalForm

Additional forms of notations

Mathematica also knows the most popular forms of notations for the tangent function that are used in other programming languages. Here are three examples: CForm, TeXForm, and FortranForm.

{CForm[Tan[2π z]],TeXForm[Tan[2π z]],FortranForm[Tan[2π z]]}

Automatic evaluations and transformations

Evaluation for exact, machine-number, and high-precision arguments

For the exact argument z=π/4, Mathematica returns an exact result.

Tan[(π/4)]

Tan[z]/.z->(π/4)

For a machine-number argument (a numerical argument with a decimal point and not too many digits), a machine number is also returned.

Tan[4.]

Tan[z]/.z->2.

The next inputs calculate 100-digit approximations at z=1 and z=2.

N[Tan[z]/.z->1,100]

N[Tan[2],100]

Tan[2]//N[#,100]&

Within a second, it is possible to calculate thousands of digits for the tangent function. The next input calculates 10000 digits for tan(1) and analyzes the frequency of the digit k in the resulting decimal number.

Map[Function[w, {First[#],Length[#]}&/@Split[Sort[First[RealDigits[w]]]]] , N[{Tan[z]}/.z->1,10000]]

Here is a 50-digit approximation of the tangent function at the complex argument z=3-2i.

N[Tan[3-2 I],50]

{N[Tan[z]/.z->3-2 I,50],Tan[3-2 I]//N[#,50]&}

Mathematica automatically evaluates mathematical functions with machine precision, if the arguments of the function are 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.

{Tan[3.],N[Tan[3]],N[Tan[3],16],N[Tan[3],5],N[Tan[3],20]}

%//InputForm

Simplification of the argument

Mathematica knows symmetry and periodicity of the tangent function. Here are some examples.

Tan[-3]

{Tan[-z],Tan[z+π],Tan[z+2π],Tan[-z+21π]}

Mathematica automatically simplifies the composition of the direct and the inverse tangent functions into its argument.

Tan[ArcTan[z]]

Mathematica also automatically simplifies the composition of the direct and any of the inverse trigonometric functions into algebraic functions of the argument.

{Tan[ArcSin[z]],Tan[ArcCos[z]],Tan[ArcTan[z]], Tan[ArcCot[z]],Tan[ArcCsc[z]], Tan[ArcSec[z]]}

If the argument has the structure π k/2+z or π k/2-z, and π k/2+i z or π k/2-i z with integer k, the tangent function can be automatically transformed into trigonometric or hyperbolic tangent or cotangent functions.

Tan[(π/2)-4]

{Tan[(π/2)-z],Tan[(π/2)+z],Tan[-(π/2)-z],Tan[-(π/2)+z],Tan[π-z],Tan[π+z]}

Tan[I 5]

{Tan[I z],Tan[(π/2)-I z],Tan[(π/2)+I z],Tan[π-I z],Tan[π+I z]}

Simplification of simple expressions containing the tangent function

Sometimes simple arithmetic operations containing the tangent function can automatically produce other trigonometric functions.

1/Tan[4]

{1/Tan[z],1/Tan[π/2-z],Tan[π/2-z]/Tan[z],Tan[z]/Tan[π/2-z],1/Tan[π/2-z],Tan[π/2-z]/Tan[z]^2}

The tangent function arising as special cases from more general functions

The tangent function can be treated as a particular case of some more general special functions. For example, tan(z) can appear automatically from Bessel, Mathieu, Jacobi, hypergeometric, and Meijer functions for appropriate values of their parameters.

{BesselJ[(1/2),z]/BesselJ[-(1/2),z],((MathieuS[1,0,z])/(MathieuC[1,0,z])),JacobiSC[z,0],JacobiCS[(π/2)-z,0],-I JacobiSN[I z,1], I JacobiNS[((π I)/2)-I z,1],HypergeometricPFQ[{},{(3/2)},-((z^2)/4)]/HypergeometricPFQ[{},{(1/2)},-((z^2)/4)],MeijerG[{{},{}},{{(1/2)},{0}},((z^2)/4)]/MeijerG[{{},{}},{{-(1/2)},{0}},((z^2)/4)]}

Equivalence transformations carried out by specialized Mathematica functions

General remarks

Almost everybody prefers using 1-tan(z) instead of tan(π-z)+tan(π/4). 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 tan(π/16) should not be automatically expanded into the more complicated expression ((((2-(((2+(2^(1/2))))^(1/2)))/(2+(2+(2^(1/2))))))^(1/2)). 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 the products of trigonometric and hyperbolic functions into sums of powers, using trigonometric and hyperbolic identities where possible. Here are some examples.

TrigExpand[Tan[x-y]]

Tan[4z]//TrigExpand

((Tan[2z])^2)//TrigExpand

TrigExpand[{Tan[x+y+z],Tan[3 z]}]

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.

TrigFactor[Tan[x]+Tan[y]]

Tan[x]-Cot[y]//TrigFactor

TrigReduce

The function TrigReduce rewrites 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.

TrigReduce[Tan[x]Tan[y]]

Tan[x]Cot[y]//TrigReduce

Table[TrigReduce[Tan[z]^n],{n,2,5}]

TrigReduce[TrigExpand[{Tan[x+y+z],Tan[3 z],Tan[x]Tan[y]}]]

TrigFactor[Tan[x]+Tan[y]]//TrigReduce

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.

TrigToExp[Tan[z]]

Tan[a z]+Tan[b z]//TrigToExp

ExpToTrig

The function ExpToTrig converts exponentials to trigonometric and hyperbolic functions. It is approximately inverse to TrigToExp. Here are some examples.

ExpToTrig[TrigToExp[Tan[z]]]

{α (E^(-I x β))+α (E^(I x β))/(α (E^(-I x β))+γ (E^(I x β)))}//ExpToTrig

ComplexExpand

The function ComplexExpand expands expressions assuming that all the variables are real. The value option TargetFunctions is a list of functions from the set {Re, Im, Abs, Arg, Conjugate, Sign}. ComplexExpand tries to give results in terms of the functions specified. Here are some examples.

ComplexExpand[Tan[x+I y]]

Tan[x+I y]+Tan[x-I y]//ComplexExpand

ComplexExpand[Re[Tan[x+I y]],TargetFunctions->{Re,Im}]

ComplexExpand[Im[Tan[x+I y]],TargetFunctions->{Re,Im}]

ComplexExpand[Abs[Tan[x+I y]],TargetFunctions->{Re,Im}]

ComplexExpand[Abs[Tan[x+I y]],TargetFunctions->{Re,Im}]//Simplify[#,{x,y}∈Reals]&

ComplexExpand[Re[Tan[x+I y]]+Im[Tan[x+I y]],TargetFunctions->{Re,Im}]

ComplexExpand[Arg[Tan[x+I y]],TargetFunctions->{Re,Im}]

ComplexExpand[Arg[Tan[x+I y]],TargetFunctions->{Re,Im}]//Simplify[#,{x,y}∈Reals]&

ComplexExpand[Conjugate[Tan[x+I y]],TargetFunctions->{Re,Im}]//Simplify

Simplify

The function Simplify performs a sequence of algebraic transformations on the expression, and returns the simplest form it finds. Here are some examples.

((Tan[(Subscript[z, 1])]+Tan[(Subscript[z, 2])]+Tan[(Subscript[z, 3])]-Tan[(Subscript[z, 1])] Tan[(Subscript[z, 2])] Tan[(Subscript[z, 3])])/(1-Tan[(Subscript[z, 1])] Tan[(Subscript[z, 2])]-Tan[(Subscript[z, 1])] Tan[(Subscript[z, 3])]-Tan[(Subscript[z, 2])] Tan[(Subscript[z, 3])]))//Simplify

Simplify[Tan[z-(π/3)] Tan[(π/3)+z]+Tan[z-(π/3)] Tan[z]+Tan[z] Tan[(π/3)+z]]

Here is a collection of trigonometric identities. All are written as one large logical conjunction.

Simplify[#]&/@(Tan[2 z] (1-((Tan[z])^2))==2 Tan[z]∧
((Tan[z])^2)==((1-Cos[2 z])/(1+Cos[2 z]))∧((Tan[z])^3)==((3 Sin[z]-Sin[3 z])/(3 Cos[z]+Cos[3 z]))∧
Tan[a]+Tan[b]==((Sin[a+b])/(Cos[a]Cos[b]))∧Tan[a]-Tan[b]==((Sin[a-b])/(Cos[a]Cos[b]))∧
Tan[(z/2)]==((1-Cos[z])/(Sin[z]))==((Sin[z])/(1+Cos[z]))∧((Tan[a])^2)-((Tan[b])^2)==((Sec[a])^2) ((Sec[b])^2) Sin[a-b] Sin[a+b])

The function Simplify has the Assumption option. For example, Mathematica treats the periodicity of trigonometric functions for the symbolic integer coefficient k of k π.

Simplify[{Tan[z+2 k π],Tan[z+k π]/Tan[z]},k∈Integers]

Mathematica also knows that the composition of the inverse and the direct trigonometric functions produces the value of the internal argument under the corresponding restriction.

ArcTan[Tan[z]]

Simplify[ArcTan[Tan[z]],-π/2<Re[z]<π/2]

FunctionExpand (and Together)

While the tangent function auto-evaluates for simple fractions of π, for more complicated cases it stays as a tangent function to avoid the build up of large expressions. Using the function FunctionExpand, the tangent function can sometimes be transformed into explicit radicals. Here are some examples.

{Tan[(π/16)],Tan[(π/60)]}

FunctionExpand[%]

Together[%]

If the denominator contains squares of integers other than 2, the results always contain complex numbers (meaning that the imaginary number i=(Sqrt[-1]) appears unavoidably).

{Tan[(π/9)]}

FunctionExpand[%] // Together

Here the function RootReduce is used to express the previous algebraic numbers as roots of polynomial equations.

RootReduce[Simplify[%]]

The function FunctionExpand also reduces trigonometric expressions with compound arguments or compositions, including inverse trigonometric functions, to simpler ones. Here are some examples.

{Tan[(Sqrt[(z^2)])],Tan[((ArcTan[z])/2)],Tan[2ArcTan[z]],Tan[3ArcSin[z]]}//FunctionExpand

Applying Simplify to the previous expression gives a more compact result.

Simplify[%]

FullSimplify

The function FullSimplify tries a wider range of transformations than Simplify and returns the simplest form it finds. Here are some examples that contrast the results of applying the functions Simplify and FullSimplify to the same expressions.

set1={Tan[-I Log[I z+(Sqrt[1-(z^2)])]],Tan[(π/2)+I Log[I z+(Sqrt[1-(z^2)])]],Tan[(1/2) I Log[1-I z]-(1/2) I Log[1+I z]],Tan[(1/2) I Log[1-(I/z)]-(1/2) I Log[1+(I/z)]],Tan[-I Log[(Sqrt[1-(1/(z^2))])+(I/z)]],Tan[(π/2)+I Log[(Sqrt[1-(1/(z^2))])+(I/z)]]}

set1//Simplify

set1//FullSimplify

Operations carried out by specialized Mathematica functions

Series expansions

Calculating the series expansion of a tangent function to hundreds of terms can be done in seconds.

Series[Tan[z],{z,0,3}]

Normal[%]

Series[Tan[z],{z,0,100}]//Timing

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 n(^th) term of tan(z) can be evaluated.

<<DiscreteMath`RSolve`

SeriesTerm[Tan[z],{z,0,n}]z^n

The result can be checked by the following process.

%/.{Odd[n_]:>Element[(n+1)/2,Integers]}/.{n->2k-1}

Simplify[%,k∈Integers]

FunctionExpand[(∑_(k=1)^∞)Evaluate[%]]

Differentiation

Mathematica can evaluate derivatives of the tangent function of an arbitrary positive integer order.

(∂_z)Tan[z]

(∂_({z,2}))Tan[z]

Table[D[Tan[z],{z,n}],{n,10}]

Finite products

Mathematica can calculate some finite symbolic products that contain the tangent function. Here is an example.

(∏_(k=1)^(n-1)) Tan[((k π)/n)]

Indefinite integration

Mathematica can calculate a huge number of doable indefinite integrals that contain the tangent function. Here are some examples.

∫Tan[z]\[DifferentialD]z

∫((Tan[z])^a)\[DifferentialD]z

Definite integration

Mathematica can calculate wide classes of definite integrals that contain the tangent function. Here are some examples.

(∫_0^(π/2))(Sqrt[Tan[z]])\[DifferentialD]z

(∫_0^(π/2))((Tan[z])^a)\[DifferentialD]z

Limit operation

Mathematica can calculate limits that contain the tangent function. Here are some examples.

Limit[((Tan[3z])/z),z->0]

Limit[((Tan[(Sqrt[(z^2)])])/z),z->0,Direction->1]

Limit[((Tan[(Sqrt[(z^2)])])/z),z->0,Direction->-1]

Solving equations

The next inputs solve two equations that contain the tangent function. Because of the multivalued nature of the inverse tangent function, a printed message indicates that only some of the possible solutions are returned.

Solve[((Tan[z])^2)+3 Tan[z+Pi/6]==4,z]

Solve[Tan[x]==a,x]

A complete solution of the previous equation can be obtained using the function Reduce.

Reduce[Tan[x]==a,x]//InputForm

Solving differential equations

Here is a nonlinear differential equation whose independent solutions include the tangent function.

dsol1=DSolve[w'[z]-((w[z])^2)-1==0,w[z],z]

In the previous input, the differential equation was solved for w(z). If the argument is suppressed, the result is returned as a pure function (in the sense of the λ-calculus).

dsol2=DSolve[w'[z]-((w[z])^2)-1==0,w,z]

The advantage of such a pure function is that it can be used for different arguments, derivatives, and more.

w'[ζ] /.dsol1

w'[ζ] /.dsol2

In carrying out the algorithm to solve the following nonlinear differential equation, Mathematica has to solve a transcendental equation. In doing so, the generically multivariate inverse of a function is encountered, and a message is issued that a solution branch is potentially missed.

DSolve[{w'[z]-((w[z])^2)-1==0,w[0]==0},w[z],z]

Plotting

Mathematica has built-in functions for 2D and 3D graphics. Here are some examples.

Plot[Tan[(∑_(k=0)^5)(z^k)],{z,-((2 π)/3),((2 π)/3)}];

Plot3D[Re[Tan[x+I y]],{x,-π,π},{y,0,π},
PlotPoints->240,PlotRange->{-5,5},ClipFill->None,Mesh->False,AxesLabel->{"x","y",None}];

ContourPlot[Arg[Tan[(1/(x+I y))]],{x,-(1/2),(1/2)},{y,-(1/2),(1/2)},PlotPoints->400,PlotRange->{-π,π},FrameLabel->{"x","y",None,None},ColorFunction->Hue,ContourLines->False,Contours->200];

Copyright