Sine 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.
sin(x
)
For sine in MATLAB^{®}, see sin
.
sin(x)
represents the sine function.
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 sine function in terms of
other trigonometric functions and vice versa. See Example 5.
The inverse function is implemented by arcsin
.
See Example 6.
The float attributes are kernel functions, thus, floatingpoint evaluation is fast.
When called with a floatingpoint argument, sin
is
sensitive to the environment variable DIGITS
which determines
the numerical working precision.
Call sin
with the following exact and symbolic
input arguments:
sin(PI), sin(1), sin(5 + I), sin(PI/2), sin(PI/11), sin(PI/8)
sin(x), sin(x + PI), sin(x^2  4)
Floating point values are computed for floatingpoint arguments:
sin(123.4), sin(5.6 + 7.8*I), sin(1.0/10^20)
Floating point intervals are computed for interval arguments:
sin(0...1), sin(20...30), sin(0...5)
Some special values are implemented:
sin(PI/10), sin(2*PI/5), sin(123/8*PI), sin(PI/12)
Translations by integer multiples of π are eliminated from the argument:
sin(x + 10*PI), sin(3  PI), sin(x + PI), sin(2  10^100*PI)
All arguments that are rational multiples of π are transformed to arguments from the interval :
sin(4/7*PI), sin(20*PI/9), sin(123/11*PI), sin(PI/13)
Arguments that are rational multiples of I
are
rewritten in terms of hyperbolic functions:
sin(5*I), sin(5/4*I), sin(3*I)
For other complex arguments, use expand
to rewrite the result:
sin(5*I + 2*PI/3), sin(PI/4  5/4*I), sin(3*I + PI/2)
expand(sin(5*I + 2*PI/3)), expand(sin(5/4*I  PI/4)), expand(sin(3*I + PI/2))
The expand
function
implements the addition theorems:
expand(sin(x + PI/2)), expand(sin(x + y))
The combine
function
uses these theorems in the other direction, trying to rewrite products
of trigonometric functions:
combine(sin(x)*sin(y), sincos)
The trigonometric functions do not immediately respond to properties
set via assume
:
assume(n, Type::Integer): sin(n*PI), sin((2*n + 1)*PI/2)
Use simplify
to
take such properties into account:
simplify(sin(n*PI)), simplify(sin((2*n + 1)*PI/2))
assume(n, Type::Odd): sin(n*PI + x), simplify(sin(n*PI + x))
y := sin(x + n*PI) + sin(x  n*PI); simplify(y)
delete n, y
Use rewrite
to
obtain a representation in terms of a specific target function:
rewrite(sin(x)*exp(2*I*x), exp); rewrite(sin(x), cot)
The inverse function is implemented as arcsin
:
sin(arcsin(x)), arcsin(sin(x))
Note that arcsin(sin(x))
does not necessarily
yield x
because arcsin
produces
values with real parts in the interval $$\left[\frac{\pi}{2},\frac{\pi}{2}\right]$$:
arcsin(sin(3)), arcsin(sin(1.6 + I))
diff
, float
, limit
, taylor
and other system
functions handle expressions involving the trigonometric functions:
diff(sin(x^2), x), float(sin(3)*cot(5 + I))
limit(sin(x)/x, x = 0)
taylor(sin(x), x = 0)

Arithmetical expression or a floatingpoint interval
x