Thank you, Henry.

While I try to translate a mathematical expression into a J
expression, I often discover hidden patterns in the expression with
great joy. It sometimes leads me to a path to new insights.

It's the reason I am looking for the shortest form this time.

2007/6/26, Henry Rich <[EMAIL PROTECTED]>:
Not really, but gee, shouldn't we be using our wonderful
language to provide the most expressive form of c rather
than just the shortest?

  a =. (# * +/)@:* - *&(+/)
  c =. a % [EMAIL PROTECTED] %:@* [EMAIL PROTECTED]
  1 3 2 4 c 2 4 3 3.5
0.831522

  a =. ((# * +/)@:* - *&(+/)) "1
  c =. %: @ (%~/ . *) @: (a/~) @: ,:
  1 3 2 4 c 2 4 3 3.5
0.831522

I don't think either of these forms is useful for real work,
since they involve subtracting big near-equal numbers, but
I learned something about the computation by writing them.

Henry Rich

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of June Kim
> Sent: Tuesday, June 26, 2007 10:08 AM
> To: Programming forum
> Subject: [Jprogramming] Correlation Coefficient
>
> I've been playing with the expression at
> http://en.wikipedia.org/wiki/Correlation
>
>
>    c=.(*&[EMAIL PROTECTED]@:*)%*&(s(-~(#*s=.+/))&.:*:])
>    1 3 2 4 c 2 4 3 3.5
> 0.831522
>
> c is as short as I can get. Could you come up with a verb for
> correlation, shorter than c?
> ----------------------------------------------------------------------
> For information about J forums see
> http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to