Hypothetically speaking, you can get J to tell you how to build tacit verb.
Practically speaking... here's the definitions you gave: pwr =. ^~ NB. this is y to the power x (dyadic tacit verb) recip =. %@ pwr NB. take the reciprocal zeta =. +/"_ @: z NB. sum all And here's how I would examine them: First, enable linear represenation of verbs: 9!:3]5 Second, resolve the names in your definition: zeta f. |value error: z (oops) It looks like you left out a part of your definition. I've not worked with zeta before, and I don't actually know which zeta function you were trying to compute. At a guess, though, you were using one that happens to work nicely with this kind of implementation. If you could supply the rest of the definition, though, I think one of us could go into how it works. Thanks, -- Raul On Sun, Mar 9, 2014 at 1:22 PM, Jon Hough <[email protected]> wrote: > 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 > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
