## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
rfateman
@rfateman
Looks like Expand, Together, Simplify, polynomial division with remainder are needed. Implementing a substitute for Mathematica's Simplify[] might be a chore. I haven't run (parts of ) Rubi in Lisp recently, or (ever) using Mathematica. I do have a concern that has caused some discussion in the Maxima world. In Maxima there is an attempt to provide an "optimal" solution which has different forms depending on the answers to some questions. e.g. integrate( (ax^2+bx+c)^(3/2),x) can use log or asinh. The current integration program can either use pre-declared assumptions, or asks for the sign of a, whether b is nonzero, and if the discriminant b^2-4ac is zero or not. Interrupting the user with questions is unpopular, especially when the questions are a good deal more complicated! I suppose one could try to answer all questions so as to guide the solution toward the "most generic" answer. I suppose that might include, somehow, all others, even if a far simpler result is sometimes possible. Is there a mechanism to steer Rubi through a potential maze of symbolic inequalities e.g. b^2-4ac > 0 ?? Thanks for keeping up on this project! --RJF
Albert D. Rich
@AlbertRich
@rfateman Rubi does not ask the user questions about the integrand. Rather it always returns mathematically valid antiderivatives in the sense that the derivative of the antiderivative equals the integrand.
Albert D. Rich
@AlbertRich

However to select between antiderivatives which are both valid, Rubi assumes the integrand' s variables are positive. For example, Int[1/Sqrt[a + b x + c x^2], x] returns

ArcTanh[(b+2*c*x)/(2*Sqrt[c]*Sqrt[a+b*x+c*x^2])]/Sqrt[c]

whereas Int[1/Sqrt[a + b x - c x^2], x] returns

-ArcTan[(b-2*c*x)/(2*Sqrt[c]*Sqrt[a+b*x-c*x^2])]/Sqrt[c]

Note that both results are mathematically valid no matter what nonzero value is substituted for c and both results are free of the imaginary unit if a positive value is substituted for c.

Albert D. Rich
@AlbertRich
@rfateman The Simplify function of the host CAS is not critical to Rubi 5 producing mathematically correct antiderivatives. It only affects how neat and tidy they are.
Axel Kramer
@axkr
@AlbertRich can you comment on this idea please? RuleBasedIntegration/Rubi-5#1
(Unfortunately we can not see the new issues "on the right" in this gitter chat room. Can you set the link to the repository in the gitter settings to make them appear?)
Albert D. Rich
@AlbertRich
@axkr I commented on your Rubi 5 Issue 1.
Albert D. Rich
@AlbertRich
@axkr I am a novice at Gitter and GitHub. I clicked on "Configure your integrations", then "GitHub" and allowed Gitter to access the RuleBasedIntegration repository. But keep getting an unhelpful error message. What am I doing wrong?
Miguel Raz Guzmán Macedo
@miguelraz
@AlbertRich Congrats! Rubi 5 sounds very, very exciting.
This open source development you've taken on is impressive and very encouraging, thank you.
Miguel Raz Guzmán Macedo
@miguelraz
Sorry to ask again @AlbertRich, but would you happen to have timings for the test suite for Mathematica vs Rubi?
SorinS
@SorinS
@AlbertRich Very nice start, I like the If-Then idea instead of pattern matching.
rfateman
@rfateman
It's true that the user of symbols a,b,c could have written -a, -b, -c, but the antiderivatives must be valid for any values of a,b,c positive, negative or zero. There is an advantage to some forms of antiderivative which may represent functions continuous in some designated region, as you know. It's a harder problem though, and Rubi's doing great stuff anyway.
Albert D. Rich
@AlbertRich
@rfateman Thanks for your endorsement of Rubi. Note that I said "both results are mathematically valid no matter what nonzero value is substituted for c..." (emphasis added). Neither antiderivative is valid if 0 is substituted for c. Happily the set on which they are invalid (i.e. {0} ) is just a set of measure zero.
Albert D. Rich
@AlbertRich

@miguelraz

... would you happen to have timings for the test suite for Mathematica vs Rubi?

