I have a list of values called EDFh3. This contained values which are partitioned by 3 where it is in the format

EDFh3 = {{value, lowerbound condition, upperbound condition},{},{},...}
Piecewise[{{#1, #2 <= x < #3}}] & @@@ EDFh3

I am trying to create a piecewise function that contains all of the values in EDFh3 into one piecewise function. Instead when I apply it to the Piecewise function I get a list of piecewise functions. Is there any way to combine piecewise function? Alternatively is there a way to edit the code above to produce one piecewise function initially.

  • 1
    $\begingroup$ Piecewise[{#1, #2 <= x < #3} & @@@ EDFh3] You just need to move your closing ] (and remove the outer list). $\endgroup$ Mar 6, 2017 at 16:09

1 Answer 1

Piecewise[{#1, #2 <= x < #3} & @@ # & /@ EDFh3]


Piecewise[{#[[1]], #[[2]] <= x < #[[3]]} & /@ EDFh3]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.