New to Mathematica and have been given some assignments for practice.

I am currently trying to plot the following function:


This is how other sites show what this graph should look like:

Example graph

But trying to plot the same function in Mathematica gives the following unexpected graph:

unexpected graph

That straight line coming in from the left shouldn't be there, and no matter how I try to re-organize the plot function it seems to stay.

Am I misunderstanding something? Am I using the Plot function wrong? Thanks for any help and apologies if this is a noob question!


1 Answer 1


Use RealAbs instead of Abs since Abs is a Complex function. And the Sqrt is also a Complex function, sometimes we use Surd instead of Sqrt or Power

if we assume x is a real numbers,we can use ComplexExpand to observe the expression of Abs[Sqrt[x - 1] + 5]

Abs[Sqrt[x - 1] + 5] // ComplexExpand

(*  Sqrt[(5 + ((-1 + x)^2)^(1/4) Cos[1/2 Arg[-1 + x]])^2 + 
 Sqrt[(-1 + x)^2] Sin[1/2 Arg[-1 + x]]^2] *)

So we had to use another way.

Plot[RealAbs[Surd[x-1,2]+5],{x,-5,5},AxesOrigin -> {0, 0}]
  • $\begingroup$ Amazing comment, thanks for the help! My whole study group appreciates it. $\endgroup$ Sep 24, 2020 at 2:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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