Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rubi support is not good #250

Open
asukaminato0721 opened this issue Jul 26, 2024 · 5 comments
Open

Rubi support is not good #250

asukaminato0721 opened this issue Jul 26, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@asukaminato0721
Copy link
Contributor

Describe the bug

it show the output messy.

To Reproduce

install the Rubi package https://rulebasedintegration.org/downloadRubi.html

<<Rubi`
Steps[Int[x^2,x]]

and

Steps[Int[2/(2 Sin[t] Cos[t] + 5 Cos[t]^2 + Sin[t]^2) ,t],RubiPrintInformation->False]

Expected behavior

https://rulebasedintegration.org/usingRubi.html

Screenshots

image

image

Desktop (please complete the following information):

  • OS: linux
  • Desktop App
@asukaminato0721 asukaminato0721 added the bug Something isn't working label Jul 26, 2024
@JerryI
Copy link
Owner

JerryI commented Aug 28, 2024

Actually it is not that complicated to rewrite boxes for it. The original code heavily relies on ItemBox, DynamicModule, which are not available for now in WLJS Notebook system (but may be in the future, nobody knows ;D ).

I just tried to put some random style and pane boxes on RubyRule and RubyResult, but what Dist, Subst mean... still a question. It must be some sort of rules from algebra used for demonstrating this or that strategy on taking those integrals

Screenshot 2024-08-28 at 13 24 50

@JerryI
Copy link
Owner

JerryI commented Aug 28, 2024

Sorry, I am blind and did not find this on the main page

image

At least stats are working out of the box

Screenshot 2024-08-28 at 13 30 48

@JerryI
Copy link
Owner

JerryI commented Aug 28, 2024

From now on I see two paths

a. pay enough attention on implementation of ItemBox, make it work without workarounds
b. add separate sub-package like Ruby`WLJSFormFixes, which will rewrite the implementations of StandardForm

and as a side branch

  • allow Print function to output standard form as well

@JerryI
Copy link
Owner

JerryI commented Aug 28, 2024

A workaround solution

stripHoldBox[h_, f_] := With[{e = Extract[h, 1, HoldForm]},
  MakeBoxes[e, f]
]

fatArrow = HTMLView["<div style=\"align-items: center;height: 1rem;margin-top: -2rem;position: absolute;font-size: 1.5rem;top: 0;bottom: 0;\">&xrarr;</div>"];


RubiRule /: MakeBoxes[RubiRule[_, right_, left_, ___], f:StandardForm] := With[{fatArrow=fatArrow},
  BoxBox[RowBox[{stripHoldBox[right, f], " ", MakeBoxes[fatArrow, f], "    ", stripHoldBox[right, f]}], PaneBox[]]
]

RubiIntermediateResult /: MakeBoxes[RubiIntermediateResult[result_, u___], f:StandardForm] := With[{},
  BoxBox[stripHoldBox[result, f], PaneBox[]]
]

@JerryI
Copy link
Owner

JerryI commented Sep 13, 2024

Present state

Steps[Int[2/(2 Sin[t] Cos[t] + 5 Cos[t]^2 + Sin[t]^2) ,t],RubiPrintInformation->False]
Screenshot 2024-09-13 at 22 20 47

Without RubiPrintInformation->False it will not work correctly. OpenerBox, ItemBox, DynamicModuleBox are not implemented, and it messes up a printed output.

@JerryI JerryI added enhancement New feature or request and removed bug Something isn't working already planned labels Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants