# How to make sure that the number of PlotPoints is sufficient for giving the complete result? (How to have a plot of the whole solutions?))

I want to see the domain in which function $$f$$ is positive. I use this code

f := (7 + 10 x^2 - x^4 + (3 + x^2)^2 Cos[2 x]) Sin[ x]^2 ;
Plot[If[f > 0, 0], {x, 0, 1000},
PlotStyle -> {Automatic, Directive[Thickness[.01], Red]},
PlotPoints -> 5000, WorkingPrecision -> 10, MaxRecursion -> 6]


but when I increase the value of PlotPoints, I see that the red parts are increasing continuously. How can I know the maximum value of PlotPoints which gives me the whole result (all the positive part)? Especially when I need to see data for a very large number of x.

Clear["Global*"]

f := (7 + 10 x^2 - x^4 + (3 + x^2)^2 Cos[2 x]) Sin[x]^2;


The domain is

dom = Reduce[{f > 0, 0 <= x <= 1000}, x];


Looking at the first few intervals in the domain

dom[[1 ;; 5]]


The number of intervals is

Length@dom

(* 637 *)

NumberLinePlot[dom, x]


This is too dense to be meaningful. Looking at a small region

NumberLinePlot[dom, {x, 0, 10}]


• Thanks. So, this command NumberLinePlot[dom, x]  gives the whole results, right? Nov 3, 2020 at 17:15
• Yes. dom is the whole result and the plot displays dom Nov 3, 2020 at 17:41
• Thanks. But I get this error for dom command: "This system cannot be solved with the methods available to Reduce. >>" Nov 3, 2020 at 17:48
• What version of Mathematica are you using? Nov 3, 2020 at 17:56
• I do not have that version. Try looking at a smaller interval, e.g., xmin = 0; dom = Reduce[{f > 0, xmin <= x <= xmin + 20}, x]; NumberLinePlot[dom, {x, xmin, xmin + 20}] You could also use Manipulate to control xmin Nov 3, 2020 at 18:10

Maybe we should split the the domain of definition into several intervals.

domMax = 100;
sols = Reduce[(7 + 10 x^2 - x^4 + (3 + x^2)^2 Cos[2 x]) Sin[x]^2 > 0 &&
0 <= x <= domMax, x, Reals] // N;
Table[Plot[{(7 + 10 x^2 - x^4 + (3 + x^2)^2 Cos[2 x]) Sin[x]^2, 0},
x ∈ ImplicitRegion[sols[[i]], x], PlotStyle -> {Blue, Red},
TicksStyle -> Directive["Label", Tiny]], {i, Length@sols}]


Explain the above codes.

we use Reduce to find all the interval which the function is positive. For example, the first interval is 0. < x < 1.38363,the second interval is 2.0214 < x < 3.14159 etc.

An then we can Plot function by using the x ∈ ImplicitRegion to set the range of function.

Plot[(7 + 10 x^2 - x^4 + (3 + x^2)^2 Cos[2 x]) Sin[x]^2,
x ∈ ImplicitRegion[0. < x < 1.38363, x]]
`

• Thanks. Could you please explain more? Nov 3, 2020 at 23:53