Methods
Integration
I wrote a python script to calculate the sequences with the
df(x) = f(x) - (x - 1)
definition of a differential.
#!/bin/python
size = 11
power = 9
# initialize the sequence with 0
seq = {}
for i in range(-size, size):
seq[i] = 0
# the first term in a sequence, 0 by default
c = {}
for p in range(0, power + 1):
c[p] = 0
# specific terms
c[0] = 1
# # x^4
# power = 4
# c[0] = 24
# c[1] = -36
# c[2] = 14
# c[3] = -1
# c[4] = 0
for p in range(0, power + 1):
term = c[p]
print(term)
for i in range(1, size):
term += seq[i]
seq[i] = term
print(seq[i])
print("endl")
I run it with the following one-liner to produce nice tables:
$ ./script.py | tr '\n' ' ' | tr "endl" "\n" | column -t
1 1 1 1 1 1 1 1 1 1 1
0 1 2 3 4 5 6 7 8 9 10
0 1 3 6 10 15 21 28 36 45 55
0 1 4 10 20 35 56 84 120 165 220
0 1 5 15 35 70 126 210 330 495 715
0 1 6 21 56 126 252 462 792 1287 2002
0 1 7 28 84 210 462 924 1716 3003 5005
0 1 8 36 120 330 792 1716 3432 6435 11440
0 1 9 45 165 495 1287 3003 6435 12870 24310
0 1 10 55 220 715 2002 5005 11440 24310 48620
To derive the expressions of the sequences, I solve simultaneous
equations with the terms after the initial one. The power
variable
corresponds to the degree of the polynomial. The above code generates
Pascal's triangle. To find the third integral/sequence, you would need
to solve for a polynomial of the second degree.
s(x) = ax^2 + bx + c
The numbers in the table represent s(x) at a specific x (the place of the term in the sequence).
We know c
s(0) = c = first term of the sequence
and want to find a and b. From the table we get these simultaneous equations:
s(1) = a(1)^2 + b(1) + c = 1
s(2) = a(2)^2 + b(2) + c = 4
so
a(1)^2 + b(1) = 1 - c
a(2)^2 + b(2) = 4 - c
c = 0
in this case
a(1)^2 + b(1) = 1
a(2)^2 + b(2) = 4
2a + b = 1
4a + 2b = 4
a = 1/2
b = 1/2
And the final expression becomes:
s(x) = (1/2)x^2 + (1/2)x
Factorized:
s(x) = (1/2)(x + 1)(x + 0)
Differentiation
The program I wrote to find the differentials of the x^n sequences is, sadly, not so nice and simple so I won't post the code here. You can get it by running:
$ git clone git://git.yotsev.xyz/differentials.git
You get similar tables from it to the one above and follow the same algorithm to find the expressions of a given differential. The only difference is that the initial term is not the leftmost one but the one bellow the 0 of the initial sequence.
You can also switch between the two definitions of a differential by supplying an argument to the program:
$ ./prog prior
for the one above and
$ ./prog post
for the other one. It uses the post
one by default.