Tangent

Author

Eric W. Weisstein
December 21, 2009

This notebook downloaded from http://mathworld.wolfram.com/notebooks/SpecialFunctions/Tangent.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/Tangent.html.

©2009 Wolfram Research, Inc. except for portions noted otherwise

Definition

TrigToExp[Tan[z]]

Simplify[%]

Plots

<<Utilities`Plot`

Real Axis

disc=Range[-3,3,2]Pi/2;
PlotDiscontinuous[Tan[x],{x,-2Pi,Sequence@@disc,2Pi},
PlotStyle->Red,
VerticalAsymptotes->disc,
PlotRange->{Automatic,{-5,5}},Ticks->{{#,TraditionalForm[#]}&/@Range[-2Pi,2Pi,Pi/2],Automatic},AxesLabel->TraditionalForm/@{x,Tan[x]}]

Complex Plane

ComplexPlot3D[Tan[z],{z,-2Pi,2Pi},PlotPoints->100]

ComplexPlot3D[Tan[z],{z,-2Pi,2Pi},
PlotPoints->100,
ColorFunction->Hue]

ComplexContourPlot[Tan[z],{z,-2Pi,2Pi}]//Timing

Special Values

Tan/@(Range[5]Pi)

Tan/@(Range[-5,5,2]Pi/2)

Generating Function

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

V5

<<DiscreteMath`RSolve`

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

Through[{Numerator,Denominator}[Last/@Partition[CoefficientList[Series[Tan[z],{z,0,15}],z],2]]]

V7

SeriesCoefficient[Tan[z],{z,0,n}]

Table[%,{n,0,10}]

CoefficientList[Series[Tan[z],{z,0,10}],z]

SeriesCoefficient[Tan[z],{z,0,n}]//InputForm

GeneratingFunction[-%,n,x]//InputForm

GeneratingFunction[(( (((-1))^(n-1))(2^(2n)) ((2^(2n))-1) BernoulliB[2n])/((2n)!)),n,x]

V8

SeriesCoefficient[Tan[z],{z,0,n}]

Table[%,{n,0,10}]

CoefficientList[Series[Tan[z],{z,0,10}],z]

SeriesCoefficient[Tan[z],{z,0,n}]

GeneratingFunction[-%33,n,x]//Timing

GeneratingFunction[(( (((-1))^(n-1))(2^(2n)) ((2^(2n))-1) BernoulliB[2n])/((2n)!)),n,x]

Multiple-Angle Formula

Table[Sum[(((-1))^k)Binomial[n,2k+1](t^(2k+1)),{k,0,n}],{n,4}]

FullSimplify[Sum[(((-1))^k)Binomial[n,2k+1](t^(2k+1)),{k,0,n}],n∈Integers&&n≥0]

Table[Sum[(((-1))^k)Binomial[n,2k](t^k),{k,0,n}],{n,0,4}]

FullSimplify[Sum[(((-1))^k)Binomial[n,2k](t^(2k)),{k,0,n}],n∈Integers&&n≥0]

l=Table[((Expand[(1/2) I ((((1-I t))^n)-(((1+I t))^n))])/(Expand[(1/2) ((((1-I t))^n)+(((1+I t))^n))])),{n,10}]

FullSimplify[l/.x->Tan[t]]

FullSimplify[((Expand[(1/2) I ((((1-I x))^n)-(((1+I x))^n))])/(Expand[(1/2) ((((1-I x))^n)+(((1+I x))^n))]))/.x->Tan[t],n∈Integers&&n>0]

Sums

(∑_n^∞)(((x^(2 n-1)) ((((-1))^(n-1)) (2^(2 n)) ((2^(2 n))-1) (Subscript[B, 2 n])))/((2 n)!))==tan(x)

V7

Sum[(((((-1))^(n-1))(2^(2n))((2^(2n))-1)BernoulliB[2n])/((2n)!))(x^(2n-1)),{n,∞}]

Simplify[%]

(∑_n^∞)(((x^n) (i (((2 i))^n) ((((-1))^n)-1) ((2^(n+1))-1) (Subscript[B, n+1])))/((n+1)!))==tan(x)

V7

Sum[((I (((2 I))^n) (-1+(((-1))^n)) (-1+(2^(1+n))) BernoulliB[1+n])/((1+n)!))(x^n),{n,∞}]

Products

(∏_k^(Floor[(n-1)/2]))tan(((π k)/n))==(Piecewise[{{(Sqrt[n]), (Mod[n, 2])==1}, {1, (Mod[n, 2])==0}}])

Product[Tan[((k π)/n)],{k,Floor[(n-1)/2]}]

Continued Fraction

(x/(ContinuedFractionK[-(x^2),2 n+1,{n,∞}]+1))==tan(x)

V7

x/(1+ContinuedFractionK[-x^2,(2n+1),{n,∞}])

{Tan[x],x/(1+ContinuedFractionK[-x^2,(2n+1),{n,10}])}/.x->1.4

V8

x/(1+ContinuedFractionK[-x^2,(2n+1),{n,∞}])

-ContinuedFractionK[-1,((2 n-1)/x),{n,∞}]==tan(x)

V7

-ContinuedFractionK[-1,(2n-1)/x,{n,∞}]

{Tan[x],-ContinuedFractionK[-1,(2n-1)/x,{n,20}]}/.x->1.4

V8

-ContinuedFractionK[-1,(2n-1)/x,{n,∞}]

Transcendental Roots

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

Reduce[Tan[x]==x,x]

FindRoot[Tan[x]==x,{x,4,5},WorkingPrecision->20]

<<Utilities`Plot`

FindRoot[Tan[x]-x,{x,4,5},WorkingPrecision->30]

Internal`DeactivateMessages[roots=PlotRoots[Tan[x]-x,{x,0,20},WorkingPrecision->30,PlotPoints->100,MaxIterations->200]
]

N[DeleteCases[roots,_?(Abs[Mod[(2#/π-1)/2,1,-1/2]]<=.0001&)],21]

Prime Numerators

(p=Position[Numerator[Table[(((((-1))^(n-1))(2^(2n))((2^(2n))-1)BernoulliB[2n])/((2n)!)),{n,1000}]],_?PrimeQ]//Flatten)//Timing

(p=Position[Numerator[Table[(((((-1))^(n-1))(2^(2n))((2^(2n))-1)BernoulliB[2n])/((2n)!)),{n,2000}]],_?PrimeQ]//Flatten)//Timing

(p=2000+Position[Numerator[Table[(((((-1))^(n-1))(2^(2n))((2^(2n))-1)BernoulliB[2n])/((2n)!)),{n,2001,2500}]],_?PrimeQ]//Flatten)//Timing

Identities

(tan^2)(θ)+1==(sec^2)(θ)

FullSimplify[Subtract@@{((Tan[θ])^2)+1,((Sec[θ])^2)}]

tan((α/2))==((sin(α))/(cos(α)+1))==((1-cos(α))/(sin(α)))==((tan(α) sin(α))/(sin(α)+tan(α)))

FullSimplify[{Tan[α/2],((Sin[α])/(1+Cos[α])),((1-Cos[α])/(Sin[α])),((Tan[α]Sin[α])/(Tan[α]+Sin[α]))}]

tan(n (tan^(-1))(x))==((i ((((1-i x))^n)-(((i x+1))^n)))/((((i x+1))^n)+(((1-i x))^n)))

Together[FullSimplify[TrigToExp[Tan[n ArcTan[x]]],x∈Reals]]

tan((∑_(n=1)^N)(Subscript[θ, n]))==((i ((∏_(n=1)^N)(1-i tan((Subscript[θ, n])))-(∏_(n=1)^N)(i tan((Subscript[θ, n]))+1)))/((∏_(n=1)^N)(i tan((Subscript[θ, n]))+1)+(∏_(n=1)^N)(1-i tan((Subscript[θ, n])))))

(Subscript[θ, n])==θ

Tan[(∑_(n=1)^N)(Subscript[θ, n])]==I(((∏_(n=1)^N)(1-I Tan[(Subscript[θ, n])])-(∏_(n=1)^N)(1+I Tan[(Subscript[θ, n])]))/((∏_(n=1)^N)(1+I Tan[(Subscript[θ, n])])+(∏_(n=1)^N)(1-I Tan[(Subscript[θ, n])])))/.{(Subscript[θ, n_]):>ArcTan[x]}

(Subscript[θ, 1]),(Subscript[θ, 2])==α,β

I(((∏_(n=1)^N)(1-I Tan[(Subscript[θ, n])])-(∏_(n=1)^N)(1+I Tan[(Subscript[θ, n])]))/((∏_(n=1)^N)(1+I Tan[(Subscript[θ, n])])+(∏_(n=1)^N)(1-I Tan[(Subscript[θ, n])])))/.{(Subscript[θ, n_]):>{α,β}[[n]],N->2}//Factor

Simplify[%]

(Subscript[θ, 1]),(Subscript[θ, 2]),(Subscript[θ, 3])==α,β,γ

I(((∏_(n=1)^N)(1-I Tan[(Subscript[θ, n])])-(∏_(n=1)^N)(1+I Tan[(Subscript[θ, n])]))/((∏_(n=1)^N)(1+I Tan[(Subscript[θ, n])])+(∏_(n=1)^N)(1-I Tan[(Subscript[θ, n])])))/.{(Subscript[θ, n_]):>{α,β,γ}[[n]],N->3}//Factor

((-Tan[α]-Tan[β]-Tan[γ]+Tan[α] Tan[β] Tan[γ])/(-1+Tan[α] Tan[β]+Tan[α] Tan[γ]+Tan[β] Tan[γ]))//TraditionalForm

Simplify[%]

(Subscript[θ, 1]),(Subscript[θ, 2]),(Subscript[θ, 3]),(Subscript[θ, 4])==α,β,γ,δ

I(((∏_(n=1)^N)(1-I Tan[(Subscript[θ, n])])-(∏_(n=1)^N)(1+I Tan[(Subscript[θ, n])]))/((∏_(n=1)^N)(1+I Tan[(Subscript[θ, n])])+(∏_(n=1)^N)(1-I Tan[(Subscript[θ, n])])))/.{(Subscript[θ, n_]):>{α,β,γ,δ}[[n]],N->4}//Factor//TraditionalForm

Simplify[%]

General Numeric Check

Subtract@@@Table[With[{vals=Table[Random[Complex,20(I+1){-1,1},20],{20}]},
{Tan[(∑_(n=1)^N)(Subscript[θ, n])],I(((∏_(n=1)^N)(1-I Tan[(Subscript[θ, n])])-(∏_(n=1)^N)(1+I Tan[(Subscript[θ, n])]))/((∏_(n=1)^N)(1+I Tan[(Subscript[θ, n])])+(∏_(n=1)^N)(1-I Tan[(Subscript[θ, n])])))}/.{(Subscript[θ, n_]):>vals[[n]],N->Length[vals]}
],{20}]//Chop//Union

((tan(x)+1)/(1-tan(x)))==tan(x+(π/4))

Simplify[(1+Tan[x])/(1-Tan[x])==Tan[x+Pi/4]]

tan(a+b+c)==((tan(a) (-tan(b)) tan(c)+tan(a)+tan(b)+tan(c))/(-tan(a) tan(b)-tan(a) tan(c)-tan(b) tan(c)+1))

FunctionExpand[Tan[a+b+c]]

TrigExpand[Tan[a+b+c]]

FullSimplify[((Tan[a]+Tan[b]+Tan[c]-Tan[a]Tan[b]Tan[c])/(1-Tan[b]Tan[c]-Tan[c]Tan[a]-Tan[a]Tan[b]))]

Tan -> ArcTan

From Oleg

zs=Table[RandomComplex[2(I+1){-1,1},WorkingPrecision->20],{1000}];

oleg[z_]:=(ArcTan[(I*(E^(2/(1+E^(2*I*z)))-E^((2*E^(2*I*z))/(1+E^(2*I*z)))))/(E^(2/(1+E^(2*I*z)))+E^((2*E^(2*I*z))/(1+E^(2*I*z))))]+Pi*Floor[1/2-Im[(1-E^(2*I*z))/(1+E^(2*I*z))]/Pi]-(Pi/2)*(1+(-1)^(Floor[1/2+Im[(1-E^(2*I*z))/(1+E^(2*I*z))]/Pi]+Floor[-(Im[(1-E^(2*I*z))/(1+E^(2*I*z))]/Pi)-1/2]))*UnitStep[Re[(1-E^(2*I*z))/(1+E^(2*I*z))]])

Tan[z]==oleg[z]//TraditionalForm

bad=Select[zs,(Chop[Tan[#]-oleg[#]]=!=0&)]

x=bad[[1]]

Precision[x]

Through[{Tan,oleg}[x]]

Precision/@%

Subtract@@Through[{Tan,oleg}[x]]//InputForm

zs30=Table[RandomComplex[2(I+1){-1,1},WorkingPrecision->30],{10^4}];

bad=Select[zs30,(Chop[Tan[#]-oleg[#]]=!=0&)]