Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a function $Eb1$ which was the subject of a question I asked recently - you can see it here on stack exchange. Now, in that example it's specified between a boundary $r_n$ and $r_o$ where $r_o > r_n $ and it works as expected. I also want to specify the value of the function between 0 and $r_n$ - fcor all $r < r_n $, the function is a constant with the value $Eb1(r_n)$, so the same value it is at the boundary. I am however unsure how to code this, and how to combine these two specifications into a single expression.

I was considering using piece-wise, but I am unclear about how to specify this and so far my attempts have failed. Any ideas?

share|improve this question

I've actually managed to answer it myself - will answer here if it's any good to others;

Ebound[r_] = 
  Piecewise[{{Eb1[rn, 14400] /. x, r < rn}, {Eb1[r, 14400] /. x, 
 r > 0}}];

Plot[Ebound[r], {r, 0, ro}, PlotRange -> Automatic]

this gives the expected behaviour;

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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