Rubi: Solving Integrals, one Rule at a Time

Patrick Scheibe, PhD 
Max Planck Institute for Human Cognitive and Brain Sciences

About Rubi

Developed by Albert Rich starting in 2008

Rule-based system for finding optimal antiderivatives for large classes of mathematical expressions

Almost 7000 integration rules organized as decision tree

Test-suite with over 72k integration problems

Open-source Paclet available on GitHub

Basic Example

Installation

PacletInstall["https://rulebasedintegration.org/Rubi-4.16.1.0.paclet"]

<<Rubi`

Integration of Expressions

Use it similar to Integrate

Int[x*(1-x)^2, x]

Integrate[x*(1-x)^2, x]

Integrate[x*(1-x)^2,{x,0,12}]
Int[x*(1-x)^2,{x,0,12}]

How is Rubi Different from other Integrators?

Other integrators often rely on complex algorithms like the Risch algorithm

They provide the answer, but don’t provide how it was calculated

Antiderivatives are not unique and can drastically vary in quality and size

Rubi tries to give “optimal antiderivatives” and can show how they were calculated

Quality: Size of the Antiderivative

Let’s use a variation of the first example

resRubi=Int[x*(1-x)^2023, x]

TreeForm[resRubi]

LeafCount[resRubi]

resMMA=Integrate[x*(1-x)^2023, x]

D[resMMA,x]//Simplify

LeafCount[resMMA]

Quality: Continuous Antiderivative

exp=3/(5-4*Cos[x]);
resRubi=Int[exp, x]

resMMA=Integrate[exp,x]

D[resRubi, x]//Simplify
D[resMMA, x]//Simplify

Plot[{exp, resRubi}, {x, -2Pi, 2Pi}, 
PlotLegends->{"Original", "Antiderivative"},
PlotLabel->"Rubi's Antiderivative",
Frame->True,
GridLines->Automatic,
Axes->False]

Plot[{exp, resMMA}, {x, -2Pi, 2Pi}, 
PlotLegends->{"Original", "Antiderivative"},
PlotLabel->"Mathematica's Antiderivative",
Frame->True,
GridLines->Automatic,
Axes->False]

Mathematica does a great job taking care of discontinuities

Integrate[exp,{x,-4/3Pi,-1/3Pi}]//N

Simply plugging in values into the Rubi solution gives the same result

Subtract@@(resRubi/.x->{-1/3Pi,-4/3Pi})//N

The same thing does not work for Mathematica’s antiderivative

Subtract@@(resMMA/.x->{-1/3Pi,-4/3Pi})//N

Understanding how the Antiderivative was found

Rubi can show each rule that was applied in finding the antiderivative

Steps@Int[x^n,x]

Steps@Int[Sec[x]^2+Sec[x]^2*Tan[x],x]

Summarizing

https://rulebasedintegration.org

Albert Rich is the brain behind the integration rules

Nasser Abbasi runs Rubi tests and compares other CAS

Lots of other people helped, e.g. David Jeffrey, Daniel Lichtblau, David Stoutemyer, Martin Welz

Albert Rich