# Integral that Mathematica can solve but Rubi can't

I am having some trouble with a particular integral that I would like to solve using Rubi https://rulebasedintegration.org/

Mathematica can return an analytic form of the integral but Rubi cannot. This seems odd as Rubi is supposedly an extension to Mathematica's symbolic rules for integrals.

Mathematica can return an analytic expression for the integral but Rubi just returns the Int function with the integrand unevaluated.

I list the integrand below and the integration is from t from -inf to inf, all other parameters are real numbers.

1/(γ σ) (Exp[-(Abs[2 t + δ]/σ) - Abs[-2 t + δ - 2 τ]/γ]
UnitStep[t + δ/2]^2 UnitStep[t - δ/2 + τ]^2 -
2 Exp[-((σ Abs[-2 t + δ] + γ Abs[2 t + δ] + σ Abs[-2 t + δ - 2 τ] +
γ Abs[2 t + δ + 2 τ])/(2 γ σ))] Cos[τ (-ω1 + ω2)] UnitStep[t - δ/2]
UnitStep[t + δ/2] UnitStep[t - δ/2 + τ] UnitStep[t + δ/2 + τ] +
Exp[-(Abs[-2 t + δ]/γ) - Abs[2 t + δ + 2 τ]/σ]
UnitStep[t - δ/2]^2 UnitStep[t + δ/2 + τ]^2)


According to the developer, Albert Rich, "To keep this already massive project at least theoretically finite in scope, I have limited it to rules for integrating certain general forms involving algebraic, elementary and a fixed set of special functions. That does not include non-analytic functions like the absolute value and Dirac-delta functions." [Source: personal communication.]

Hence I expect the step function was not included because it is non-analytic.

If you want to integrate using Rubi, you might try experimenting with:

1/Pi (3 Pi/4 + ArcTan[x - 1] + ArcTan[(2 - x)/x])


which this paper claims is an exact analytic form of the unit step function:

Venetis, J. (2014). An analytic exact form of the unit step function. Mathematics and Statistics, 2(7), 235-237.

Since you are computing definite integrals, I would caution you that Rubi computes them by first determining the indefinite integral, substituting the upper and lower limits of integration, and subtracting. This is only guaranteed to be valid for integrands that are continuous on the closed interval between and including those limits.

• To amplify the caution in the last paragraph about continuous integrands, the Question's integrand is discontinuous. For instance, at $(\delta, \gamma, \sigma, \tau, \omega_1, \omega_2) = (2,3,5,7,11,13)$, the integrand is discontinuous at $t = -1$ and at $t = 1$. – Eric Towers Apr 13 at 14:47
• I think (x + Sqrt[x^2])/(2 x) is a simpler form for the unit step function, and it has the advantage that its discontinuity line is straight in the complex plane (this function is equal to UnitStep[Re[x]]), unlike your expression with ArcTans, where discontinuity is curved. – Ruslan Apr 13 at 19:38
• Completely agree with @Ruslan . It is not even possible to compute Integrate[UnitStep[x] UnitStep[1 - x], {x, -\[Infinity], \[Infinity]}] with your parametrization. – yarchik Apr 13 at 19:51
• While the first part of the answer is useful in providing additional information on Rubi, the second part is misleading. – yarchik Apr 13 at 19:52
• @yarchik How and why would you recommend rewording it? – theorist Apr 15 at 9:22

Rubi does not have rules for UnitStep. I just searched the whole source code of Rubi for UnitStep and it did not show up in any rule.

<<Rubi
Int[UnitStep[t], t]


Integrate[UnitStep[t], t]


Rubi does not support Piecewise functions

f[t_] := Piecewise[{{0, t < 0}, {1, t >= 0}}]
Int[f[t], t]


Integrate[f[t], t]


You could ask Albert Rich, the Author of Rubi on this, he would know best why that is. He reads the Rubi-Gitter forum.

If you can reformulate the integral itself yourself to avoid UnitStep` in the integrand then that is one possibility.