Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

why is calculator giving in absolute form?

Status
Not open for further replies.

PG1995

Active Member
Hi

Please have a look on the attachment. Could you please tell me why the calculator is giving the answer (arrow points to the answer under discussion) in absolute form? (x^2 - a^2)^2 would always be a +ve number by definition, so in my opinion there was no need to use absolute form. Please help me. Thanks.

Regards
PG
 

Attachments

  • whyabsolute.jpg
    whyabsolute.jpg
    33.3 KB · Views: 275
Hi,

That's because some calculations involving a squared variable are not completely reversible using square root.
Squaring a number makes it always positive, although it could have been negative.
Consider x=-2, x^2=4, sqrt(x^2)=sqrt(4)=2, which is better represented by abs(x) not simply x.
Sometimes you can get by without needing the abs value brackets when the number is known to always be positive, such as with most resistor values. The calculators might stick abs value around it to make sure they cover all the bases, staying most general.
You can check your function with the expected values to determine if you need them or not.

R2=R1^2
R1=sqrt(R2)
R2=5^2=25
R1=sqrt(R2)=sqrt(25)=5

Dont need abs() there, but for a more general variable we need abs():
x2=x1^2
x1=sqrt(x2) ???
x1=-5
x2=(-5)^2=25
x1=sqrt(x2)=sqrt(25)=5
x1=5
Since we started with -5 and ended with just 5, the result is better represented by
x1=sqrt(abs(x2))=abs(x1)

If we need to preserve the sign of x1, then we have to do:
x1=sgn(x1)*sqrt(abs(x2))
provided that we have the sign of x1 to work with. Many times we dont.
 
Last edited:
That's because some calculations involving a squared variable are not completely reversible using square root.
Squaring a number makes it always positive, although it could have been negative.
Consider x=-2, x^2=4, sqrt(x^2)=sqrt(4)=2, which is better represented by abs(x) not simply x.

Thanks a lot, MrAl. It is really kind of you to help me with so many queries.

But I'm little confused. x^2 = x1, sqrt(x1) = +/-(x2). Which form x2 will be used depends whether x was negative or positive. If it was negative, then -x2 will be used. Am I correct.

[LATEX]$\sqrt{x}=\pm x,\hspace{0.06in}e.g.\hspace{0.06in}Let\hspace{0.06in}x=-5,\hspace{0.06in}x^{2}=(-5)^{2}=25=x_{1}.\hspace{0.06in}\sqrt{x_{1}}=\hspace{0.06in}\sqrt{25}=-5\hspace{0.06in}because\hspace{0.06in}x\hspace{0.06in}was\hspace{0.06in}-ve.$
[/LATEX]

Best wishes
PG
 
Hi,

When you solve an equation you can sometimes say the solution is plus or minus x.
But when you take the square root of a square you have to say that it is the abs value, because then it's a different story as the operations are simply sequential.

Lets see now, if we have (x-a)^2 and we take the square root, it seems like we would get x-a back. But watch what happens...

Lets say a is 3 and x is 5.
(5-3)^2=2^2=4, and sqrt(4)=2, no problem.

Now lets say a is 3 and x is 1.
(1-3)^2=(-2)^2=4, and sqrt(4)=2, same as before.

So simply put, in both cases we got abs(x-a), not plus or minus (x-a). So the answer here is not plus or minus (x-a) it's abs(x-a).
So the inverse operation (square root is the inverse operation of the squaring function) does not always yield the original expression. Something gets lost in the translation. So it doesnt matter what x or a is, we always get abs(x-a) and that's it.

I think if we do (x-a)^3 and then cube root we get the same thing back, but that's different because we dont loose the sign. We do have to be careful though.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top