## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
Albert D. Rich
@AlbertRich
Of course, I'm delighted when I hear that Rubi is being used for research. Also when it's used as a pedagogical tool that can show the steps like those an experienced mathematician might use to integrate an expression.
As to the point you made: Yes, the paragraph you quoted from our paper is not true, at least not now. When Rubi was still in its infancy, a goal of mine was to make mutually exclusive the application conditions of its rules. Then the order rules were processed by the host CAS would not matter.
However as Rubi grew in size, achieving that lofty goal became impractical. So Rubi 4 does depend on the order rules are processed by the host. Happily however, the issue of mutual exclusivity is moot for Rubi 5 since the order of rule application is entirely determined by its if-then-else decision tree.
As to the question you raised: Yes, in Rubi 4 the application conditions of some rules are there just to achieve mutual exclusivity. They remain a harmless remnant of the original lofty goal described above. These superfluous application conditions will not affect Rubi 5's decision tree.
Aloha from Hawaii,
Albert
Momchil Peychev
@mpeychev_gitlab
@AlbertRich , thanks a lot for your clarifications! As a bit of a follow up, do you have any rough estimate what fraction of the current Rubi-4 rules have these extra superfluous conditions which guarantee mutual exclusivity? I imagine that there are not too many of them and/or these are predominantly some (very) special case rules which are not used that often? Thanks
Albert D. Rich
@AlbertRich
@mpeychev_gitlab Since they are harmless, I have no idea the percentage of rules having superfluous conditions. I don't understand why you are concerned about them.
Albert D. Rich
@AlbertRich

@miguelraz Thanks for pointing out that

I also found line 1717 of 1.3.2 Algebraic functions to be malformed:

  1717 (* {Sqrt[1+x^2]/(1-x^3), x, 0} *)
You can replace this line with
{Sqrt[1+x^2]/(1-x^3), x, 12, (2/3)*ArcTan[(1 + x)/Sqrt[1 + x^2]] + (1/3)*Sqrt[2]*ArcTanh[(1 + x)/(Sqrt[2]*Sqrt[1 + x^2])]}
Note that Rubi 4.16.1 can't get this simple antiderivative, but the version of Rubi 4 currently under development can.
Miguel Raz Guzmán Macedo
@miguelraz
@AlbertRich no worries!
I found these other offenders:
/MathematicaSyntaxTestSuite-4.16.0/1 Algebraic functions/1.3 Miscellaneous/1.3.2 Algebraic functions.m
┌ Warning: (* {(Sqrt[x]+x)^(2/3), x, 0} *)

/MathematicaSyntaxTestSuite-4.16.0/1 Algebraic functions/1.3 Miscellaneous/1.3.2 Algebraic functions.m
┌ Warning: (* {(-3*x+x^2)^(-1/3), x, 0} *)

/MathematicaSyntaxTestSuite-4.16.0/1 Algebraic functions/1.3 Miscellaneous/1.3.2 Algebraic functions.m
┌ Warning: (* {1/Sqrt[a*x+b*x^3], x, 0} *)

/MathematicaSyntaxTestSuite-4.16.0/1 Algebraic functions/1.3 Miscellaneous/1.3.2 Algebraic functions.m
┌ Warning: (* {E^(a + b*x + c*x^2)/(d + e*x)^2, x, 0} *)
Sorry for the silly parsing questions, but:
1. Why is E^x used instead of Exp[x]?
2. What do the underscores in Int([a_. + b_.*x_), x_Symbol] mean?
Miguel Raz Guzmán Macedo
@miguelraz
The translation to Julia of Rubi rules is almost complete!
Albert D. Rich
@AlbertRich
@miguelraz These problems were probably commented out because they hung earlier versions of Rubi. I restored them and included their optimal antiderivatives as the fourth element of the problem.
The underscore following a variable in Mathematica patterns indicates the variable can stand for any mathematical expression.
To have any hope of successfully porting Rubi 4 to Julia, you need to fully understand how Mathematica's pattern matching works.
Miguel Raz Guzmán Macedo
@miguelraz
@AlbertRich Thanks. Good to know they've been handled.
Miguel Raz Guzmán Macedo
@miguelraz
Also, why do these lowercase functions exist?
   4.7.5 Intert Trig Functions.m : "Int[u_.*(a_.*tan[c_. + d_.*x_]^n_. + b_.*sec[c_.+d_.*x_]^n_.)^p_, x_Symbol]",
