# Combining functions - is this a case for Piecewise?

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?

-

## 1 Answer

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;

-