You don’t need to be a programmer to make productive use of the JSL script editor. The editor can be used by non-programmers as a simple command-line calculator that provides access to JMP’s library of mathematical and statistical functions.
The Script Editor
If you don’t write JSL scripts you may never have had a need to use the script editor, so let’s first take a look at this. On the toolbar the second icon will create a new script window:
If you prefer you can use the following menu path: File>New>Script.
The script window is just a blank window into which we type commands. We want to use these commands to perform some calculations, so we also need an output area: right-mouse-click and select the option show embedded log. The window splits into two sections:
The upper section is the input region where we can type JSL statements with results being displayed in the lower section.
In-Built Functions
JMP has a vast library of in-built functions for performing mathematical and statistical calculations. Here is a simple example of using the PI function to obtain the value of π:
To generate this output I type “Pi()” and then click the run-script icon:
If you think about how we write functions in mathematics we might write something like:
y = f(x)
A similar notation is used in JSL. In particular the parentheses instruct the script editor that what is being written is a reference to an in-built function (if a valid function is identified by JMP then the script editor changes the text colour to blue). The parentheses also act to contain possible arguments. In the above example the function f is a function of x. For example the f function could be a natural logarithm and x could be the value 2.7183:
If I wanted a base-10 logarithm then I would use the function LOG10.
I’m not limited to single functions. I can build fully featured mathematical expressions using the following operations:
In this calculation for the area of a circle I wanted to assign my radius value to a variable before defining the formula for the area. To do this I have had to write 2 lines of code in which case I have to delimit the lines with a semicolon.
To be proficient in using the script editor as a calculator you need familiarity with the functions available inside JMP. Fortunately these are documented online:
These functions are also documented in the JMP help system under the Scripting Index option.
In my next post I will illustrate using the script editor to perform probability calculations to estimate number of defective parts per million for a process where I know the capability indices.
Quite! This has long been a extremely excellent post. Thanks for supplying this information and facts.