# Plot various functions in different intervals [closed]

I need to do some really easy in WolfarmAlpha online. I want to to plot 2x for {1 to 3} and x^2 for {3 to 5}. I tried multiple combinations, none of them gave me what I want. The following input did not work either.

Plot[(2*x),{x, 1, 3}], Plot[(x^2),{x, 3, 5}]

-

## closed as off-topic by Yves Klett, belisarius, Sjoerd C. de Vries, m_goldberg, ciaoJul 7 '14 at 21:03

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Yves Klett, belisarius, Sjoerd C. de Vries, m_goldberg, ciao
If this question can be reworded to fit the rules in the help center, please edit the question.

See the first example in Piecewise. –  kguler Jul 7 '14 at 16:38

As suggested by kguler, using Piecewise is easiest; however, you can also use Show or Boole.

Show[
Plot[(2*x), {x, 1, 3}],
Plot[(x^2), {x, 3, 5}],
PlotRange -> All,
AxesOrigin -> {0, 0}]


Plot[
2 x Boole[1 < x < 3] +
x^2 Boole[3 < x < 5], {x, 0, 5},
AxesOrigin -> {0, 0},
PlotStyle -> Red]


-