## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
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
Patrick Scheibe
@halirutan
@/all Hey guys. Since 2020, my workload is too high to properly take care of the Rubi repository (what an understatement). I would really appreciate it if someone would step up to take care of the open pull-requests and the repositories in general. Are there any good candidates who think they could handle the job and have at least some time to spare in the upcoming future?
Sorin S
Hello Patrick, happy to help if that is suitable.
Nasser M. Abbasi
@nasser1

Hello;

fyi, I am getting this error Recursion error on this integral using Rubi 4.16.1 on Mathematica 12.3.1

integrand = -(x^3 + x^6 + 1)/((x^3 + x^5)^(1/4)*(x^6 - 1))
Int[integrand, x]

$RecursionLimit::reclim2: Recursion depth of 1024 exceeded during evaluation of (If[IntegerQ[#1]||Head[#1]===Rational,Null,Return[False]]&)[-1]$RecursionLimit::reclim2: Recursion depth of 1024 exceeded
during evaluation of AtomQ[-1]||FreeQ[-1,x].

$RecursionLimit::reclim2: Recursion depth of 1024 exceeded during evaluation of AtomQ[x]||FreeQ[x,x]. Using windows 10. Fyi, This one gives 1/0 error and also recursion error, also using Rubi 4.16.1 on Mathematica 12.3.1. integrand = -(x^6 + 1)/((x^3 + x^5)^(1/4)*(x^6 - 1)) Int[integrand, x]$RecursionLimit::reclim2: Recursion depth of 1024 exceeded during evaluation of N[300].
$RecursionLimit::reclim2: Recursion depth of 1024 exceeded during evaluation of Floor[Hold[N[300]]].$RecursionLimit::reclim2: Recursion depth of 1024 exceeded during evaluation of Message[Simplify::timl,300].
General::stop: Further output of \$RecursionLimit::reclim2 will be suppressed during this calculation.
Power::infy: Infinite expression 1/0 encountered.
Lachlan Sneff
@lachlansneff:matrix.org
[m]
I've been working on a CAS in rust for a few days and have been planning on converting the RUBI rules to rust when I get around to adding integration support!
Here's the repo if anyone is interested: https://github.com/lachlansneff/das
By the way, what's the format for your rules? Can I add some?
Can rules for definite integration be added?
Albert D. Rich
@AlbertRich

@Anixx The integration rules Rubi uses are defined in the Mathematica source and corresponding pdf files available at https://rulebasedintegration.org/integrationRules.html.

The easiest way to add additional rules is to put them at the end of one of Rubi's existing source files, and then rebuild the system.

Yes, you could even add rules for definite integration.

Miguel Raz Guzmán Macedo
@miguelraz
Hello @AlbertRich , hope all is well.
Any idea how much the coverage of the RUBI test suite has improved in vanilla Mathematica?
Albert D. Rich
@AlbertRich

@miguelraz Thanks Miguel for your well wishes.

I imagine @nasser1 will soon let us know how Mathematica 13 does on the integration test-suite.

Miguel Raz Guzmán Macedo
@miguelraz
Sweet. @nasser1 : can the integration test suite print in such a way so that the timings and results can be read in a tabular data format?
Perhaps my last dive missed something but it I wanted to aggregate the results and couldn’t do so easily.
Nasser M. Abbasi
@nasser1

@miguelraz There are two phases to CAS integrations. The first phase run each CAS and generates a plain text file for each CAS per each test. There are 208 tests. And there are 8 CAS systems. Second phase reads these plain text files (TABLES) and generates the PDF and web pages.

I can make the TABLEs available. There is ONE line per one integral result. It is comma delimited. It is described here https://12000.org/my_notes/CAS_integration_tests/reports/summer_2021/inch1.htm#x2-150001.9 Here is a link to one such TABLE. This was for Rubi result for the Timofeev test file. The TABLE contains everything. Timing, results, Latex, input, pass/fail, code of fail, etc... as described in the above link. Here is TABLE file mentioned above, https://12000.org/tmp/CAS_integration_RESULT_file_example/rubi_listA.txt If this works for you, I can makes all these in one large zip file. but will take me little time to do.

Miguel Raz Guzmán Macedo
@miguelraz
@nasser1 Thanks a lot for your response! Truly great work.
One large zip file would be ideal, yes
Nasser M. Abbasi
@nasser1
@miguelraz I've put the ZIP file link at the main web page for CAS integration test https://12000.org/my_notes/CAS_integration_tests/reports/summer_2021/index.htm The tree structure is the same as in Rubi original tests tree. You'll find the TABLES under each folder there. one plain text TABLE per each CAS per each test folder. It is about 90 MB in size. Hope this helps.
Miguel Raz Guzmán Macedo
@miguelraz
Awesome - I will share results with due credit.
Anixx
@Anixx
It seems, Mathematica 13 now gives the same results as Rubi.
Rubis is obsolete?
Nasser M. Abbasi
@nasser1
@Anixx The current CAS integration test uses Mathematica 12.3 and not 13.0. The versions are listed here https://12000.org/my_notes/CAS_integration_tests/reports/summer_2021/inch1.htm. The ZIP file of the TABLES mentioned above is the result of those tests. No tests were yet run using version 13 of Mathematica, so do not know how it will do on Rubi's tests suite. What is meant by the tree structure of the TABLES is the same as Rubi's just refers to the the folder layout of the ZIP file.
Anixx
@Anixx
@nasser1 at least, the examples given in the Rubi intro as those that Rubi can solve and Mathematica cannot, now can be solved by M13 with absolutely the same results as Rubi does.
Nasser M. Abbasi
@nasser1
@Anixx Could you provide a link to this document called "Rubi intro" that you mention in your post above?
Anixx
@Anixx
Albert D. Rich
@AlbertRich

@Anixx The 3-year old Wolfram Community article "Rubi - The Rule-based Integrator for Mathematica" you reference gives just one example integral on which Mathematica 11.3 is inferior to that returned by Rubi.

Before you say "Mathematica 13 now gives the same results as Rubi" you need to wait and see how Mma 13 performs on the rest of the 1000's of problems in the integration test-suite Nasser uses.

Anixx
@Anixx
@AlbertRich well, I looked through integrals in his post here: https://mathematica.stackexchange.com/questions/169209/some-indefinite-integrals-evaluate-in-11-2-but-not-in-11-3-what-can-be-done and particularly, the answer by gvr https://mathematica.stackexchange.com/a/169285/651 which gives other examples of Rubi superiority. Now Mathematica gives the same answers as Rubi on all of them.
Albert D. Rich
@AlbertRich
@Anixx I glad to see Wolfram Research is making an effort to catch up with Rubi when deficiencies are pointed out.
edmontz
@edmontz
Two questions, for Albert.
edmontz
@edmontz
Do you ever wonder why yours is mostly a solo endeavor, I certainly do; especially considering the potential importance of the RUBI approach. Having browsed some code for RUBI 5, and being aware of sympy with a convoluted implementation of RUBI 4.x.x; might RUBI 5 be implemented more readily in python, and in such a way that the user is able to comprehend the code and easily build upon the existing rules. I suppose what I'm asking for are python equivalents for expressions such as; Int[(a./x)^p_,x_Symbol] :=
-a*(a/x)^(p-1)/(p-1) /;
FreeQ[{a,p},x] && Not[IntegerQ[p]]
Albert D. Rich
@AlbertRich
@edmontz Yes, I've wondered about that a lot. Rubi's source code provides the mathematical knowledge required to implement a powerful symbolic integrator in virtually any CAS. I heartily encourage CAS implementors to translate that knowledge into code no matter what language their system is written in.
Nasser M. Abbasi
@nasser1
   Int[(a_./x)^p_,x_Symbol] :=-a*(a/x)^(p-1)/(p-1) /;FreeQ[{a,p},x] && Not[IntegerQ[p]]

The above gives an integration rule. It says for an integrand of the form (symbol/x)^p its anti derivative is what it shows on the RHS. The stuff after /; gives conditions on arguments for this to apply.

It says this rule applies when p is NOT an integer and when a and p are free of the integration variable x. The small DOT next to a is to allow 1 there. For example if you type the above, now you can do Int[(1/x)^(1/3),x] and it will return 3/(2 (1/x)^(2/3)) but if you have typed Int[(1/x)^3,x] then it will not have matched the rule, since p is an integer here. You can also type Int[(n/x)^(1/3),x] and it will return (3 n)/(2 (n/x)^(2/3)). And if you type Int[(1/x)^(x/3),x] then it will not match, so the rule will not be applied, since p now has x in it. So it is NOT free of x.

To translate all this to Python, one would need to know Mathematica pattern matching and know Python pretty well also. As for how to do this in Python, that will be a question for the Python forum.

Axel Kramer
@axkr
@edmontz We've implemented a pattern-matcher in Java which uses the Rubi rules in translated internal form:
https://github.com/axkr/symja_android_library/tree/master/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/integrate/rubi
but of course there are many JUnit tests in the test case suite:
https://github.com/axkr/symja_android_library/tree/master/symja_android_library/matheclipse-io/src/test/java/org/matheclipse/core/rubi
which fail because of bugs/subtle differences which occur in the matcher and the Simplify, PossibleZeroQ` implementation...