Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Creating a Piecewise function with imported list of arbitrary length
Replies: 1   Last Post: Dec 6, 2012 4:57 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Nick Broderick

Posts: 1
Registered: 12/4/12
Creating a Piecewise function with imported list of arbitrary length
Posted: Dec 4, 2012 4:09 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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:


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.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2016. All Rights Reserved.