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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

106 <strong>Notebooks</strong> and <strong>Documents</strong>The Syntax of the <strong>Mathematica</strong> Language<strong>Mathematica</strong> uses various syntactic rules to interpret input that you give, and to convert stringsand boxes into expressions. The version of these rules that is used for StandardForm andInputForm in effect defines the basic <strong>Mathematica</strong> language. The rules used for other forms,such as TraditionalForm, follow the same overall principles, but differ in many details.a , xyz , a b gsymbols"some text" , " a+b "strings123.456 , 3.µ10 45 numbers+, ->, ≠ operatorsH*comment*Linput to be ignoredTypes of tokens in the <strong>Mathematica</strong> language.When you give text as input to <strong>Mathematica</strong>, the first thing that <strong>Mathematica</strong> does is to breakthe text into a sequence of tokens, with each token representing a separate syntactic unit.Thus, for example, if you give the input xx + yy - zzzz, <strong>Mathematica</strong> will break this into thesequence of tokens xx, +, yy, - and zzzz. Here xx, yy and zzzz are tokens that correspond tosymbols, while + and - are operators.Operators are ultimately what determine the structure of the expression formed from a particularpiece of input. The <strong>Mathematica</strong> language involves several general classes of operators,distinguished by the different positions in which they appear with respect to their operands.prefix !x Not@xDpostfix x! Factorial@xDinfix x+y+z Plus@x,y,zDmatchfix 8x,y,z< List@x,y,zDcompound xê:y=z TagSet@x,y,zDoverfixx`OverHat@xDExamples of classes of operators in the <strong>Mathematica</strong> language.Operators typically work by picking up operands from definite positions around them. But whena string contains more than one operator, the result can in general depend on which operatorpicks up its operands first.Thus, for example, a * b + c could potentially be interpreted either as Ha * bL + c or as a * Hb + cLdepending on whether * or + picks up its operands first.

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

Saved successfully!

Ooh no, something went wrong!