1
$\begingroup$

I have the following input form:

R[η_] := (3*Subscript[ρ, B]*aEta[η]^-3)/(4*Subscript[ρ, γ]*aEta[η]^-4)

It's supposed to look like this: $$R[\eta\_]:=\frac{3 \rho_B\space a_{\eta}[\eta]^{-3}}{4\space\rho_{\gamma}\space a_{\eta}[\eta]^{-4}}$$ But when I convert it to Normal Form, Mathematica attempts to simplify the negative powers and I get: $$R[\eta\_]:= \frac{3\rho_B}{\frac{a_{\eta}[\eta]^3(4\rho_{\gamma})}{a_{\eta}[\eta]^4}}$$ Is there anyway to force the Standard Form to show the way it's supposed to look (i.e. the way the formula is traditionally written in the textbooks). Perhaps some association operator that can't be overridden when converting from Input to Standard?

$\endgroup$
4
  • $\begingroup$ What exactly do you want to work? Are you trying to print the definition, are you calling StandardForm in an input cell, ... typically you would use a HoldForm, Inactivate, or Matex for this $\endgroup$
    – user5601
    Commented Apr 30, 2020 at 0:09
  • $\begingroup$ This is an input cell. I've gotten in the habit of hitting Ctrl+Alt+I in order to see the raw form, then Ctrl+Alt+N to have Mathematica do the typesetting. I want the first equation to show up when I switch to Standard Form, but I'm getting the second equation. $\endgroup$
    – Quark Soup
    Commented Apr 30, 2020 at 0:47
  • $\begingroup$ Please add all your code needed to reproduce this, e.g. you haven’t defined aEta $\endgroup$
    – user5601
    Commented Apr 30, 2020 at 0:53
  • $\begingroup$ You basically want one Power typeset in StandardForm and the other two Power left alone. Examine carefully Hold[ R[\[Eta]_] := (3*Subscript[\[Rho], B]*aEta[\[Eta]]^-3)/(4* Subscript[\[Rho], \[Gamma]]*aEta[\[Eta]]^-4) ] // FullForm and note the form of the RHS is num * Power[den, -1]. I'd try entering the definition using control-/. $\endgroup$
    – Michael E2
    Commented Apr 30, 2020 at 1:05

1 Answer 1

2
$\begingroup$

Sometimes I forget the fact that

FullForm[x^-2] === FullForm[1/x^2] (* True *)

Borrowing a trick from another post, perhaps this will work for you:

xPower /: MakeBoxes[xPower[x_, e_ /; e < 0], form_] := SuperscriptBox[MakeBoxes[x, form], MakeBoxes[e, form]] 
xPower := Power 
R[\[Eta]_] := HoldForm[Times[3, Subscript[\[Rho], B], xPower[Subscript[a,\[Eta]][\[Eta]],-3]]/Times[4,Subscript[\[Rho],\[Gamma]],xPower[Subscript[a,\[Eta]][\[Eta]],-4]]]
R[\[Pi]] // StandardForm

enter image description here

I can't think of a solution that will let you keep using those shortcuts mentioned in the comments. Sometimes you just have to separate the display of a symbol from its function.

Also, on macOS, the shortcuts for converting a selection to StandardForm or InputForm is Command + Shift + N and Command + Shift + I respectively.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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