CoCalc Shared Filestest / code.sagews
Author: William A. Stein
sin?

/ext/sage/sage-8.0/local/lib/python2.7/site-packages/urllib3/contrib/pyopenssl.py:46: DeprecationWarning: OpenSSL.rand is deprecated - you should use os.urandom instead import OpenSSL.SSL
File: /ext/sage/sage-8.0/local/lib/python2.7/site-packages/sage/functions/trig.py
Signature : sin(self, coerce=True, hold=False, dont_call_method_on_arg=False, *args)
Docstring :
The sine function.

EXAMPLES:

sage: sin(0)
0
sage: sin(x).subs(x==0)
0
sage: sin(2).n(100)
0.90929742682568169539601986591
sin
sage: sin(x)._sympy_()
sin(x)

We can prevent evaluation using the "hold" parameter:

sage: sin(0,hold=True)
sin(0)

To then evaluate again, we currently must use Maxima via
"sage.symbolic.expression.Expression.simplify()":

sage: a = sin(0,hold=True); a.simplify()
0

If possible, the argument is also reduced modulo the period length
2pi, and well-known identities are directly evaluated:

sage: k = var('k', domain='integer')
sage: sin(1 + 2*k*pi)
sin(1)
sage: sin(k*pi)
0