Find Angle MBC

Sort by

recency

|

873 Discussions

|

  • + 1 comment
    AB = int(input())
        BC = int(input())
        angle = math.degrees(math.atan2(AB,BC))
        degree = int(round(angle))
        print(str(degree)+ '\u00B0')
    

    This code works but can anyone explain what atan2 is??

  • + 0 comments

    import math

    AB = int(input().strip())
    BC = int(input().strip())

    angle_rad = math.atan2(AB, BC)
    angle_deg = math.degrees(angle_rad)
    result = round(angle_deg)

    print(f"{result}{chr(176)}")

  • + 0 comments

    Place coordinates:

    𝐵 ( 0 , 0 ) , 𝐴 ( 𝑎 , 0 ) , 𝐶 ( 0 , 𝑏 ) B(0,0),A(a,0),C(0,b).

    Midpoint

    𝑀

    ( 𝑎 / 2 ,    𝑏 / 2 ) M=(a/2,b/2).

    Form vectors:

    𝐵 𝑀

    ( 𝑎 / 2 ,    𝑏 / 2 ) BM =(a/2,b/2)

    𝐵 𝐶

    ( 0 ,    𝑏 ) BC =(0,b)

    Dot product formula:

    cos ⁡

    𝜃

    𝐵 𝑀 ⃗ ⋅ 𝐵 𝐶 ⃗ ∣ 𝐵 𝑀 ⃗ ∣ ∣ 𝐵 𝐶 ⃗ ∣ cosθ= ∣ BM ∣∣ BC ∣ BM ⋅ BC ​

    Simplify:

    cos ⁡

    𝜃

    𝑏 𝑎 2 + 𝑏 2 cosθ= a 2 +b 2 ​

    b ​

    Find angle:

    𝜃

    cos ⁡ − 1  ⁣ ( 𝐵 𝐶 𝐴 𝐵 2 + 𝐵 𝐶 2 ) θ=cos −1 ( AB 2 +BC 2 ​

    BC ​

    )

    Round to nearest integer if needed.

  • + 0 comments

    A different solution without tangent.

    import math
    
    def main():
        # a = AB and b = BC
        a, b = int(input()), int(input())
        # c = AC (hypotenuse)
        c = math.hypot(a, b)
    
        # Calculate angle A (opposite side a)
        # using the law of cosines
        cos_A = (b**2 + c**2 - a**2) / (2 * b * c)
        angle_A_rad = math.acos(cos_A)
        angle_A_deg = math.degrees(angle_A_rad)
        print(f"{round(angle_A_deg)}\u00B0")
    
    if __name__ == "__main__":
        main()
    
  • + 0 comments

    This is how you find angle MBC with degree sign: Syntax:

    import math ab=int(input()) bc=int(input()) print(f"{str(round(math.degrees(math.atan2(ab,bc))))}\u00B0")