Simple References $p[n]

Top  Previous  Next

A simple reference allows you to access one specific value from the parameter.

 

$p=list("red","orange","yellow","green","blue","indigo","violet")

 

In this example, if you use $p in your equation, it will be replaced with a random color from the set. If you wanted to specifically use blue, you can reference it with $p[5].

 

One example usage for  references might be with arithmetic progressions.

 

$a=range(4,1000,3)

 

This range parameter will select from the values:

 

 4, 7, 10, 13, 16 ... 994, 997, 1000

 

These numbers are in arithmetic progression.

 

$a[14] will give you the 14th number in the arithmetic progression (43). In general, $a[n] will give you the nth number in the arithmetic progression.