Mathematica Asked by Jesper Johansson on March 11, 2021
New to Mathematica and have been given some assignments for practice.
I am currently trying to plot the following function:
$$|sqrt{x-1}+5|$$
This is how other sites show what this graph should look like:
But trying to plot the same function in Mathematica gives the following 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!
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}]
Correct answer by cvgmt on March 11, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP