Finding BAC

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Hill

    Finding BAC

    This is a javascript calculation problem

    var ABC = 68.616; //degrees
    var sinABC = Math.sin(ABC*Ma th.PI/180); //i.e. 0.93

    var b = 4.123; //length of a long leg
    var c = 4.37; //length of a hypotenuse

    var sinBAC = (b*sinABC)/c; //i.e. .877

    var BAC = ????????;

    How do I convert sinBAC back to degrees using javascript?

    BAC something around 61 degrees.....

    Any help is appreciates.

    Mike
  • Andrew Urquhart

    #2
    Re: Finding BAC

    *Michael Hill* wrote:[color=blue]
    > This is a javascript calculation problem
    >
    > var ABC = 68.616; //degrees
    > var sinABC = Math.sin(ABC*Ma th.PI/180); //i.e. 0.93
    >
    > var b = 4.123; //length of a long leg
    > var c = 4.37; //length of a hypotenuse
    >
    > var sinBAC = (b*sinABC)/c; //i.e. .877
    >
    > var BAC = ????????;
    >
    > How do I convert sinBAC back to degrees using javascript?
    >
    > BAC something around 61 degrees.....
    >
    > Any help is appreciates.[/color]

    Use Math.asin, and then convert radians to degrees. Whether the inverse
    can give results in the wrong quadrant is left as an exercise for the
    reader! :-)
    --
    Andrew Urquhart
    - FAQ: www.jibbering.com/faq/
    - Archive: www.google.com/groups?q=comp.lang.javascript
    - My reply address is invalid, see www.andrewu.co.uk/contact/


    Comment

    • Michael Hill

      #3
      Re: Finding BAC



      Michael Hill wrote:[color=blue]
      >
      > This is a javascript calculation problem
      >
      > var ABC = 68.616; //degrees
      > var sinABC = Math.sin(ABC*Ma th.PI/180); //i.e. 0.93
      >
      > var b = 4.123; //length of a long leg
      > var c = 4.37; //length of a hypotenuse
      >
      > var sinBAC = (b*sinABC)/c; //i.e. .877
      >
      > var BAC = ????????;[/color]

      Hmmm I'm wondering if that means BAC = sinBAC*(180/Math.PI); //convert
      to degrees ?????
      [color=blue]
      > How do I convert sinBAC back to degrees using javascript?
      >
      > BAC something around 61 degrees.....
      >
      > Any help is appreciates.
      >
      > Mike[/color]

      Comment

      • Michael Hill

        #4
        Re: Finding BAC

        >[color=blue]
        > Use Math.asin, and then convert radians to degrees. Whether the inverse
        > can give results in the wrong quadrant is left as an exercise for the
        > reader! :-)
        > --[/color]

        So you are saying ...

        BAC = Math.asin(sinBA C)*180/Math.PI;

        Comment

        Working...