Help us understand the problem. What is going on with this article?

ラングレーの問題をだいたいsympyを使って解く

More than 3 years have passed since last update.

(参考)ラングレーの問題
https://ja.wikipedia.org/wiki/%E3%83%A9%E3%83%B3%E3%82%B0%E3%83%AC%E3%83%BC%E3%81%AE%E5%95%8F%E9%A1%8C
(参考)Langley’s Adventitious Angles
https://en.m.wikipedia.org/wiki/Langley’s_Adventitious_Angles

#実行時間は、2分ぐらいかかります
from sympy import *
var('x')
x=100
B=Point(0,0)
A=Point(x*cos(pi/180*80),x*sin(pi/180*80))
C=Point(x*cos(pi/180*80)*2,0)
D2=C.rotate(pi/180*60)
E2=B.rotate(pi/180*(-50), C)
ans1=Line(C,A).intersection(Line(B,D2))
ans2=Line(B,A).intersection(Line(C,E2))
D=Point(ans1[0].x,ans1[0].y)
E=Point(ans2[0].x,ans2[0].y)
print("#角度BDE=",float(mpmath.degrees(Polygon(B,D,E).angles[D])))
#角度BDE= 30.0

#①xに値を入力しないと、以下のエラーがでます
#ValueError: Can't determine orientation
#②mpmath.radians関数を使うと
#角度BDE= 30.000000000000068

CADを使ったほうが早いかも。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away