Tangent function
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
tan(x
)
tan(x)
represents the tangent function sin(x)/cos(x)
.
Specify the argument x
in radians, not in
degrees. For example, use π to
specify an angle of 180^{o}.
All trigonometric functions are defined for complex arguments.
Floatingpoint values are returned for floatingpoint arguments. Floatingpoint intervals are returned for floatingpoint interval arguments. Unevaluated function calls are returned for most exact arguments.
Translations by integer multiples of π are eliminated from the argument. Further, arguments that are rational multiples of π lead to simplified results; symmetry relations are used to rewrite the result using an argument from the standard interval . Explicit expressions are returned for the following arguments:
.
See Example 2.
The result is rewritten in terms of hyperbolic
functions, if the argument is a rational multiple of I
.
See Example 3.
The functions expand
and combine
implement the
addition theorems for the trigonometric functions. See Example 4.
The trigonometric functions do not respond to properties set
via assume
. Use simplify
to take such
properties into account. See Example 4.
Use rewrite
to
rewrite expressions in terms of a specific target function. For example,
you can rewrite expressions involving the tangent function in terms
of other trigonometric functions and vice versa. See Example 5.
The inverse function is implemented as arctan
.
See Example 6.
The float attributes are kernel functions, thus, floatingpoint evaluation is fast.
When called with a floatingpoint argument, the functions are
sensitive to the environment variable DIGITS
which determines
the numerical working precision.
Call tan
with the following exact and symbolic
input arguments:
tan(0), tan(1), tan(5 + I), tan(PI), tan(PI/11), tan(PI/8)
tan(x), tan(x + PI), tan(x^2  4)
Floatingpoint values are computed for floatingpoint arguments:
tan(123.4), tan(5.6 + 7.8*I), tan(1.0/10^20)
Floatingpoint intervals are computed for interval arguments:
tan(0...1), tan(1/2...1/2), tan(0...5)
For intervals containing discontinuities, the result is a union of intervals:
tan(1...2); tan(PI/2...0)
Some special values are implemented:
tan(PI/10), tan(2*PI/5), tan(123/8*PI), tan(PI/12)
Translations by integer multiples of π are eliminated from the argument:
tan(x + 10*PI), tan(3  PI), tan(x + PI), tan(2  10^100*PI)
All arguments that are rational multiples of π are transformed to arguments from the interval :
tan(4/7*PI), tan(20*PI/9), tan(123/11*PI), tan(PI/13)
Arguments that are rational multiples of I
are
rewritten in terms of hyperbolic functions:
tan(5*I), tan(5/4*I), tan(3*I)
For other complex arguments, use expand
to rewrite the result:
tan(5*I + 2*PI/3), tan(PI/4  5/4*I), tan(3*I + PI/2)
expand(tan(5*I + 2*PI/3)), expand(tan(5/4*I  PI/4)), expand(tan(3*I + PI/2))
The expand
function
implements the addition theorems:
expand(tan(x + PI/2)), expand(tan(x + y))
The trigonometric functions do not immediately respond to properties
set via assume
:
assume(n, Type::Integer): tan(n*PI)
Use simplify
to
take such properties into account:
simplify(tan(n*PI))
assume(n, Type::Integer): tan(n*PI + x), simplify(tan(n*PI + x))
y := tan(x + n*PI) + tan(x  n*PI); simplify(y)
delete n, y
Use rewrite
to
obtain a representation in terms of a specific target function:
rewrite(tan(x)*exp(2*I*x), sincos); rewrite(cos(x), tan)
The inverse function is implemented as arctan
:
tan(arctan(x)), arctan(tan(x))
Note that arctan(tan(x))
does not necessarily
yield x
because arctan
produces
values with real parts in the interval $$\left[\frac{\pi}{2},\frac{\pi}{2}\right]$$:
arctan(tan(3)), arctan(tan(1.6 + I))
diff
, float
, limit
, taylor
and other system
functions handle expressions involving the trigonometric functions:
diff(tan(x), x), float(tan(3)*cos(5 + I))
limit(x*sin(x)/tan(x^2), x = 0)
taylor(tan(x), x = 0)

Arithmetical expression or a floatingpoint interval
x