13.07.2015 Views

Mathematica Tutorial: Notebooks And Documents - Wolfram Research

Mathematica Tutorial: Notebooks And Documents - Wolfram Research

Mathematica Tutorial: Notebooks And Documents - Wolfram Research

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Notebooks</strong> and <strong>Documents</strong> 117It is fairly rare that you will need to modify these rules. The main reason is that <strong>Mathematica</strong>already has built-in rules for the input and output of many operators to which it does not itselfassign specific meanings.Thus, if you want to add, for example, a generalized form of addition, you can usually just usean operator like ⊕ for which <strong>Mathematica</strong> already has built-in input and output rules.This outputs using the ⊕ operator.In[3]:= CirclePlus@u, v, wDOut[3]= u ⊕ v ⊕ w<strong>Mathematica</strong> understands ⊕ on input.In[4]:= u ⊕ v ⊕ w êê FullFormOut[4]//FullForm= CirclePlus@u, v, wDIn dealing with output, you can make definitions for Format@exprD to change the way that aparticular expression will be formatted. You should realize, however, that as soon as you dothis, there is no guarantee that the output form of your expression will be interpreted correctlyif it is given as <strong>Mathematica</strong> input.If you want to, <strong>Mathematica</strong> allows you to redefine the basic rules that it uses for the input andoutput of all expressions. You can do this by making definitions for MakeBoxes andMakeExpression. You should realize, however, that unless you make such definitions with greatcare, you are likely to end up with inconsistent results.This defines how gplus objects should be output in StandardForm.In[5]:= gplus ê: MakeBoxes@gplus@x_, y_, n_D, StandardFormD :=RowBox@8MakeBoxes@x, StandardFormD,SubscriptBox@"⊕", MakeBoxes@n, StandardFormDD, MakeBoxes@y, StandardFormD

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!