Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I can't get Sage to do this directly either. Perhaps there is a way that I'm missing.

However, you can use SymPy to do it. The following code does the job.

import sympy as sp
sp.expand_trig(sin(pi/16))

However, the resulting object is not a Sage object. To get it in the appropriate ring for Sage computations, you can convert it to the Symbolic Ring as follows.

SR( sp.expand_trig(sin(pi/16)) )

The result will then have the type: sage.symbolic.expression.Expression.

You can check this by doing:

q = sp.expand_trig(sin(pi/16))
type(q)