CoCalc
Sharedsupport / 2014-10-25-better-docstrings.sagewsOpen in CoCalc

Examples for support purposes...

Note the displayed output of docstrings and source code is better now, since it is syntax highlighted. Similarly, if you put the cursor after the ? and press, tab, you'll see a better popup.

sin?
File: /usr/local/sage/sage-6.3.beta6/local/lib/python2.7/site-packages/sage/functions/trig.py
Docstring:
   The sine function.

EXAMPLES:

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

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

TESTS:

   sage: conjugate(sin(x))
   sin(conjugate(x))
   sage: sin(complex(1,1))     # rel tol 1e-15
   (1.2984575814159773+0.6349639147847361j)

sin??
   File: /usr/local/sage/sage-6.3.beta6/local/lib/python2.7/site-packages/sage/functions/trig.py
   Source:
   class Function_sin(GinacFunction):
    def __init__(self):
        """
        The sine function.

        EXAMPLES::

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

        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
        :meth:`sage.symbolic.expression.Expression.simplify`::

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

        TESTS::

            sage: conjugate(sin(x))
            sin(conjugate(x))
            sage: sin(complex(1,1))     # rel tol 1e-15
            (1.2984575814159773+0.6349639147847361j)

        """
        GinacFunction.__init__(self, "sin", latex_name=r"\sin",
                conversions=dict(maxima='sin',mathematica='Sin'))