Loïc Grenié on Fri, 20 Jan 2023 11:43:52 +0100

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

Re: Computing integer sequences via integrals

    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)

      sage does not know a primitive function for floor(x)^2. If I did not make
  a mistake, I think
  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]

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.