MathGroup Archive 1999

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

Search the Archive

Step functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg17097] Step functions
  • From: Alessio Massaro <alessio.massaro at cern.ch>
  • Date: Sat, 17 Apr 1999 03:35:00 -0400
  • Organization: CERN
  • Sender: owner-wri-mathgroup at wolfram.com

Can anyone help me to build a step function out of a series of {x,y} pairs?

For ex.., consider an ordered random {x,y} series like

data=Sort[Table[{Random[],Random[]}, {10}], First[#1]<First[#2]&]

I would like to build a function f[ { {x1, y1}, {x2, y2}, ...}, x ], that
evaluates to:
- y[i]        if x=x[i]
- y[i+1]    if x[i]<x<x[i+1]
Here each point {xi, yi} determines f over the left-open interval
x[i]<x<=x[i+1] of x.
The right-open interval version would be:
- y[i]        if x=x[i]
- y[i]        if x[i]<x<x[i+1]

Since I do not check the newsgroup regularly, I'll greatly appreciate
replies sent to my e-mail address as well as the NG itself.

Thanks and regards to everybody
Alessio




  • Prev by Date: Re: Heip! How to draw a graph with log x axis.
  • Next by Date: Display (was: psfix)
  • Previous by thread: Continued Fractions of Chap
  • Next by thread: Re: Step functions