# How to plot a given function over its domain

How can I plot

Sqrt[x - x^3]/(x^2 + 1)


in all its domain?

Domain = FunctionDomain[{ Sqrt[x - x^3]/(x^2 + 1)}, x]


Domain is : x <= -1 || 0 <= x <= 1

I tried

Plot[{Sqrt[x - x^3]/(x^2 + 1)}, {x, -100, -1}]


but I really dont know how!

• What are you asking?... – garej Mar 29 '16 at 19:05
• I want to plot the function Sqrt[x - x^3]/(x^2 + 1) and I cant – Sofia Paz Jimenez Castillo Mar 29 '16 at 19:11
• Plot[{Sqrt[x - x^3]/(x^2 + 1)}, {x, -10, 1}]? – garej Mar 29 '16 at 19:12
• The curly braces are not necessary here. – Sjoerd C. de Vries Mar 29 '16 at 19:31

Here's one approach:

Plot[Sqrt[x - x^3]/(x^2 + 1),
Element[x, ImplicitRegion[FunctionDomain[{Sqrt[x - x^3]/(x^2 + 1)}, x], x]]]


• Interesting! I wasn't aware you can use region specification directly on Plot like that. – kirma Mar 30 '16 at 4:36
• BTW, I believe the pedantically correct way would be to write Element[{x}, ...]. Otherwise x is actually treated as an one-dimensional vector, and it might not always work as it should as a scalar. – kirma Mar 30 '16 at 4:40
• There's probably some difference between x and {x} in Plot, but I don't know of any off the top of my head. If you find any, let me know. – Brett Champion Mar 30 '16 at 15:57
• I suspect Plot does some magic with its argument, since it knows that it cannot be multidimensional vector, anyway. Normally there's a difference between x and {x} in these cases (and documentation indicates that {x} should be used), but now it seems impossible to spot from insides of Plot. – kirma Mar 30 '16 at 17:10
• I know Plot does some magic with its argument. :-) – Brett Champion Mar 30 '16 at 19:25

I believe that you are looking for something like the following. It uses the Show function to combine the two plots.

Show[Plot[{Sqrt[x - x^3]/(x^2 + 1)}, {x, -10, -1}],
Plot[{Sqrt[x - x^3]/(x^2 + 1)}, {x, 0, 1}], PlotRange -> All]

• @JMM, Plot[{Sqrt[x - x^3]/(x^2 + 1)}, {x, -10, 1}, AxesOrigin -> {-10, 0}] is enough – garej Mar 29 '16 at 19:23
• @SofiaPazJimenezCastillo Don't forget to accept one of the answers by clicking the check mark. – Jens Mar 30 '16 at 2:33