Mathematica does not interpret CenterDot as Times in numerical computing

Why Mathematica Does Not Show Numerical Results

(0.8\[CenterDot]452\[CenterDot]20+1.5\[CenterDot]4180\[CenterDot]10 -2\[CenterDot]900\[CenterDot]100) / (0.8\[CenterDot]452 +1.5\[CenterDot]4180-1\[CenterDot]2\[CenterDot]900) // N 
+4
source share
4 answers

To do some other answers / comments, if you want CenterDot to CenterDot interpreted by both Times as input and output, using something like

 Unprotect[CenterDot, Times]; CenterDot = Times; Times /: MakeBoxes[Times[a__], fmt_] := With[{cbox = ToBoxes[HoldForm[CenterDot[a]]]}, InterpretationBox[cbox, Times[a]]]; Protect[CenterDot, Times]; 

What you can add to your init.m if you want it to be loaded by default.

This works with both numeric and symbolic expressions, for example

 In[5]:= 1\[CenterDot]2\[CenterDot]3 Out[5]= 6 In[6]:= abc Out[6]= a\[CenterDot]b\[CenterDot]c 

You can also make an automatically inserted multiplication character between numbers separated by spaces, CenterDot by doing

 SetOptions[EvaluationNotebook[], {AutoMultiplicationSymbol -> True, NumberMultiplier -> "\[CenterDot]"}] 

or by choosing Dot Center in the Appearance> Numbers> Multiplication settings dialog box.

For instance:
screenshot

+9
source

Just replace \[CenterDot] space

+4
source

Multiplication in Mathematica is written either as a space ( Times[a,b] == ab ) or as an asterisk ( Times[a,b] == a*b ). \[CenterDot] not interpreted as multiplication.

+4
source

I think Simon's first method can be written more concisely. Please view:

 Unprotect[Times]; CenterDot = Times; Format[a_*b__] := Interpretation[HoldForm[a\[CenterDot]b], a*b]; 

Second attempt. I believe this works correctly with Convert To > StandardForm and editing.

 CenterDot = Times; MakeBoxes[Times[x__], _] := RowBox @ Riffle[ToBoxes /@ {x}, "\[CenterDot]"] 
+1
source

Source: https://habr.com/ru/post/1384279/


All Articles