The Many Ways of Sine

Raul Miller rdr@legislate.com
Sun, 25 Jun 95 00:44 GMT


Roger Hui:
   > 2&o. * 3&o.

Francois-Rene Rideau:
   How does it know that both functions should use the same argument ?

This is built into the grammar of the language.

   How would I do cos(x)*tan(y) ?

Well, you could do

 cos@x * tan@y
where
 cos =: 2&o.
 tan =: 3*o.

You've not really specified what x and y are, so perhaps I should also
leave them undefined.  However, if you wanted to have x be the left
argument and y be the right argument, you could have done

 x =: [
 y =: ]

Alternatively, if you wanted to supply a list of arguments where x was
the first item and y was the second item, you could have done

 x =: 0&{
 y =: 1&{

Of course, there are a variety of other things you could do as well...

   > * '' H. 3r2@(_1r4&*)@*:
   >    The phrase '' H. 3r2 is limit of the the hypergeometric 
   >    series with upper parameter the empty vector and 
   >    lower parameter the number three-halves.

      I don't even understand the english definition, so you can guess
   what the J version is to me!  I guess I must go back to my math
   textbooks!

One of the primary purposes of J is to help people understand these
concepts.  Unfortunately, the authors of J were unimpressed by the
response to their software when they were releasing it as freeware, so
they've gone commercial.  And, the hypergeometric series stuff is
primarily available only in commercial form.  [I believe there's a
freeware version for the windows environment that has this feature,
but I don't run windows, so I don't know for sure -- certainly,
they've not released the source for this part of the language.]

   > [ ` (! %~ 4&| { 0 1 0 _1"_) t. T. _
   >   Limit of Taylor approximation with specified coefficients.

      J sure looks nifty. But I'm not sure the computer community
   is ready to learn it...

J is targeted at the educational community.  It's primary purpose is
to teach concepts.  [Though there are a few people who are starting to
use it for commercial products -- there's more than 1e4 installations
of J but less than 1e5.  Of course, when it's sold as a product, the
development environment is not talked about.]

-- 
Raul