Using a function without specifying it

asked 1 year ago

Cyrille gravatar image

updated 1 year ago

I want to ask sagemath if

|xa|f(x)dx=a(ax)f(x)dx+a(xa)f(x)dx

which is obviously true without specifying f(x) (a probability density). Is this possible in SageMath ?

Preview: (hide)

Comments

I would assume the left-hand side is computed via

from sage.symbolic.integration.integral import definite_integral
x,a = var('x a')
f = function('f')
definite_integral(abs_symbolic(x-a)*f(x), x, -oo, +oo)

but it somehow fails.

Max Alekseyev gravatar imageMax Alekseyev ( 1 year ago )

Sorry there was a little mistake. I correct it in the text

Cyrille gravatar imageCyrille ( 1 year ago )

According to your remark the question is why SageMath is not able return true to

bool(definite_integral(abs_symbolic(x-a)*f(x), x, -oo, +oo)==definite_integral(abs_symbolic(a-x)*f(x), x, -oo, a)+definite_integral(abs_symbolic(x-a)*f(x), x, a, +oo)).

Cyrille gravatar imageCyrille ( 1 year ago )

One could imagine rewriting the left-hand side by substituting xa=(xa)χa(x)+(ax)χ<a(x) where the χ's are indicator functions, expanding the integrand, using linearity of the integral, and replacing the indicator function factors by narrowed integration bounds. That's easier said than done-with-Sage, though.

rburing gravatar imagerburing ( 1 year ago )
1

This is true for a real function of a real variable and for a real ; in this case,|xa| is of course either xa or ax depending on the sign of xa. If either x or a is complex, this is no longer true.

Furthermore, in the complex case, you may have discrepancies if the integration paths of the left and right hands of your equation loop around different poles.

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 1 year ago )