4.1 Variables

Variables can be assigned to hold numerical values using syntax of the form

 a = 5.2 * sqrt(64) 

which may optionally be written as

 let a = 5.2 * sqrt(64) 

Numerical variables can subsequently be used by name in mathematical expressions, as in the example:

 print a / sqrt(64) 

Having been defined, variables can later be undefined – set to have no value – using syntax of the form:

 a = 

A list of all of the variables which are currently defined can be obtained by typing show variables. By default, an extensive list is returned, as many physical constants are pre-defined by PyXPlot. In Section 6.1, we will see that variables can also be set to hold string values – i.e. to hold pieces of text – and that such variables can have great power in allowing the user to auto-generate titles and labels for graphs.