RuleBasedIntegration / Rubi

Rubi for Mathematica
http://rulebasedintegration.org
MIT License
228 stars 23 forks source link

Method to generate integrals on which Mathematica usually outperforms Rubi #14

Closed rljacobson closed 5 years ago

rljacobson commented 5 years ago

An easy way to produce an expression that is difficult to integrate is to differentiate a nasty expression. To give Mathematica an edge, we apply a Mathematica transformation that we know Mathematica can also reverse.

The general technique is to write an expression involving trig functions, apply TrigExpand or TrigToExp, and then differentiate (or vice versa). The result is the integrand. I have not found an example of an integral produced this way that Mathematica cannot integrate, though they may exist. On the other hand, Rubi either generates huge expressions, fails to integrate the expression, or in some cases produces optimal output.

(* Both can do this one, but Rubi does it better. *)
in = D[4 ArcCos[2 Sin[3 ArcTanh[x]]], x];

(* Now TrigExpand *)
in2 = TrigExpand[in];

Integrate[in2, x]
(* Same result as for original integrand. *)

Int[in2, x]
(* Produces four more integrals that Rubi can't integrate. *)

This suggests that some version of a TrigFactor and of an ExpToTrig integration rule would increase Rubi's performance on this class of integrals.

This and another example taken from the TrigToExp are in the attached notebook. Rubi Poor Performance.nb.zip

AlbertRich commented 5 years ago

Yes, as I said in my response to Rubi issue 11 and you point out above, it is easy to generate by differentiation expressions symbolic integrators, including Rubi, cannot integrate. Test Results shows thousands more Mathematica cannot integrate.

As the test results also show, Rubi performs well against the general purpose integrators provided by the major commercial computer algebra systems. However, rather than being a general purpose integrator, Rubi's design goal is to produce optimal antiderivatives for all instances from certain, fixed classes of integrands. For example, all integrands of the form (d+e x)^m (a+b x+c x^2)^p for all numeric and symbolic values of the parameters including 0.

So my recommendation to implementers of general purpose integrators is: If an integrand is of the form Rubi knows how to handle, use Rubi. If not, use the traditional "advanced" methods.