The function as spec'd had domain 0-1.  As used, it needs infinite 
domain.  From your reference, it should be

    tent =: -:@:(|&.(0.5&-))@:(1&|)
    (,: tent) 0.25 * i: 6
_1.5 _1.25 _1 _0.75 _0.5 _0.25 0  0.25  0.5  0.75 1  1.25  1.5
0.25 0.125  0 0.125 0.25 0.125 0 0.125 0.25 0.125 0 0.125 0.25

Then the infinite sum would be

    INFINITY =: 32
    h =: ([: +/ tent&.(*&(2 ^ i. INFINITY)))"0

which you can see with

    load 'plot'
    plot 0 1 10000 ; 'h y'


Alas,
    plot 0 1; 'h y'

fails.

Henry Rich

On 8/28/2011 11:21 AM, Roger Hui wrote:
> The infinite sum looks OK to me.
> http://en.wikipedia.org/wiki/Blancmange_curve
>
>
>
> ----- Original Message -----
> From: Henry Rich<[email protected]>
> Date: Sunday, August 28, 2011 8:01
> Subject: Re: [Jprogramming] a new question
> To: Programming forum<[email protected]>
>
>> With infinite rank:
>>
>>      tent =: -:@:(|&.(0.5&-))
>>      tent _0.1 0 0.1 0.2 0.3 0.5 0.7 0.8 0.9 1 1.1
>> _0.05 0 0.05 0.1 0.15 0.25 0.15 0.1 0.05 0 _0.05
>>
>> I got nothin' on the infinite sum (which looks to me like it has
>> a typo
>> in the spec)
>>
>> Henry Rich
>>
>> On 8/28/2011 10:38 AM, Marshall Lochbaum wrote:
>>> How about
>>>
>>>       tent=: 0>. [:-: -.^:(>&0.5)"0
>>>       tent _0.1 0 0.1 0.2 0.3 0.5 0.7 0.8
>> 0.9 1 1.1
>>> 0 0 0.05 0.1 0.15 0.25 0.15 0.1 0.05 0 0
>>>
>>> Marshall
>>>
>>> On Sun, Aug 28, 2011 at 7:47 AM, Ric
>> Sherlock<[email protected]>   wrote:
>>>
>>>> Here's one tacit approach to the tent function:
>>>>      tent=: 0:`-:`(-:@-.)`0:@.(0 0.5 1&I.)"0
>>>>      tent _0.1 0 0.1 0.2 0.3 0.5 0.7 0.8 0.9 1 1.1
>>>> 0 0 0.05 0.1 0.15 0.25 0.15 0.1 0.05 0 0
>>>>
>>>> Given it is rank 0 I expect its performance can be improved. Also
>>>> although dyadic I. appears to work in this case, it doesn't
>> strictly>>  follow the 0<=x condition below.
>>>>
>>>> On Sun, Aug 28, 2011 at 10:40 PM, mikel
>> paternain<[email protected]>>>  wrote:
>>>>>
>>>>> 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
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to