> From: Don Watson
>
> I am interested in using the J system for experiential use in
> elementary
> and secondary school Mathematics. It has many advantages, including
> free
> availability for education.
>
> . However, no one would claim it is easy for teachers to learn J. What
> I
> have done in this paper is describe a language - called S, for school -
> that
> seems to be closer to Mathematics and needs no tacit programming form.
Don,
I'm still not convinced that the effort you are putting into defining a new
language wouldn't be more productively spent (from an engaging-kids-in-maths
point of view) in working on ways of using J in its current form.
I agree that the tacit form of J takes a bit (or a lot) of getting used to, and
I agree that it would make life less confusing to leave it out of your teaching
(at least to start with).
You put a bunch of restrictions on what the ideal model shouldn't do because
the focus should be on the Mathematics
* no intermediate variables and intermediate verbs
* only one-line S models are required
* no constants
In my experience mathematical formulae often occupy multiple lines, often use
intermediate variables and/or intermediate verbs/functions. They also often
include constants (pi, Euler's number etc).
Using your example of standard deviation - the mathematical formula is often
also written:
(imagine Sigma for 'E')
_______________
/ _ 2
/ E( x - x )
/ __________
\/ n - 1
In this version, xbar (x with a line over the top) and n are both basically
either an intermediate verb or noun:
xbar = mean(x)
n = count(x)
Here is an off-the-cuff example of how you might introduce someone to the mean
and standard deviation using existing J. I'm sure it can be improved on both
didactically and syntactically, but the idea is to put forward how a teaching
session using existing J might look.
How would the equivalent look in S?
Is it that much better that the effort of developing and maintaining a new
language is required?
========== J session ===========================================
NB. The arithmetic mean is often used to provide an estimate of the middle
or centre of a set of values.
NB. To calculate the mean of some values, we sum those values and divide the
sum by the number of values
NB. So for the values y
y=: 4 5 6 2 3 4
NB. The sum of the values is:
+/y
24
NB. the number of values is:
#y
6
NB. the sum divided by the number is:
24 % 6
4
NB. We can do this in one step:
(+/y) % #y
4
NB. We can define the formula for the mean as a verb for easy reuse:
mean=: verb : '(+/y) % #y'
mean y
4
mean 3 7 4 5 8 2 3 4 5
4.55556
NB. The standard deviation is often used to provide an estimate of the
spread of a set of values.
NB. To calculate the standard deviation of some values,
NB. we take the take the sum of the squared deviations of the values from
their mean,
NB. and then divide that number by 1 less than the number of values and take
the square root.
NB. The deviations from the mean are:
y - mean y
0 1 2 _2 _1 0
NB. the sum of their squares is
+/ *: 0 1 2 _2 _1 0
10
NB. or combined:
+/ *: y - mean y
10
NB. now divide by 1 less than the number of values
(<:#y) %~ +/ *: y - mean y
2
NB. and finally take the square root:
%: (<:#y) %~ +/ *: y - mean y
1.41421
NB. It is again helpful to define the formula as a verb for easy reuse:
stddev=: verb : '%: (<:#y) %~ +/ *: y - mean y'
stddev y
1.41421
stddev 3 7 4 5 8 2 3 4 5
1.94365
=====================================================
This "session" could be be easily adapted for presentation using the existing
Lab facility in J.
If you decide to move forward with your idea I suggest that you might like to
come up with a different name:
* Using a single letter as a name for something has a lot of disadvantages
when it comes to searching for that name on the internet.
* There is already a language called S
<http://en.wikipedia.org/wiki/S_programming_language>
> I apologize for not using the Wiki. My generation was not brought up
> to understand instructions. Few things used to have complexity.
Compared to the complexity of the thought that went in to your proposed syntax,
using the wiki is very simple!!
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm