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
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to