Example #1
0
 static RCP<const Basic> diff(const Beta &self,
         const RCP<const Symbol> &x) {
     RCP<const Basic> beta_arg0 = self.get_args()[0];
     RCP<const Basic> beta_arg1 = self.get_args()[1];
     RCP<const Basic> diff_beta_arg0 = beta_arg0->diff(x);
     RCP<const Basic> diff_beta_arg1 = beta_arg1->diff(x);
     return mul(self.rcp_from_this(), add(mul(polygamma(zero, beta_arg0), diff_beta_arg0),
             sub(mul(polygamma(zero, beta_arg1), diff_beta_arg1),
             mul(polygamma(zero, add(beta_arg0, beta_arg1)), add(diff_beta_arg0, diff_beta_arg1)))));
 }
Example #2
0
int main()
{
    double x;

    printf("  x       %-22s %-22s %-22s\n",
        "psi(x)", "psi'(x)", "psi''(x)");
    for (x = -5.5; x <= 0.5; x++)
        printf("%4.1f  % -22.15g % -22.15g % -22.15g\n",
            x, psi(x), polygamma(1, x), polygamma(2, x));
    for (x = 1; x <= 5; x++)
        printf("%4.1f  % -22.15g % -22.15g % -22.15g\n",
            x, psi(x), polygamma(1, x), polygamma(2, x));
    for (x = 10; x <= 40; x += 10)
        printf("%4.1f  % -22.15g % -22.15g % -22.15g\n",
            x, psi(x), polygamma(1, x), polygamma(2, x));
    printf("\n  x       %-22s %-22s %-22s\n",
        "psi3(x)", "psi4(x)", "psi5(x)");
    for (x = -5.5; x <= 0.5; x++)
        printf("%4.1f  % -22.15g % -22.15g % -22.15g\n",
            x, polygamma(3, x), polygamma(4, x), polygamma(5, x));
    for (x = 1; x <= 5; x++)
        printf("%4.1f  % -22.15g % -22.15g % -22.15g\n",
            x, polygamma(3, x), polygamma(4, x), polygamma(5, x));
    for (x = 10; x <= 40; x += 10)
        printf("%4.1f  % -22.15g % -22.15g % -22.15g\n",
            x, polygamma(3, x), polygamma(4, x), polygamma(5, x));
    return EXIT_SUCCESS;
}
Example #3
0
 static RCP<const Basic> diff(const LogGamma &self,
         const RCP<const Symbol> &x) {
     RCP<const Basic> arg = self.get_args()[0];
     return mul(polygamma(zero, arg), arg->diff(x));
 }
Example #4
0
 static RCP<const Basic> diff(const Gamma &self,
         const RCP<const Symbol> &x) {
     RCP<const Basic> gamma_arg = self.get_args()[0];
     return mul(mul(self.rcp_from_this(), polygamma(zero, gamma_arg)), gamma_arg->diff(x));
 }
Example #5
0
T polygamma(T z,unsigned m)
{
	return polygamma(z,m,boost::math::policies::policy<>());
}
Example #6
0
T tgamma_stirl(T z)
{
	return polygamma(z,boost::math::policies::policy<>());
}