Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Given that both x and y are expressions, in my case x is Transpose[A] and y is B, I thought that the TraditionalForm for multiplication was juxtaposition with a space between. Why is the Output for TraditionalForm[Inactivate[x y]] displayed with * visible? I am working in Mathematica V10. Thanks for your help.

share|improve this question
    
It's not clear to me if this is intended behaviour or not. Instead of asking here, I'd write to Wolfram support. They'll either tell you why, or will confirm it as a bug. –  Szabolcs Jul 30 at 22:39

3 Answers 3

up vote 6 down vote accepted

Consider this:

Inactivate[3*5 - 2 - 3] // FullForm
Inactive[Plus][Inactive[Times][3, 5], -2, -3]

RunnyKine is correct regarding the cause but he did not really explain the mechanism involved. Formatting rules typically apply to (sub)expressions with certain heads. This has nothing to do with evaluation per se, but rather the patterns in the transformation rules of MakeBoxes.

In this example the formatting rules for Times are still applied despite HoldComplete:

HoldComplete[Times[x, y]] // TraditionalForm

HoldComplete[x y]

Another example and further explanation can be seen in my answer to:

Simply put Inactive[Times] does not match the patterns used by MakeBoxes for pretty formatting. However we can easily add our own rules. If you wish to have expressions produced by Inactivate formatted as the normal form of the expression (without evaluation) you may use:

MakeBoxes[p : Inactive[h_][args___], form_] := 
  MakeBoxes[Interpretation[HoldForm @ h[args], p], form]

Now the expression is formatted using the normal rules for Times and Plus:

enter image description here

Without the definition this is printed without the nice formatting:

enter image description here

share|improve this answer
    
This was very helpful! Especially the link. Many thanks. –  John McGee Jul 31 at 13:43
    
@JohnMcGee You're welcome. By the way I note that you have not Accepted any answers. Please consider participating in this way. –  Mr.Wizard Jul 31 at 14:58

Because Inactivate acts on Heads of expressions, replaces them with Inactive[h] where h is the Head of the expression and prevents them from evaluating. And in your case the Head of x y is Times:

FullForm[x y]

Times[x, y]

So

Inactivate[x y]

Gives:

Mathematica graphics

Where the Times did not evaluate. Hence, the result you get when you apply TraditionalForm.

share|improve this answer

Mr. Wizard's answer is excellent. My main addition would be that the advantage of the method we chose is that the output is editable: you can copy it to another cell, add/remove/change terms, revaluate, and it all just works. Using Interpertation as suggested would have preserved the meaning upon reevaluation but at the cost of destroying all editability. Certainly different tradeoffs are possibie, and the traditional form of Times in particular is a close call, but we decided that consistency with other operators was better than perfectly reproducing the TraditionalForm of Times.

share|improve this answer
    
Thanks for some inside information! –  Mr.Wizard Aug 6 at 1:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.