Bill Allombert on Sat, 30 Sep 2023 10:05:41 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: evaluation of Bernoulli polynomials


On Fri, Sep 29, 2023 at 09:06:16PM -0400, Charles Greathouse wrote:
> The implementation is straightforward:
> 
> GEN
> bernpol_const(long k, GEN x)
> {
>   GEN C, S;
>   long i;
>   pari_sp btop;
>   constbern(k >> 1); /* cache B_2, ..., B_2[k/2] */
>   C = vecbinomial(k);
>   S = gen_0;
>   btop = avma;
>   for (i = 0; i <= k; ++i)
>   {
>     S = gadd(gmul(S, x), gmul(gel(C,i+1), bernfrac(i)));
>     if (gc_needed(btop, 1)) S = gerepileuptoint(btop, S);
>   }
>   return S;
> }

But would that be any faster than subst(bernpol(k),'x, a) ? 
That is the point.

Cheers,
Bill.