0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

「五角形」をwolframalphaとsympyで作図

Last updated at Posted at 2022-08-16

オリジナル

参考

芒(のぎ)

紙片の結び目と正五角形,止め結び(とめむすび、英: Overhand knot)

五芒星のDXFファイルを生成

wolframalphaで

wolframalphaで作図(sympy経由)

from sympy import *
t=(2*pi)/5
A=Point(cos(pi/2+t*2),sin(pi/2+t*2))
B=Point(cos(pi/2+t*3),sin(pi/2+t*3))
C=Point(cos(pi/2+t*4),sin(pi/2+t*4))
D=Point(cos(pi/2+t*0),sin(pi/2+t*0))
E=Point(cos(pi/2+t*1),sin(pi/2+t*1))
print("Polygon[{",A.x,",",A.y,"},",
              "{",B.x,",",B.y,"},",
              "{",C.x,",",C.y,"},",
              "{",D.x,",",D.y,"},",
              "{",E.x,",",E.y,"},",
              "{",A.x,",",A.y,"}" 
             "]")
print("Polygon[{",round(A.x,3),",",round(A.y,3),"},",
              "{",round(B.x,3),",",round(B.y,3),"},",
              "{",round(C.x,3),",",round(C.y,3),"},",
              "{",round(D.x,3),",",round(D.y,3),"},",
              "{",round(E.x,3),",",round(E.y,3),"},",
              "{",round(A.x,3),",",round(A.y,3),"}" 
             "]")

wolfram alphaで「入力が最大文字数を超えています.」

Polygon[{ -sqrt(5/8 - sqrt(5)/8) , -sqrt(5)/4 - 1/4 }, { sqrt(5/8 - sqrt(5)/8) , -sqrt(5)/4 - 1/4 }, { sqrt(sqrt(5)/8 + 5/8) , -1/4 + sqrt(5)/4 }, { 0 , 1 }, { -sqrt(sqrt(5)/8 + 5/8) , -1/4 + sqrt(5)/4 }, { -sqrt(5/8 - sqrt(5)/8) , -sqrt(5)/4 - 1/4 }]

小数3位に四捨五入しました。

Polygon[{ -0.588 , -0.809 }, { 0.588 , -0.809 }, { 0.951 , 0.309 }, { 0 , 1 }, { -0.951 , 0.309 }, { -0.588 , -0.809 }]

sympyで計算

wikipediaより、辺の長さを a とすると

from sympy import *
a=Symbol('a', real=True, positive=True)
O=Point(0,0)
A=Point(a,0)
t=(pi-(2*pi)/5)/2*2
M=Point(a/2,(a/2)*tan(t/2))
R=Point(O).distance(M).simplify()
print("#内角    ",t,t/pi*180,"")
print("#面積    ",(a*M.y/2*5).simplify())
print("#内接円の半径",M.y)
print("#外接円の半径",R)
#内角     3*pi/5 108 度
#面積     a**2*sqrt(10*sqrt(5) + 25)/4
#内接円の半径 a*sqrt(2*sqrt(5)/5 + 1)/2
#外接円の半径 a*sqrt(10*sqrt(5) + 50)/10

sympyで作図(matplotlibで)Line(A,B).equationで変換しています。

ABCDはでていません。
?作図する方法を教えて下さい。

Figure_1.png

from sympy import *
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize']=5,5
x=Symbol('x',real=True)
y=Symbol('y',real=True)
t=(2*pi)/5
A=Point(cos(pi/2+t*2),sin(pi/2+t*2))
B=Point(cos(pi/2+t*3),sin(pi/2+t*3))
C=Point(cos(pi/2+t*4),sin(pi/2+t*4))
D=Point(cos(pi/2+t*0),sin(pi/2+t*0))
E=Point(cos(pi/2+t*1),sin(pi/2+t*1))
p=       plot(solve(Line(A,B).equation(),y)[0],(x,A.x,B.x),line_color="red",show=False)
p.extend(plot(solve(Line(B,C).equation(),y)[0],(x,B.x,C.x),line_color="red",show=False))
p.extend(plot(solve(Line(C,D).equation(),y)[0],(x,C.x,D.x),line_color="red",show=False))
p.extend(plot(solve(Line(D,E).equation(),y)[0],(x,D.x,E.x),line_color="red",show=False))
p.extend(plot(solve(Line(E,A).equation(),y)[0],(x,E.x,A.x),line_color="red",show=False))
p.extend(plot(solve(Line(A,D).equation(),y)[0],(x,A.x,D.x),line_color="blue",show=False))
p.extend(plot(solve(Line(B,E).equation(),y)[0],(x,B.x,E.x),line_color="blue",show=False))
p.show()

GRAPESで作図(sympyで計算)20220819

CADでも十分な気もしてきました。

入試問題

A(1,0),B(2,0)...正五角形ABCDE...

(20220817)正五角形が39件ありました。<サイト内検索<大学入試数学問題集成

(20221110)
正十二面体
第6問(選択問題)(配点 16)< 令和7年度大学入学共通テスト
試作問題『数学Ⅱ,数学B,数学C』

54°

(20221111)

【2】(2) cos54°の値を求めなさい.

正七角形

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?