I have created a tacit verb to calculate the Zeta function for any integer greater than 1. http://mathworld.wolfram.com/ZetaFunction.html My verb was built up step by step as follows: pwr =. ^~ NB. this is y to the power x (dyadic tacit verb) recip =. %@ pwr NB. take the reciprocal zeta =. +/"_ @: z NB. sum all
I tested it 2 zeta >: i.100 1.63498 This seems about right (should be about pi*pi/6) My first question is: I would like to make my verb in only one line, not using my step-by-step approach. But every time I tried this I got all kinds of errors or the calculation results were hopelessly wrong. How can I write this verb in a single line? Secondly, I'm still not entirely sure how this works. If I do 2 pwr 3 then that is 3*3, which is fine, but then doing "recip" afterwards, I'm not sure how J parses the recip verb as monadic (it takes the reciprocal instead of "2 over". How does J do this? Lastly, I am not sure why I needed to make +/ to be rank _. That was just a guess. Why is this? I understand it is the way @: and @ interact with the verbs but I'm struggling to see the cause. Thanks. Jon ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
