MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

How to consistently define StandardForm for output?

I defined a function PD[f_, x_]. To be more readable, I want to display it as =E2=88=82=E2=82=93f. Thus I defined

Format[PD[f_, x_]] :=
 RowBox[{SubscriptBox["\[PartialD]", x], f}] // DisplayForm

However, when I copy the output "=E2=88=82=E2=82=93f" to new input and evaluate, I get result "0" because now =E2=88=82=E2=82=93f is interpreted as D[f, x], not the new function I defined.

My question is: How to define PD[f_, x_] such that it displays as =E2=88=82=E2=82=93f and when I copy the output =E2=88=82=E2=82=93f to new input, it still means PD[f_, x_]?

PS: It should be possible because I see a Mathematica package (xAct) can do that. But the package is huge and I failed to read its source code and see how it is accomplished.

  • Prev by Date: Re: How to get the corresponding coefficients?
  • Next by Date: Re: Printing Notebooks without Input/Output cells
  • Previous by thread: Re: Bug in pattern test, or I did something wrong?
  • Next by thread: Specify TransformationFunctions in Simplify[] gives wrong result