Mathematica code is fully-fledged programming language, complete with a proper syntax. It is very important to get the syntax right, or else the kernel will be unable to perform your task. Mathematica is notorious for a steep learning curve, and part of the reason for this is the rigidity of the language. The best way to learn Mathematica is to acquaint yourself thoroughly with the basic aspects of the code's structure before attempting complex tasks.
This page will provide a condensed overview of the basics of the Mathematica language. Links will be provided where necessary to more detailed explanations.
Basic Structure of the Language Edit
Just as the smallest unit of the English language that still makes semantic sense is the word, the smallest unit of the Mathematica language is the object. Whenever you write some input, Mathematica first deconstructs this into a tree of objects and then interprets it. There are various types of token in Mathematica:
|Type of token||Examples||Use|
|Symbol||a, abc, α, αβγ||Represents an object|
|String||"a", "abc", "αβγ"||Holds a fixed textual content|
|Number||1, 12.34, 2^10||Holds a fixed numerical value|
|Operators||+, -, *, /||Represents processes to perform on tokens|
|Comment||(*some text here*)||Holds notes that are not to be used by the kernel|
Any expression in Mathematica can then be nested functions of the form head[e1,e2,...] where head must be a Symbol and ei can be any of the supported object types or another function.