0
$\begingroup$

When plotting the below function, Mathematica does not show the two zeros: 3, 4.

Note the region between (7+sqrt(5))/2 and (7-sqrt(5))/2 ~[2.38,4.62] is not real, but those 2 points should still show on the graph. Any idea why they don't? Or can I change a setting to make them show?

$$(x^2 - 7 x + 11)^{x^2 - 11 x + 30} = 1$$

Here are all the roots: {{x -> 2}, {x -> 3}, {x -> 4}, {x -> 5}, {x -> 5}, {x -> 6}} graph

Note the first derivative is undefined in that range I gave above, but those 2 points should still be valid roots.

Negative Region of first derivative

$\endgroup$
1
  • $\begingroup$ Please post code that can be copied/pasted to reproduce the problem. $\endgroup$ Dec 21, 2020 at 2:09

1 Answer 1

3
$\begingroup$
Clear["Global`*"]

eqn = (x^2 - 7 x + 11)^(x^2 - 11 x + 30) == 1;

roots = Solve[eqn && 0 <= x <= 7, x]

(* {{x -> 2}, {x -> 3}, {x -> 4}, {x -> 5}, {x -> 5}, {x -> 6}} *)

Verifying the roots,

And @@ (eqn /. roots)

(* True *)

Point solutions will not show up in a Plot since the probability of them being detected is zero -- even with large values for PlotPoints, MaxRecursion, and WorkingPrecision. Plot works "to create a smooth curve" and point solutions do not lay on a smooth curve. You need to manually place point solutions.

Highlighting all roots including the point solutions:

Plot[Evaluate[Subtract @@ eqn], {x, 0, 7},
 PlotRange -> {-1.5, 1},
 PlotPoints -> 200,
 MaxRecursion -> 10,
 WorkingPrecision -> 20,
 Epilog -> {Red, AbsolutePointSize[4], Point[{x, 0} /. roots]}]

enter image description here

EDIT: It is easier to see the roots using ReImPlot

ReImPlot[Evaluate[Subtract @@ eqn], {x, 0, 7},
 PlotRange -> {-1.5, 1},
 PlotPoints -> 200,
 MaxRecursion -> 10,
 WorkingPrecision -> 20,
 Epilog -> {Red, AbsolutePointSize[4], Point[{x, 0} /. roots]},
 PlotLegends -> Placed["ReIm", {.85, .25}]]

enter image description here

$\endgroup$
3
  • $\begingroup$ Thanks @Bob. Just a couple of questions: 1) Why would you run a "verify" on the roots? If Mathematica already provided that. 2) if you zoom in on the Real part, you see the line actually crosses the X-axis on 6 different locations, only 2 of those appear to be at exactly 3 and 4. What are the other 4 then? see here and 3) In Plotting any graph, is it better to draw the Real and Imaginary parts to visualize roots? Or just the normal plot? Then we may have trouble visualizing the points-issue, which we saw! $\endgroup$
    – Steve237
    Dec 21, 2020 at 3:09
  • 1
    $\begingroup$ The verification is not required in most cases; however, the option VerifySolutions was not specified in the Solve and verification is useful to check for possible extraneous solutions. Your link does not provide anything. It is not important how many times the real curve crosses the axis. That just means that the real part is zero. A root only occurs when the real curve and imaginary curve intersect at the axis, i.e. Re[f[x]] == Im[f[x]] == 0. $\endgroup$
    – Bob Hanlon
    Dec 21, 2020 at 3:33
  • $\begingroup$ Damn sorry here is the link again: link Ah - excellent point on the intersection of the 2. I was definitely not aware of that. $\endgroup$
    – Steve237
    Dec 21, 2020 at 3:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.