Re: Computing integer sequences via integrals
Loïc Grenié <[email protected]>
| Newsgroups | gmane.comp.mathematics.pari.devel |
|---|---|
| Message-ID | <CAMLkfFTDhOR2TL4eGsq-HSrY8wBiPptUPA26z75eEe0xu7FNWg@mail.gmail.com> |
Dear Georgi,
On Fri 20 Jan 2023 at 08:20, Georgi Guninski wrote:
> I am trying to compute integer sequences via closed
> forms of definite integrals, but probably this is impossible.
>
It depends what you intend by "impossible". The mathematical
expression
might be possible, but you may not be able to compute it using a
well-defined
primitive of the function you are integrating.
> The question is: which integer sequences can be computed
> by integrals?
>
> Partial results:
>
> Trying to "discretize" the reals, we are using floor()
> and the area of the definite integrals.
>
> For a start consider the plot of floor(x).
> ? ploth(x=1,10,floor(x))
>
> The area is the union of rectangles and for integer
> bounds the area is integer.
>
> sagemath computes the following indefinite integrals:
> sage: integrate(floor(x),x)
> 1/2*(2*x - floor(x) - 1)*floor(x)
>
This is a slight abuse: at integers the resulting function has no
derivative,
so it is not really a primitive of floor(x). However this function
coincides with
the integral of floor(t) for t from 0 to x.
> sage: integrate(floor(x)^2,x)
> x*floor(x)^2
>
sage does not know a primitive function for floor(x)^2. If I did not
make
a mistake, I think
(x-floor(x)*2/3-1/2)*floor(x)^2+floor(x)/6
could be a function which coincides with the integral of floor(t) for t
from 0 to x,
hence the "primitive" you are looking for.
> The area for floor(x) and the sum(i=1,N-1,x) appear to be computed
> correctly:
> sage: I1=integrate(floor(x),x)
> sage: N=13;[I1(x=N)-I1(x=1)-N*(N-1)/2]
> [0]
>
> The area for floor(x)^2 doesn't work for me, why?
>
Because nobody cared to insert a "primitive" for floor(x)^2 in sage.
> floor() might not be elementary function, but there is closed
> form for it using exp() and log(), taking the principal
> branch of the logarithm:
>
> ? floor1(x)=x - 1/2*I*log(-exp(-2*I*Pi*x))/Pi - 1/2
> %12 = (x)->x-1/2*I*log(-exp(-2*I*Pi*x))/Pi-1/2
> ? floor1(13.1)
> %13 = 13.000000000000000000000000000000000000 + 0.E-39*I
>
The closed form cannot be used to compute a "primitive", because there
are jumps at integers.
Best,
Loïc