Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12600

Creating a Piecewise function with imported list of arbitrary length

From Nick Broderick <crazychessman@msn.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Creating a Piecewise function with imported list of arbitrary length
Date 2012-12-04 09:09 +0000
Message-ID <k9kek2$681$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


Apologies if this seems like a simple question, but I'm not familiar enough with Mathematica syntax to know how to do this. Essentially I have an arbitrary list (length n) of pairs -- taken from an input file -- from which I need to define a Piecewise function. The pairs (x_i,y_i) define the left-sided endpoints for each portion of the function, and the last point defines the value y_n of the function for x > x_n. For example:

{{0,1},{300,2},{600,3}}

defines a Piecewise function:

f(x)= {{1, 0 <= x <300},{2, 300 <= x <600}, {3, x > 600}, {0, True}}

But I'm not sure how to go about creating a arbitrary list of conditions fr=
om my list of pairs. Any help would be appreciated.

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Creating a Piecewise function with imported list of arbitrary length Nick Broderick <crazychessman@msn.com> - 2012-12-04 09:09 +0000
  Re: Creating a Piecewise function with imported list of arbitrary length Ray Koopman <koopman@sfu.ca> - 2012-12-06 09:57 +0000

csiph-web