Save the Constants
When we have a polynomial:
p(x) = 5x² + 3x + 4
If we take a derivative. We get:
10x + 3
If we then integrate. We do not get p(x) back. We get some mangled poly, q(x).
The constant 4 is lost forever.
First, we take derivatives of the polynomial, p(x). Then we integrate the polynomial. Information gets destroyed by each derivative, for normal polynomials. By the time we get to q, q is not equal to p. q looks nothing like p because the terms of p have been killed off one at a time with differentiation. Integration cannot fix them. Intergration can add generic constants, but not the actual constants that have been destroyed. This lack of symmetry bothered me. So, here is a solution. We can make polynomials differentiation fully reversable.
We add the M operator. Imagine M is for memory.
Now the differentiation is fully reversable, and no information is erased.
What is M?
To remove M, we apply M inverse.
Definition of M inverse: we apply the limit as c -> 0.
If you save the constants, then you save the polynomial. This is probably not an original idea, but it is new to me. If you need to save all the info in your poly, you can keep it safe with the M operator in this situation.
We can check an example with sympy.
Get eric evers’s stories in your inbox
Join Medium for free to get updates from this writer.
A is a poly, apply M, apply D, apply I, and L is inverse M.
lidma = a
looks good. IDA is mangled, check.
a : 2.0*x**1.0 + 1.0*x**2.0 + 3.0
ma : 1.0*x**m*(2.0*x**1.0 + 1.0*x**2.0 + 3.0)
dma : 1.0*m*x**m*(2.0*x**1.0 + 1.0*x**2.0 + 3.0)/x + 1.0*x**m*(2.0*x**1.0 + 2.0)
idma : x**m*(2.0*x**1.0 + 1.0*x**2.0 + 3.0)
lidma : 2.0*x**1.0 + 1.0*x**2.0 + 3.0
vs ida : 2.0*x + 1.0*x**2.0
note: I used simplify to clean things up between some steps.
The sympy program listing:
==========
import sympy as sp
x = sp.Symbol("x")
m = sp.Symbol("m", constant=True)
a = ( 1.0*x**2.0 + 2.0*x**1.0 + 3.0)
ma = ( 1.0*x**m) * a
dma = sp.diff( ma, x)
idma = sp.simplify( sp.integrate( dma, x))
# 2.0*x**1.0
print(" ", "\n")
print(" a : ", a, "\n")
print(" ma : ", ma, "\n")
print(" dma : ", dma, "\n")
print(" idma : ", idma, "\n")
print(" lidma : ", sp.limit( idma, m, 0), "\n")
print("vs ida : ", sp.integrate( sp.diff(a)), "\n")
==========
Are they really polynomials?
Are all the values at each step actually a legal polynomial? Well, since we do not define c until the last step, we could just say c is a large enough integer temporarily, without specifying a particular value.
Also, the final output is a proper poly, with positive exponents. So things do clean up at the end.





