# Revision history [back]

There is no need to declare alpha, beta, gamma as symbolic variables before defining them as symbolic functions. So you could simplify the declaration of variables and functions as follows.

sage: t = SR.var('t')
sage: alpha(t) = function('alpha')(t)
sage: beta(t) = function('beta')(t)
sage: gamma(t) = function('gamma')(t)


Then you define:

sage: mi(t) = sin(beta)^2*diff(alpha(t), t) + (cos(beta)*diff(alpha(t), t) +diff(gamma(t), t))*cos(beta)
sage: mi(t)
sin(beta(t))^2*diff(alpha(t), t) + (cos(beta(t))*diff(alpha(t), t) + diff(gamma(t), t))*cos(beta(t))


Then you expand and apply trig_simplify:

sage: mi_e = mi(t).expand()
sage: mi_e_ts = mi_e.trig_simplify()


This is what you get:

sage: mi_e
cos(beta(t))^2*diff(alpha(t), t) + sin(beta(t))^2*diff(alpha(t), t) + cos(beta(t))*diff(gamma(t), t)
sage: mi_e_ts
cos(beta(t))*gamma(t)*psi(t) + diff(alpha(t), t)


The result involves psi, so we investigate what it is. Sage allows you to use blah? to get the documentation of blah. Use this as follows:

sage: psi?
Signature:      psi(x, *args, **kwds)
Docstring:
The digamma function, psi(x), is the logarithmic derivative of the
gamma function.

psi(x) = frac{d}{dx} log(Gamma(x)) =
frac{Gamma'(x)}{Gamma(x)}

We represent the n-th derivative of the digamma function with
psi(n, x) or psi(n, x).

EXAMPLES:

sage: psi(x)
psi(x)
sage: psi(.5)
-1.96351002602142
sage: psi(3)
-euler_gamma + 3/2
sage: psi(1, 5)
1/6*pi^2 - 205/144
sage: psi(1, x)
psi(1, x)
sage: psi(1, x).derivative(x)
psi(2, x)

sage: psi(3, hold=True)
psi(3)
sage: psi(1, 5, hold=True)
psi(1, 5)
Init docstring: x.__init__(...) initializes x; see help(type(x)) for signature
File:           /path/to/sage-8.1/local/lib/python2.7/site-packages/sage/functions/other.py
Type:           function