- Join over
**1.5M+ people** - Join over
**100K+ communities** - Free
**without limits** - Create
**your own community**

That has several advantages and also some disadvantages. One advantage is that you can rewrite the pattern-matching code to if statements that work better with other languages because Mathematica is strong in pattern-matching and it is hard to replicate the behavior in e.g. python. The different behavior of MatchPy in python is actually the reason why Rubi cannot work successfully under sympy right now.

Another advantage is that walking the if tree is faster. Right now, Mathematica tests all Rubi rules and applies the first one that matches. So in the worst case, you need to sequentially check all 6600+ rules. This is similar for finding a match in a long list. In the decision tree this is faster, because you start by e.g. finding the general class of the integrand which is probably only <50 tests. Then you test the conditions on the parameters.. That should reduce the run-time.

I am currently manually compiling Rubi 4's pattern matching rules into an if-then-else based decision tree for Rubi 5. I recently compiled the rules for integrands of the form (a+b*x+c*x^2)^p in the notebook file "1.2.1.1 (a+b x+c x^2)^p.nb".

@AlbertRich Do you compile those if-then-else trees manually from the patterns?

@CeaVi The Rubi 4 and the equivalent Rubi 5 version of this file is available for viewing as a pdf file at

https://rulebasedintegration.org/Rubi%204%20vs%205/Rubi%204%20-%201.2.1.1%20(a+b%20x+c%20x%5E2)%5Ep.pdf

https://rulebasedintegration.org/Rubi%204%20vs%205/Rubi%205%20-%201.2.1.1%20(a+b%20x+c%20x%5E2)%5Ep.pdf

and for downloading at

https://rulebasedintegration.org/Rubi%204%20vs%205/Rubi%204%20-%201.2.1.1%20(a+b%20x+c%20x%5E2)%5Ep.nb

https://rulebasedintegration.org/Rubi%204%20vs%205/Rubi%205%20-%201.2.1.1%20(a+b%20x+c%20x%5E2)%5Ep.nb

https://rulebasedintegration.org/Rubi%204%20vs%205/Rubi%204%20-%201.2.1.1%20(a+b%20x+c%20x%5E2)%5Ep.pdf

https://rulebasedintegration.org/Rubi%204%20vs%205/Rubi%205%20-%201.2.1.1%20(a+b%20x+c%20x%5E2)%5Ep.pdf

and for downloading at

https://rulebasedintegration.org/Rubi%204%20vs%205/Rubi%204%20-%201.2.1.1%20(a+b%20x+c%20x%5E2)%5Ep.nb

https://rulebasedintegration.org/Rubi%204%20vs%205/Rubi%205%20-%201.2.1.1%20(a+b%20x+c%20x%5E2)%5Ep.nb

A compiler capable of transforming Rubi 4's pattern matching rules into an if-then-else decision tree (aka a discrimination net) would

- allow the Rubi source to remain in elegant, human-readable form, rather than a monolithic if-then-else tree virtually impossible to comprehend and debug,
- make it relatively easy for others to port Rubi to any commercial or free CAS, since all serious systems support an if-then-else control construct, and
- (most important to me) allow me to devote full time to extending Rubi's mathematical capabilities. :wink:

I have difficulties to calculate the integral below

Assuming[{0 < z < 1},

Integrate[

Integrate[

```
Assuming[{0 < z < 1},
Integrate[
g^2 ArcTanh[Sqrt[1 - 1/g^2]/R] Exp[-z g], {g, 1, Infinity}]]
```

`Int[g^2 ArcTanh[Sqrt[1 - 1/g^2]/R] Exp[-z g], g]`

Then, you will find that there are several parts that Rubi can't solve. One of them is fairly simple but an antiderivative cannot be computed:

`Int[1/(E^(g*z)*Sqrt[1 - g^2]), g]`

Even if you remove the

`z`

from the expression, Rubi and Mathematica cannot find a closed form of the antiderivative.
@betatron_gitlab Rubi is a package for calculating the symbolic antiderivatives of expressions. So if you have an expression that cannot be integrated with Mathematica, often but not always Rubi can do it. However, like in your case, where it is not possible, you will most likely need to use numeric integration.

well

@betatron_gitlab "Please, what is the utility of Rubi for a physicist?" There is a Physics paper using Rubi https://arxiv.org/pdf/1811.04892.pdf titled "An Application of Rubi: Series Expansion of the Quark Mass

Renormalization Group Equation"

Renormalization Group Equation"

Thanks Nasser.

I'm having trouble looking up a reference for a RUBI rule

The rule (rules actually) are 2485 and 2490. Where can I look this up?

Do you thing you can do something about this?

Note that for both forms of the above integrals, Mathematica 11.3 returns a multipage "wall paper" result. Maple 2018 returns the integral unevaluated.