Sinclair QL User Manual page 301

Hide thumbs Also See for QL:
Table of Contents

Advertisement

In general, a formula should only refer to cells that are in the region above and to the
left of the cell containing the formula, including the row and column containing the formula.
If you do not follow thiS rule, as ,n this example, it is likely that the results may be incorrect.
In most cases you can obtain a correct result by forcing a recalculation of the gnd With
the Xecute command or, as in thiS case, calculaflng the gnd In column order
[B1] "STANDARD DEVIATION
[82] rept<"=". Len(b1))
[B4J "Va Lue
[C4] "Dev i at i on
[04] "Squa re of dev.
[B5J co L=ro_ ()
[rows 5 to 14]
This last formula Inserts a set of dummy values in the cells of column B for testing the
application. When the gnd entnes are complete you can replace them with other values.
The table described In this example will only hold ten values - you can change thiS
to cope with more if you want.
[A16] "Mean
[816] ave(vaLue)
[rows 5 to 141
deviation=vaLue-$mean.vaLue
trows 5 to 14]
square=dev*dev
[rows 5 to 14J
[C16J "Vari anee
[016] ave (square)
[rows 5 to 141
These formulae show that the variance of a set of numbers is defined as the average
of the squares of the deviations from the mean,
[C17] "Std. Dev.
[D17J sqr(varianee)
[columns 0 to 0]
and that the standard deViation can be calculated as the square root of the variance.
[D18J rept("-". Len(str(std.sq.3.Q)))
The numbers In this example are left in general format so that it can handle any range
of values. The underlining uses the length of the text string corresponding to the number
in the cell above (with cell reference "std.sq') expressed in general format.
You can improve the appearance of the display by changing to centre Justification for
the text in the range B4:04, and using left justified numbers in the range B16:017.
If you try using this example by putting different values In the cells of column B, you
will find that it does not give the correct answers. The reason is that the recalculation
of the grid is performed row by row, from the top downwards. Any alteration you make
will therefore be worked out on the basis of an incorrect mean value (since the new
mean will not be calculated until after the deViations from the mean). The solution is
to make the recalculation of the grid be in column order from left to right. You do this
with the Design command.
Use the
'C'
option to change the column order and leave the command by pressing
ENTER, as Indicated in the control area. When you next change a value in column
B, the calculation will be correct, since the new mean is now calculated before the
deViations. Although this ability to change the order of calculation IS very useful, you
should not get into the habit of using It too often - calculating in column order IS much
slower than row order
If you save a gnd to a Microdnve file, the current settings of all the Design options are
saved with it and they are used whenever you reload the file.
This example will allow you to plan your household expenditure over the yem You can
enter your estimated expenditure under a number of headings for each quarter. You
are then provided With quarterly totals, your expenditure for the whole year and the
averaged monthly cost.
Do not type any numbers Into the table until you have completed it. ThiS allows you
to change the form of numeric display, With the Defaults option of the Units command,
as descnbed later.
12/84
Examples
AHOUSEHOLD
BUDGET
25

Advertisement

Table of Contents
loading

Table of Contents