I was trying to remember how to solve a math problem the other day, and I got 
the chance to use the verb  d. .
The problem is
find the sum(k= 0, k = infinity) of (k^2)/(2^k)
I don't know the best way to solve it, the method I employed was to do:
define
S(x) as  the sum(k= 0, k = infinity) of (k^2)*EXP(x * k),     defined for x < 0
then integrate w.r.t. x twice (ignoring constants of integration)
D^(-2)S(x) = the sum(k= 0, k = infinity) of EXP(x * k)
This is a geometric sum, so can be rewritten
D^(-2)S(x) = 1 / (1 - EXP(x))
Then, to rewrite S(x), we just need to differentiate twice w.r.t x. This is 
tiresome doing by hand, so I employed J:

  f =: %@:(1&+)@:(_1&*)@:^




  f d. 2 (^. 0.5)


which gives the answer: 6.




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

Reply via email to