This script illustrates many ICL features.
First it loads rule.plt; the defining plot for dimensional (units)
analysis. This is a user extensible file that defines the relationship
between basic units; for example watt = volt*amp. It is a special
plot in which units are not evaluated.
The script then copies the units into the
constants plot so that they can be used to define units for the
various constants we will use for this problem. Constants are
then defined along with their units. We set the angle computation
to radians and reset it at the end to degrees. The function eb(t,u),
is the black body radiation function taken from a text book.
The frequency, u, will be passed into the function as a vector.
That forces the left hand side of the equation to also be a vector
of the same length. What that means to you, the user, is that
the expression evaluation will automatically loop through each
wavelength using an efficient C language coded loop that runs
thousands of times faster than an equivalent interpretive language
like Visual Basic.
The vector function is built into the ICL
language and creates a vector from 0 to the magnitude of its
argument, with the number of elements equal to the argument.
"wavelength" is then the x-axis scale for the blackbody
plot, running from 400 nanometers to (400+380) nanometers; the
visible specrum of light. Newplot and setplot make the plot;
copying wavelength over as the default vector. The keyword "default"
can then refer to the wavelength. "c/default" is evaluated
to be a vector and its vector property causes the function eb()
to be evaluated as a vector for each of the wavelengths. Its
then a simple matter to plot each curve, normalized to its own
mean. Dimensional analysis proceeds as you go so that dimensional
errors ill wind up with strange or unknown units.