Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mathematica not interpreting CenterDot as Times in numerical calculations

Why doesn't Mathematica show the numerical result of

(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
like image 269
Tyilo Avatar asked Dec 03 '22 00:12

Tyilo


1 Answers

Just to complete some of the other answers/comments, if you want CenterDot to be interpreted as Times in both input and output by 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];

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

This works on both numeric and symbolic expressions, e.g.

In[5]:= 1\[CenterDot]2\[CenterDot]3   
Out[5]= 6

In[6]:= a b c    
Out[6]= a\[CenterDot]b\[CenterDot]c

You can also make the automatically inserted multiplication symbol between space separated numbers be CenterDot by executing

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

or by selecting Center Dot in the preferences dialog under Appearance > Numbers > Multiplication.

For example:
screenshot

like image 83
Simon Avatar answered Dec 20 '22 01:12

Simon