+//////////
+// psi function (aka polygamma function)
+//////////
+
+/** Evaluation of polygamma-function psi(n,x).
+ * Somebody ought to provide some good numerical evaluation some day... */
+static ex psi_eval(ex const & n, ex const & x)
+{
+ if (n.info(info_flags::numeric) && x.info(info_flags::numeric)) {
+ // do some stuff...
+ }
+ return psi(n, x).hold();
+}
+
+static ex psi_evalf(ex const & n, ex const & x)
+{
+ BEGIN_TYPECHECK
+ TYPECHECK(n,numeric)
+ TYPECHECK(x,numeric)
+ END_TYPECHECK(psi(n,x))
+
+ return psi(ex_to_numeric(n), ex_to_numeric(x));
+}
+
+static ex psi_diff(ex const & n, ex const & x, unsigned diff_param)
+{
+ ASSERT(diff_param==0);
+
+ return psi(n+1, x);
+}
+
+static ex psi_series(ex const & n, ex const & x, symbol const & s, ex const & point, int order)
+{
+ throw(std::logic_error("Nobody told me how to series expand the psi function. :-("));
+}
+
+REGISTER_FUNCTION(psi, psi_eval, psi_evalf, psi_diff, psi_series);
+