@nasser1 has posted extensive integration test results including performance times for all the major CAS at Computer Algebra Independent Integration Tests.
Miguel Raz Guzmán Macedo
@miguelraz
@AlbertRich Awesome, I think that report was just what I was looking for.
@nasser1 would you happen to have timing breakdowns by Section? eg Total time taken by a CAS in the Independent tests, Total time taken by a CAS in the Algebraic Binomial tests... so on.
Miguel Raz Guzmán Macedo
@miguelraz
Do those not pass tests?
Miguel Raz Guzmán Macedo
@miguelraz
Also curious what these comments within these Integration rules mean
Albert D. Rich
@AlbertRich
@miguelraz The RuleBasedIntegration/Rubi GitHub repository is not being maintained. Instead to get the most up-to-date Rubi 4 source files, integration test-suite and test results go to the Rule-based Integration website.
To answer your questions download the relevant Rubi 4 source file as a pdf or notebook file from the Integration Rules page of Rubi's website. Comments in the source files should explain why some code has been commented-out.
Miguel Raz Guzmán Macedo
@miguelraz
Thanks for the prompt response @AlbertRich.
Ah, manually revising comments in the pdfs is definitely going to hamper part of the translation workflow.
Oh well :sweat_smile:
Miguel Raz Guzmán Macedo
@miguelraz
Hey @AlbertRich, good news - I've made some headway into the RUBI port to Julia. (Please don't post this link publicly, gimme a week.) I munged all the *.m files in the Rubi rules and dumped them into a huge JSON - this should lessen efforts by others to porting this to their own languages.
Miguel Raz Guzmán Macedo
@miguelraz
Question: I'm now porting the MathematicaSyntaxTestSuite - what are the fields for every entry supposed to mean?
We have
{Sqrt[2*x + 1], x, 1, (1/3)*(1 + 2*x)^(3/2)}
{Sin[x]^3, x, 2, -Cos[x] + Cos[x]^3/3}
Miguel Raz Guzmán Macedo
@miguelraz
Would I be correct in assuming that the
1. The first field entry Sqrt[2*x + 1] is the expression to integrate
2. The second field x contains the only variables with respect to integration
3. The third field 1 contains the "highest level function" the optimal antiderivative may contain (as expressed in the Integration Test Results section)
4. The fourth field (1/3)*(1 + 2*x)^(3/2) is the answer
Albert D. Rich
@AlbertRich
@miguelraz I say again: To get the most up-to-date Rubi 4 source files, integration test-suite files and test results go to the Rule-based Integration website. For Rubi 5 go to RuleBasedIntegration/Rubi-5.
Forget the other RuleBasedIntegration repositories on GitHub. As their dates indicate, they are not being maintained.
Your question about the 4 fields of the integration test-suite files is answered in the first paragraph of the Test Problems page of Rubi's website.
Miguel Raz Guzmán Macedo
@miguelraz
Thanks for the clarification - I had not understood that the Github repositores and the online zip files differ, given that they share the same semantic version of v4.16.1.0. Will update my code accordingly.
Albert D. Rich
@AlbertRich
@miguelraz Sorry about the confusion. Rubi is very much a work-in-progress. Albert
Miguel Raz Guzmán Macedo
@miguelraz
No worries! Your work is paving way for an entire ecosystem for us, so we appreciate all you've done. It really is amazing. If I'm not out of line, do consider bumping the zip file on the Rubi website to 4.17 or akin so that others know it is not the same version as those in the github repos (as is common in semantic versioning practice.)
Albert D. Rich
@AlbertRich
@miguelraz Like I said in the Rubi 5 README file, the next release of Rubi 4 (version 4.17.0) will hopefully be the last. To avoid confusion, I'm starting to think the out-of-date RuleBasedIntegration repositories should all be deleted, or at least hidden...
Albert D. Rich
@AlbertRich
Rather than the collaborative GitHub paradigm, Rubi has pretty much been a one-man show. Its freely available, but read-only, website provides public access to the system. This has given me complete control over Rubi's design and implementation.
But perhaps Rubi is now mature enough to be transformed into a collaborative software project focused on implementing Rubi 5 and then porting it to popular computer algebra systems. The Plan for Implementing Rubi 5 outlines how this could be achieved as a crowd-source project.
So if there is sufficient interest, I propose a new repository for Rubi be created and operated as a conventional GitHub site encouraging collaboration (unlike the now dormant RuleBasedIntegration repository).
Meanwhile, I'll keep my focus on perfecting Rubi 4 to my satisfaction before turning my attention to Rubi 5. So I invite others having the time and inclination, create a repository for The Rubi Project and oversee its operation.
pretentious7
@pretentious7
I'm interested in helping with the sympy implementation and possible future sagemath integration!
Miguel Raz Guzmán Macedo
@miguelraz
@AlbertRich all the more amazing that it's been a one man show!
I ran into some issues today when parsing the Wester Problems.m - it doesn't share the same structure as the rest of the notebooks.
Miguel Raz Guzmán Macedo
@miguelraz
I also found line 1717 of 1.3.2 Algebraic functions to be malformed:
  1717 (* {Sqrt[1+x^2]/(1-x^3), x, 0} *)
Miguel Raz Guzmán Macedo
@miguelraz
There were 7 other cases were the 4 field was not present - I think I'm skipping those for now.
Momchil Peychev
@mpeychev_gitlab

Dear @AlbertRich , I came across Rubi (and all encompassing materials) recently and simply wish to express my admiration for the whole project and the way it is led and executed by you. I also want to thank you for making it open and public with such a good and thorough documentation. To this end, many thanks go to @halirutan and anyone else who has helped you in one way or another during the process as well as to the people who are porting Rubi to other languages, thus enriching the Rubi ecosystem and making it even more accessible.

I would also like to use Rubi in my research and I hope that you don't mind it. I can assure you that credit will be given appropriately and any interesting findings will be open-sourced and shared back to the community.

I carefully examined the documentation and the papers describing Rubi and am excited to see the future plans to implement Rubi-5 in an explicit if-then-else decision tree fashion. I have one question related to this and one specific point that you make in the papers, which I would like to make clear. In one of your papers (specifically Section 2 of this one, also Section 3 here) it is mentioned that

The construction and selection of the rules is based on the principle of mutual exclusivity. For a database of reduction rules to be properly defined, at most one of the rules can be applicable to any given expression. Mutual exclusivity is critical to ensuring that rules can be added, removed or modified without affecting the other rules. Such stand-alone, order-independent rules make it possible to build a rule-based repository of knowledge incrementally and as a collaborative effort.

However, in the Rubi.m file, we can see the following comment:

98 (* The order of loading the rule-files below is crucial to ensure a functional Rubi integrator! *)

Could you please confirm that you obtain the desired mutual exclusivity solely by implicitly relying on Mathematica's pattern matching implementation (specifically, that it can apply the first rule which it finds to match a particular pattern). Are the conditions attached to each rule only related to its validity and simplification capabilities, i.e. there are no further conditions which are there just to ensure the mutual exclusivity of the rules? The implications of this will be that for a given initial integral, we are then able (in theory) to explore a whole search tree of rewrites and simplifications by applying the rules in your collection.

Kind regards,
Momchil