0

I want to keep track of a large number of variables, and the only way to express them properly is as a fraction. Is there a way to typeset a variable as a fraction? For instance, I would like to do the following: $$\frac {\partial^2 R}{\partial u^2}=-\cos[v]\sin[u] \frac{\partial R}{\partial X}$$ Then I'd like to reference $\frac {\partial^2 R}{\partial u^2}$ as if it were a regular variable. For example:

$[Input] \frac {\partial^2 R}{\partial u^2} = 321.23;$

$[Input] \frac {\partial^2 R}{\partial u^2}$

$[Output] 321.23$

Quark Soup
  • 1,610
  • 9
  • 14

1 Answers1

2

If all you need is typesetting, not inputting, then Format may work. You can set the formatting of any expression to be whatever you want.

Example: Declare that the variable A shall be typeset as $\partial^2R/\partial u^2$:

Format[A] = "\!\(\*FractionBox[\(\*SuperscriptBox[\(\[PartialD]\), \(2\)]R\),
  \(\[PartialD]\*SuperscriptBox[\(u\), \(2\)]\)]\)";

(it looks prettier in the front end, and you can enter it in the usual way without hand-assembling these terrible box instructions)

Now try it out by looking at the equation A==3:

A == 3

(*    ∂²R/∂u² == 3    *)
Roman
  • 47,322
  • 2
  • 55
  • 121