1. 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.
    Dismiss Notice

why is calculator giving in absolute form?

Discussion in 'Mathematics and Physics' started by PG1995, Nov 20, 2011.

  1. PG1995

    PG1995 Active Member

    Joined:
    Apr 18, 2011
    Messages:
    1,645
    Likes:
    13
    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
     

    Attached Files:

  2. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,029
    Likes:
    951
    Location:
    NJ
    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: Nov 20, 2011
  3. PG1995

    PG1995 Active Member

    Joined:
    Apr 18, 2011
    Messages:
    1,645
    Likes:
    13
    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.

    [Error: Syntax\ error : /usr/bin/latex --interaction=nonstopmode bab141dc8c978238e40a8155a023f78c.tex && /usr/bin/dvipng -q -D 300 -T tight -gamma 2.0 -bg Transparent -o 4e6c47909a88c63d0a2e00a17bec6537-2.png bab141dc8c978238e40a8155a023f78c.dvi]

    Best wishes
    PG
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,029
    Likes:
    951
    Location:
    NJ

    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: Nov 20, 2011

Share This Page