Skip to content

Instantly share code, notes, and snippets.

@paniq
Created February 21, 2019 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paniq/df7f21bb8a4a9363dba486f44904cbb0 to your computer and use it in GitHub Desktop.
Save paniq/df7f21bb8a4a9363dba486f44904cbb0 to your computer and use it in GitHub Desktop.
say we start with two linear functions
f(x) = a*x + b
g(x) = c*x + d
from previous work, we have their integrals (ignoring the offset)
F(x) = 1/2*a*x^2 + b*x
G(x) = 1/2*c*x^2 + d*x
now we compare the integral of the product of f(x)*g(x)
j(x) = [f(x)*g(x)]dx = 1/3*a*c*x^3 + 1/2*(b*c + a*d)*x^2 + b*d*x
with the (much easier to compute) derivative of the product of F(x)*G(x)
k(x) = (F(x)*G(X))' = a*c*x^3 + 3/2*(b*c + a*d)*x^2 + 2*b*d*x
when we compare the coefficients of j(x) and k(x) by division, we notice that they relate like this:
1/2 * (2*b*d) = b*d
1/3 * (3/2*(b*c + a*d)) = 1/2*(b*c + a*d)
1/3 * (a*c) = a*c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment