This functionality does not run in MATLAB.
tan(x) represents the tangent function sin(x)/cos(x).
The arguments have to be specified in radians, not in degrees. E.g., use π to specify an angle of 180o.
All trigonometric functions are defined for complex arguments.
Floating point values are returned for floating-point arguments. Floating point intervals are returned for floating-point 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:
Cf. Example 2.
The inverse function is implemented by arctan. Cf. Example 6.
The float attributes are kernel functions, i.e., floating-point evaluation is fast.
When called with a floating-point argument, the functions are sensitive to the environment variable DIGITS which determines the numerical working precision.
We demonstrate some calls with exact and symbolic input data:
sin(PI), cos(1), tan(5 + I), csc(PI/2), sec(PI/11), cot(PI/8)
sin(-x), cos(x + PI), tan(x^2 - 4)
Floating point values are computed for floating-point arguments:
sin(123.4), cos(5.6 + 7.8*I), cot(1.0/10^20)
Floating point intervals are computed for interval arguments:
sin(0 ... 1), cos(20 ... 30), tan(0 ... 5)
For the functions with discontinuities, the result may be a union of intervals:
csc(-1 ... 1), tan(1 ... 2)
Some special values are implemented:
sin(PI/10), cos(2*PI/5), tan(123/8*PI), cot(-PI/12)
Translations by integer multiples of π are eliminated from the argument:
sin(x + 10*PI), cos(3 - PI), tan(x + PI), cot(2 - 10^100*PI)
All arguments that are rational multiples of π are transformed to arguments from the interval :
sin(4/7*PI), cos(-20*PI/9), tan(123/11*PI), cot(-PI/13)
sin(5*I), cos(5/4*I), tan(-3*I)
For other complex arguments, use expand to rewrite the result:
sin(5*I + 2*PI/3), cos(PI/4 - 5/4*I), tan(-3*I + PI/2)
expand(sin(5*I + 2*PI/3)), expand(cos(5/4*I - PI/4)), expand(tan(-3*I + PI/2))
The expand function implements the addition theorems:
expand(sin(x + PI/2)), expand(cos(x + y))
The combine function uses these theorems in the other direction, trying to rewrite products of trigonometric functions:
The trigonometric functions do not immediately respond to properties set via assume:
assume(n, Type::Integer): sin(n*PI), cos(n*PI)
Use simplify to take such properties into account:
assume(n, Type::Odd): sin(n*PI + x), simplify(sin(n*PI + x))
y := cos(x + n*PI) + cos(x - n*PI): y, simplify(y)
delete n, y:
Various relations exist between the trigonometric functions:
Use rewrite to obtain a representation in terms of a specific target function:
rewrite(tan(x)*exp(2*I*x), sincos), rewrite(sin(x), cot)
sin(arcsin(x)), sin(arccos(x)), cos(arctan(x))
Note that arcsin(sin(x)) does not necessarily yield x, because arcsin produces values with real parts in the interval :
arcsin(sin(3)), arcsin(sin(1.6 + I))
diff(sin(x^2), x), float(sin(3)*cot(5 + I))
limit(x*sin(x)/tan(x^2), x = 0)
series((tan(sin(x)) - sin(tan(x)))/sin(x^7), x = 0)