Hello Mike;

Well, if you do

  open,"1,0,"0 close

doing a head%tail on the oblique, and peeling off the ends twice and then summing, you get the 2-lag case.

For the 3+-lag case, one can start with 0 0 foo close. I'm not sure what the foo looks like; some rank mod of ,.


Mike Day wrote:
Randy

Yes - though I do like the use of oblique on a table
here.   Not so useful for offsets or lags other than
one time interval.

Mike

R.A. MacDonald wrote:
Hello Mike;

Does this work?

open (([: }. [)(+/ . %)([: }: ])) close

Mike Day wrote:
Sorry,  I forgot to add the add:

  open (+/@[EMAIL PROTECTED]:@(%//.@:,:))close

4.99181

   (+/@[EMAIL PROTECTED]:@(%//.)@:|:)1 4 {"1 tab

4.99181

Mike

Mike Day wrote:
[re-sent for readability - Thunderbird had removed
some line throws. There'll be some extra line padding
now - I think!]

Dear J Language

Raul's is what you want if you're happy with
an explicit answer. However, if by "tactic"
you mean "tacit" then this might be what you
want.

NB. Given
  open  =: 100 101 103 104 103 102
  close =: 101 100 104 104 105 103

NB. make a 2-row matrix using ,: "laminate"

  open (,:)close

100 101 103 104 103 102
101 100 104 104 105 103

NB. study use  of u/. "oblique" ...

  open (%//.@:,:)close

100 1 1.03 1 0.990385 0.971429 103

NB. clean up ends if you need to ...

  open ([EMAIL PROTECTED]:@(%//.@:,:))close

1 1.03 1 0.990385 0.971429

NB. If the quotes are columns in a table,
NB. eg (for your example) ...
  tab=:(open,.close)1 4}"1(100+?6 5$ 6)

NB. you can do this sort of thing...
 ([EMAIL PROTECTED]:@(%//.)@:|:)1 4 {"1 tab
1 1.03 1 0.990385 0.971429

Mike



Raul Miller wrote:
On 6/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Given:
open =: 100 101 103 104 103 102
close =: 101 100 104 104 105 103
how about
+/ open(index+1) % close(index)

Perhaps you mean
  +/ (}.open) % }:close
?

If not, could you specify more precisely what it is that
you mean?

Thanks,

----------------------------------------------------------------------
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


--

later ...
------------------------------------------------------------------------
|\/| Randy A MacDonald   | APL: If you can say it, it's done.. (ram)
|/\| [EMAIL PROTECTED]  |
|\ |                     | The only real problem with APL is that
BSc(Math) UNBF'83        | it is "still ahead of its time."
Sapere Aude              |     - Morten Kromberg
                        | Looking for a whip-smart APL developer? Send me a 
note.
Natual born APL'er       |     mailto:[EMAIL PROTECTED]
-----------------------------------------------------(INTP)----{ gnat }-

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

Reply via email to