Miguel Raz Guzmán Macedo
@miguelraz
Any RUBI internals for pattern matching that differ from those in the standard Mathematica documentation?
Albert D. Rich
@AlbertRich

@miguelraz Internally Rubi uses inert trig functions to greatly reduce the number of circular and hyperbolic trig integration rules required.

Before searching for integration rules to apply, Rubi uses the utility routine DeactivateTrig to convert integrands involving the 6 trig and 6 hyperbolic functions to equivalents ones involving just the 3 inert trig functions sin, tan and csc.

For example, Cos[x] is converted to the inert sin[x+Pi/2]. If instead it was converted to the active Sin[x+Pi/2], Mathematica would immediately simplify it back to Cos[x]. Similarly, Sinh[x] is converted to -I sin[I x] and Cosh[x] is converted to sin[I x+Pi/2].

So just 1 rule instead of 4 are required to integrate Sin[x], Cos[x], Sinh[x] and Cosh[x] wrt x. Similar rule consolidations are done for the tangent and secant (circular and hyperbolic) trig functions.

Currently Rubi has over 2000 inert trig integration rules. Without this consolidation there would be over 8000 active trig and hyperbolic integration rules.

Miguel Raz Guzmán Macedo
@miguelraz
Wow, that is clever.
Miguel Raz Guzmán Macedo
@miguelraz
What is the best place to read about those internal design decisions? I just started reading the IntegrationUtilityFunctions.m.
Albert D. Rich
@AlbertRich
@miguelraz That's the best place.
Albert D. Rich
@AlbertRich
@miguelraz Also single step through integrations to see the rules being applied. For example, when integrating Sin[x] (or Sinh[x]) you can see the inactive sin[x_] on the lhs of the rule and the active Cos[x] on the rhs.
Miguel Raz Guzmán Macedo
@miguelraz
Neat!
Why do some rules have If[TrueQ[$LoadShowSteps], Int[...] :=? Is there a reason why Modele[{...}] is used in some places and With[{...}] is used in other places? IIUC, both introduce a local scope to make the calculations less verbose. Miguel Raz Guzmán Macedo @miguelraz 1. Why is E^x used instead of Exp[x]? Bump! Albert D. Rich @AlbertRich @miguelraz When building Rubi with the ability to show steps, a few rules are hard-wired to display more meaningfully when the rule is applied. For your purposes, just assume $LoadShowSteps is False and use the Int rule defined by the fail condition of the If statement.

See the Mathematica online help for the distinction between With, Module and Block.

E^x and Exp[x] are interchangeable since Mathematica automatically simplifies the latter to the former.

Miguel Raz Guzmán Macedo
@miguelraz
Awesome, thanks a lot for that explanation.
Miguel Raz Guzmán Macedo
@miguelraz
Albert, good day.
I've had people asking, so I just want to double check. If we use RUBI as a basis for an integrator, are any licensing issues potentially involved? We know that Mathematica people can be... insistent, so we just want to make sure that we have covered all the bases here. I know that the RUBI repo is MIT-licensed, but are there any grounds for concerns that its uses are compliant with the WolframEngine's terms of use?
Albert D. Rich
@AlbertRich
@miguelraz Sorry, I have not used Wolfram Engine and am unfamiliar with its licensing requirements. Although its program code is written in the syntax of Mathematica's programming language, Rubi was developed independently of Wolfram Research. WRI provides more information at Free Wolfram Engine for Developers.
Miguel Raz Guzmán Macedo
@miguelraz
Thanks as always for the prompt response @AlbertRich . Enjoy the weekend.
Albert D. Rich
@AlbertRich
@miguelraz Yup, I hope to enjoy the weekend by going to my first rock concert in over a year. :))
Miguel Raz Guzmán Macedo
@miguelraz
Awesome! Rock on!
Christian Bauer
@cbauer:matrix.org
[m]
Hi Albert!
Congratulations to successfully pulling off a project like this, highly appreciated! Just recently, I stumbled across an integral for which Mathematica returns
a rather involved yet exact solution. I tried to use Rubi to understand how to solve this integrand by hand. For example, when Rubi applies transformation rule #6851, does this have an exact counterpart in the reference literature or is this simply an internal numbering scheme?
Miguel Raz Guzmán Macedo
@miguelraz
Oh nice to see you here @cbauer:matrix.org !
Albert D. Rich
@AlbertRich

