MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: In which interval?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg13426] Re: [mg13303] In which interval?
  • From: "Jurgen Tischer" <jtischer at col2.telecom.com.co>
  • Date: Thu, 23 Jul 1998 03:33:28 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Pal, just for the fun of it I have still another solution: Say x is
the vector of the x(i). Then define

f=Interpolation[Transpose[{x,Range[0,Length[x]-1]}],InterpolationOrder->0]

All you have to do afterwards is letting the guys of Wolfram Research do
the work for you, f[R] will give the number of the interval. The only
point to be careful about is if R is one of the x(i), my experiments
are not conclusive on what will happen (as far as I can see, the upper
point is counted as part of the interval in most cases). But this will
be a problem with any method, because of the problem to decide was
means equal, right?

Jurgen

-----Original Message-----
From: Pal Lillevold <pal.lillevold at pensfins.no> To:
mathgroup at smc.vnet.net
Subject: [mg13426] [mg13303] In which interval?


>I need to resolve the following problem:
>
>Given N distinct real Intervals (x(i),x(i+1)); i=1,,,,N and a real
>number R - in which interval is R located. In other words to identify
>the unique value of i such that x(i)<=R<x(i+1). This is easy to do by
>straight forward checking which value of the N i's which match the
>inequalities. But this is very time-consuming when the number N is
>large. Has anyone been confronted with this problem and resolved it
>efficiently? I would highly appreciate any assistance.
>
>Thank you in advance and best regards.
>
>Pal Lillevold
>



  • Prev by Date: Re: MathLink with PowerPlant
  • Next by Date: Re: Re: Re: Re: logical inconsistency in Union
  • Previous by thread: Re: In which interval?
  • Next by thread: Tree plotting package?