RuleBasedIntegration / Rubi

Rubi for Mathematica
http://rulebasedintegration.org
MIT License
225 stars 22 forks source link

Open Rubi Integration notebook for specific rule in the `Steps` display #18

Open halirutan opened 5 years ago

halirutan commented 5 years ago

This issue might require advanced knowledge Mathematica. The goal is that the user can open the correct integration rule notebook (which contains more information) at the correct place from one of the rules in the Steps display:

img

The chain of information flow for the integration rules is as follows:

  1. Albert writes each rule as a separate section in the integration rule notebooks and often provides additional references into the literature or explanations.
  2. The notebooks are then transformed into *.m files where everything, except the Mathematica code for the rule, is stripped.
  3. Rubi loads these files in a fixed order. The order is vitally important. During "loading" the code for all rules are turned into DownValues for Int.
  4. Some of the Int rules are further processed (see FixIntRules)
  5. When using Steps for integration, we know which specific DownValue was used, but we lost the information from which cell in the source-notebook this rule is coming from.

The question is: Is there a reliable way to calculate or store the information where a DownValue can be found in the source-notebooks? This should work across multiple Mathematica versions and operating system.

I already tested some approaches like calculating hash-codes for the rule but these failed because Mathematica makes adjustments in the expressions when it transforms a := definition into a DownValue. Talk to me, @halirutan, if you like to work on this issue.

asdasd1dsadsa commented 3 years ago

I've noticed that RubiRule has an ID now. Is this issue still open?

halirutan commented 3 years ago

I'm not exactly sure about what ID you're talking, but the preliminary work I did on this can be found on the NotebookReferences branch. It worked pretty well on my machine but I haven't looked at this for well over a year. It works by calculating a hash for each integration rule that is then included in the rule itself.

So if you check one of the final integration rule files you find that each rule has an additional default RubiNotebookReference argument:

Int[1/x_, x_Symbol, _:RubiNotebookReference["70cb09bc"]] := Log[x]

The hash of each rule is available in a large map that is used to resolve the filename and cell-number back.

If the original Rubi notebooks are available locally, this can be used to open the exact notebook in read-only mode (much like you do with Mathematica's documentation) and navigate to the cell where a specific integration rule is defined.

What's still missing is a separate "resource paclet" that can be installed automatically and contains the original Rubi notebooks. It needs to be placed so that rules from the Step@Int[...] can be opened. The current implementation just expects the $UserBaseDirectory and you can find the implementation here. Look at the locateRubiNotebook function for more info.