JR=John Randall, DB=me
JR> Given that the xth Chebyshev polynomial evaluated at y can be written
JR>     cos x*arccos y
JR> is there a way to write it using inverses?

DB>  I'd be tempted to write:
DB>     cheb0 =:  2 _2 */ .o. ,
DB>  If you were asking if there's a way to write 
DB>  this with  &.  (under),  I think the answer is no.

JR>  I was thinking along these lines:
JR>     t3=:0 _3 0 4&p.
JR>     T3=:13 : 'cos 3&* arccos y'
JR>      f =:3&* &. arccos

Ah, I see I misunderstood your original question.  You wrote  cos x*arccos y  
intending it to be read as J, but I read it as math notation.  Which is to say, 
the code I posted solves the wrong problem (i.e.  my  cheb  verbs  give  (cos 
x)*(arccos y)   instead of  cos(x * arccos y)  ).  Sorry about that.

JR>  What I can't do is make the 3 a parameter.  As you indicate, it may be
JR>  impossible in a verb.  

Correct (I hope my explanation of why is still clear, despite my 
misunderstanding).  

JR>  Perhaps if one really wanted to do this, one should
JR>  use an adverb instead.

Of course, you could do this pretty easily, i.e.:

           F =: (&*) (&. arccos)
        
           3 F 
        3&*&.arccos
           
But adverbial solutions have serious drawbacks (unless the arguments are pretty 
static and known in advance, adverbs & conjs are hard to use; it's hard to 
slice-and-dice arguments to them).

Coincidentally, Tracy Harms and I were having a discussion on just this topic 
not too long ago, on RosettaCode:

   http://www.rosettacode.org/wiki/Talk:Forward_difference#J:_verb_vs_adverb

-Dan

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

Reply via email to