Unwanted spaces
When I run mathics and say 2x+3 I get these lines:
In[1]:= 2x+3
Out[1]= 3 + 2 x
if I go to def format_outputform in mathics/builtin/arithfns/basic.py and change op to be Dot Operator I get these lines:
In[1]:= 2x+3
Out[1]= 3 + 2 ⋅ x
I expected to get 3 + 2⋅x but after result = self.create_expression(SymbolMakeBoxes, expr, form).evaluate(evaluation) (that was line 308 in mathics/core/element.py) that result contains ["2", " ⋅ ", "x"]] with unwanted spaces around dot operator. If only I could somehow prevent that and get ["2", "⋅", "x"]] in result (spaces around Plus Sign " + " in result are totally fine)
@sheerluck, ideally, what you should do is to set in your session
In[1]:=MakeBoxes[(a_)*(b_), form_] := RowBox[{MakeBoxes[a, form], ".", MakeBoxes[b, form]}]
Then, in WMA,
In[3]:=a*b
produces
In[3]:= a b
(the same that in Mathics), but
In[2]:=StandardForm[a*b]
produces
Out[2]//StandardForm= a.b
For some reason, this does not work in Mathics, and I think that is the true issue here.
This works on both Mathics and WMA:
In[1]:= Unprotect[Times]; Format[a_*b_]:=ToString[a]<>"."<>ToString[b]
In[2]:= a + a
Out[2]= 2.a
This works on both Mathics and WMA:
In[1]:= Unprotect[Times]; Format[a_*b_]:=ToString[a]<>"."<>ToString[b] In[2]:= a + a Out[2]= 2.a
oh, thank you, it works!
What would be equivalent line(s) for ~/.config/mathicsscript/settings.m config?
Add this line:
Unprotect[Times]; Format[a_*b_]:=ToString[a]<>"."<>ToString[b];Protect[Times];