@cbauer:matrix.org I'm glad you find Rubi's integration prowess of value.

When showing integration steps, you and others have requested a way to find for the rules being applied the documentation included with their definition in Rubi's source files.

As a help toward that end, now available on Rubi's website is an Integration Rule Index. It shows the numbers of the rules defined in each of the rule source files. For more on using the index, see the third paragraph of the Rules menu option on the website

Once you know the file a rule is defined in, it is a relatively simple matter to do a text search for it.
Christian Bauer
@cbauer:matrix.org
[m]
Got it, thank you! As an aside, I checked for a few integrals and I must say I am deeply impressed what goes on under the hood for seemingly easy integrands. I never bothered which transformations were applied, how many of them and in which order. Rubi served as an eye opener in that regard.
Momchil Peychev
@mpeychev_gitlab

Hello, hope all is well.

I have a somewhat conceptual (although possibly very stupid) question. If we have that s = Int[e, x], then is it reasonable to expect that D[s, x] - e is equal to 0 (possibly after applying Simplify to the left-hand side)?

This, of course, generally holds, but there are a few cases where this is not the case, for example:

Int[(f^x * x^2) / ((a + b*f^(2*x))^3), x]
Int[x / (b / (f^x) + a * f^x)^3, x]

Can someone explain me what is going on here? I asked a similar question somewhere in SymPy's GitHub issues and the people there explained to me that it is possible to get such discrepancies because of some implicit assumptions, related to the domains for which the integrand and the result of the integration are defined. I am not sure that this is also the case here, though. Am I terribly wrong somewhere? Thanks

Nasser M. Abbasi
@nasser1

Sometimes you need to use FullSimplify

<< Rubi
integrand = (f^x*x^2)/((a + b*f^(2*x))^3);
sol = Int[integrand, x];
FullSimplify[D[sol, x] - integrand]
0

and

integrand = x/(b/(f^x) + a*f^x)^3;
sol = Int[integrand, x];
FullSimplify[D[sol, x] - integrand]
0`
rfateman
@rfateman
I see no reason to assume that Simplify, FullSimplify, etc can reduce the D[sol,x]-integrand to zero. The zero-equivalence problem is theoretically undecidable (Richardson proved it). While it may ordinarily work if the expressions are in a simple enough domain, and if it does simplify to zero, that is, at least encouraging, it is not a requirement. There are also others issues that come into play, like is "sol" the smallest, simplest, "most continuous" result? Notions of "simplest" can be controversial. Some people like log(), some people like arctan() and there are lots more ways of fiddling.
Albert D. Rich
@AlbertRich

@mpeychev_gitlab If the derivative of the antiderivative Rubi returns is not equal to the integrand, I consider the antiderivative incorrect and a bug in Rubi. However, the host CAS, in this case Mathematica, may not be able demonstrate expressions equal even using FullSimplify.

The optimal antiderivatives of each of the 70,000+ integrals in Rubi's test-suite has been verified correct. Sometimes this requires manually helping out Mathematica show equality using various techniques.

Momchil Peychev
@mpeychev_gitlab
Thank you @rfateman and @AlbertRich for the insightful replies!
Gavin C
@jg3c:matrix.org
[m]
Are there any update on rubi 5? I'm interested in porting rubi to a different cas system but with no mathematica interpreter it seems like a difficult task.
Albert D. Rich
@AlbertRich

@jg3c:matrix.org The Rubi-5 repository has the latest information on the Rubi 5 Project.

It contains an actual functioning prototype of Rubi 5 that shows the structure of the proposed integrator. Also it provides an example how to compile Rubi 4 pattern matching rules into a Rubi 5 if-then-else decision tree. The repository's README file provides more details.

5 replies