4

So for the function (x^3 + 2)/(x^4 + 1) I needed to find the values where it is increasing and decreasing. I used

Reduce[D[f[x], x] > 0, x] // N

to find where it is increasing. Then I used

Reduce[D[f[x], x] < 0, x] // N

to find where it is decreasing. When I run that code I get

-2.11198 < x < 0. || 0. < x < 0.372591

and

x < -2.11198 || x > 0.372591

So my question is how do I turn those answers into coordinate pairs? To look like this: (-2.111985,0)∪(0,0.372591) and (-∞,-2.111985)∪(0.372691,∞)

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
awild
  • 51
  • 1

1 Answers1

5
sol1 = -2.11198 < x < 0. || 0. < x < 0.372591;
sol2 = x < -2.11198 || x > 0.372591;

region1 = List @@ (ImplicitRegion[#, x] & /@ sol1);
region2 = List @@ (ImplicitRegion[#, x] & /@ sol2);

rb1 = First @ RegionBounds[#]& /@ region1

{{-2.11198, 0.}, {0., 0.372591}}

rb2 = First @ RegionBounds[#]& /@ region2

{{-∞, -2.11198}, {0.372591, ∞}}

For displaying in the desired form:

HoldForm[# \[Union] #2]& @@ rb1

{-2.11198, 0.} ⋃ {0., 0.372591}

or

Infix[foo @@ rb1, "\[Union]"]

{-2.11198, 0.} ⋃ {0., 0.372591}

Similarly, for rb2:

HoldForm[# \[Union] #2]& @@ rb1

{-∞, -2.11198} ⋃ {0.372591, -∞}

Infix[foo @@ rb2, "\[Union]"]

{-∞, -2.11198} ⋃ {0.372591, -∞}

kglr
  • 394,356
  • 18
  • 477
  • 896