裏 RjpWiki

Julia ときどき R, Python によるコンピュータプログラム,コンピュータ・サイエンス,統計学

算額(その2034)

2024年08月21日 | Julia

算額(その2034)

(17) 兵庫県姫路市飾磨区英賀宮町 英賀神社 明治12年(1879)
近畿数学史学会:近畿の算額「数学の絵馬を訪ねて」,平成4年5月16日 初版第一刷,大阪教育図書株式会社,大阪市.
キーワード:円7個,外円,正三角形2個

大円の中に小円6個,正三角形2個を容れる。大円の直径が 10 寸のとき,大きな正三角形の一辺の長さはいかほどか。


大きな正三角形は大円に内接するので,その一辺の長さは「大円の直径の √3/2 倍」である。
大円の直径が 10 寸のとき,内接する正三角形の一辺の長さは 10√3/2 = 8.660254037844386 寸である。

それだけなら,「小円6個と小さい正三角形」はお飾りに過ぎない。それではもったいないので,小円の直径を求めよう。

大円の半径と中心座標を R, (0, 0)
小円の半径と中心座標を r, (r, R/2 + r)
とおき,以下の方程式を解く。

include("julia-source.txt");

using SymPy
@syms R::positive, r::positive
eq1 = r^2 + (R/2 + r)^2 ⩵ (R - r)^2
res = solve(eq1, r)[1]
res |> println

   R*(-3 + 2*sqrt(3))/2

小円の半径 r は,大円の半径 R の (√3 - 3/2) 倍である。
大円の直径が 10 寸のとき,小円の直径は 10(√3 - 3/2) = 2.320508075688772 寸である。

function draw(R, more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r = (√3 - 3/2)R
   @printf("大円の直径が %g のとき,内接する正三角形の一辺の長さは %g, 小円の直径は %g である。\n", 2R, √3R, 2r)
   plot(R.*[0, cosd(30), -cosd(30), 0], R.*[-1, sind(30), sind(30), -1], color=:green, lw=0.5)
   plot!(R.*[0, -cosd(30)/2, cosd(30)/2, 0], R.*[1/2, -sind(30)/2, -sind(30)/2, 1/2], color=:magenta, lw=0.5)
   circle(0, 0, R)
   rotate(r, R/2 + r, r, :blue)
   rotate(-r, R/2 + r, r, :blue)
   if more
       delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3  # size[2] * fontsize * 2
       hline!([0], color=:gray80, lw=0.5)
       vline!([0], color=:gray80, lw=0.5)
       point(r, R/2 + r, "小円:r\n(r,R/2+r)", :blue, :center, delta=-delta/2)
       point(0, R, " R", :red, :center, :bottom, delta=delta/2)
       point(0, R/2, " R/2", :red, :center, :bottom, delta=delta/2)
       point(cos(pi/6)R, sin(pi/6)R, "(cos(pi/6)R,sin(pi/6)R) ", :green, :right, delta=-delta/2)
       point(cos(pi/6)R/2, -sin(pi/6)R/2, "(cos(pi/6)R/2,-sin(pi/6)R/2)", :magenta, :right, :bottom, delta=delta/2)
   end
end;

draw(10/2, true)

コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする

算額(その2033)

2024年08月21日 | Julia

算額(その2033)

(17) 兵庫県姫路市飾磨区英賀宮町 英賀神社 明治12年(1879)
近畿数学史学会:近畿の算額「数学の絵馬を訪ねて」,平成4年5月16日 初版第一刷,大阪教育図書株式会社,大阪市.
キーワード:正三角形,正方形

正三角形の中に正方形を容れる。正三角形の一辺の長さが 10 寸のとき,正方形の一辺の長さはいかほどか。

正三角形の一辺の長さを 2a,正方形の一辺の長さを 2b とおき,以下の方程式を解く。

include("julia-source.txt");

using SymPy
@syms a::positive, b::positive
eq1 = 2b/(a - b) ⩵ √Sym(3)
res = solve(eq1, b)[1] |> simplify
res |> println

   a*(-3 + 2*sqrt(3))

正方形の一辺の長さは,正三角形の一辺の長さの (2√3 - 3) 倍である。

2res(a => 10/2).evalf() |> println

   4.64101615137755

正方形の一辺の長さが 10 寸のとき,正三角形の一辺の長さは 10(2√3 - 3) = 4.641016151377544 寸である。 

function draw(a, more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   b = (2√3 - 3)a
   plot([a, 0, -a, a], [0, √3a, 0, 0], color=:blue, lw=0.5)
   plot!([b, b, -b, -b, b], [0, 2b, 2b, 0, 0], color=:red, lw=0.5)
   if more
       delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3  # size[2] * fontsize * 2
       hline!([0], color=:gray80, lw=0.5)
       vline!([0], color=:gray80, lw=0.5)
       point(a, 0, " a", :blue, :left, :bottom, delta=delta/2)
       point(b, 0, " b", :red, :left, :bottom, delta=delta/2)
       point(b, 2b, "(b,2b)", :red, :left, :bottom, delta=delta/2)
       point(0, √3a, "√3a", :blue, :left, :bottom, delta=delta/2)
   end
end;

draw(10/2, true)

 

コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする

PVアクセスランキング にほんブログ村

PVアクセスランキング にほんブログ村