rnlg / LiteRed2

13 stars 1 forks source link

Issues with Mathematica 14 and TraditionalForm #3

Closed vsht closed 4 months ago

vsht commented 7 months ago

Hi,

I'm using Mma 14.0 and have my standard cell output format set to TraditionalForm. With the latest LiteRed2 from the repository I'm getting typesetting errors upon using LoweringDRR. With the code

SetDim[d];
Declare[{p1, p2, p3, p4, q}, Vector, {}, Number];
sp[q, q] = 1;

NewDsBasis[topo1, {sp[p3], sp[p1 - p3 - p4], sp[p4], sp[p1 + q], 
  sp[p1 - p4] - 1}, {p1, p3, p4}, Directory -> "topo1LR", 
 GenerateIBP -> True, Append -> True, SolvejSector -> True]

dd1 = LoweringDRR[topo1, 0, 1, 1, 1, 1, 1, 0, 0, 0]

I get Bildschirmfoto vom 2024-03-12 14-26-47

Am I doing something wrong here?

Cheers, Vlad

rnlg commented 7 months ago

@vsht, thanks for the report.

This seems to be an inconsistency in how Mathematica produces TraditionalForm. In particular consider the following screenshot: изображение When the number of integrals is larger than a certain value, the TraditionalForm works incorrectly. This boundary (72 on the screenshot) is different for different machines!

The traditional form of j[...] is defined in LiteRed as

MakeBoxes[j[nm_,inds__],TraditionalForm]:=InterpretationBox[SubsuperscriptBox["j",RowBox[ToBoxes[#,TraditionalForm]&/@{inds}],ToBoxes[nm,TraditionalForm]],j[nm,inds]]

For a simpler definition, e.g.,

MakeBoxes[f[x_], TraditionalForm] :=  InterpretationBox[SubscriptBox["f", ToBoxes[x, TraditionalForm]], f[x]]

I observe a similar effect, although starting with larger value (e.g. TraditionalForm[Array[f, {397}]] work incorrectly on the present machine). I believe, this problem has something to do with InterpretationBox wrapping, as I could not observe the incorrect behavior when I remove it. But InterpretationBox is needed for consistent copying of the output. So a quick fix (in case you don't want to copy the output) woud be to replace the InterpretationBox[SubsuperscriptBox["j",RowBox[ToBoxes[#,TraditionalForm]&/@{inds}],ToBoxes[nm,TraditionalForm]],j[nm,inds]] with SubsuperscriptBox["j",RowBox[ToBoxes[#,TraditionalForm]&/@{inds}],ToBoxes[nm,TraditionalForm]] in the code above (which can be located in LiteRed2xxx.m file). Or even simple unset the definition with MakeBoxes[j[nm_,inds__],TraditionalForm]=. But I am not sure I would want to give up possibility to copy the output just because of the Mathematica incorrect treatment of InterpretationBox, especially, given that it might only move up the boundary for the incorrect behavior.

I've already met bugs in Mathematica related to different behavior when the size exceeds some boundary. Look, for example at https://redmine.wolfram.com/redmine/issues/1259

This bug remains unfixed since MMa11!

Best, Roman.

vsht commented 7 months ago

I see, thanks for the explanation.

I have to say that I don't have much experience with InterpretationBox. In FeynCalc I only use MakeBoxes and ask people to use exp//StandardForm if they want to copy something. Of course, the number of symbols there if also sufficiently higher as compared to LiteRed.