In addition to the solutions already posted, I just want to say that for efficient computation it'd be better to work with vector arguments and functions having rank greater than 0. (You can use the rank-0 functions to check that the vector functions are correct.)
The following are solutions to similar looking problems: http://www.jsoftware.com/jwiki/Essays/Collatz%20Conjecture http://www.jsoftware.com/jwiki/Essays/Mertens%20Function ----- Original Message ----- From: mikel paternain <[email protected]> Date: Sunday, August 28, 2011 3:41 Subject: [Jprogramming] a new question To: [email protected] > > How do you write in J a "tent" function: > > g(x)= > x/2 if 0<=x<=1/2, > (1- > x)/2 if 1/2 < x < 1 > > and, more important, How do you write in J a Takagi function > with the "tent" function: > > h(x)= Sum [r=0 to infinite, g(2^r x)/2^r] ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
