裏 RjpWiki

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

算額(その80)

2022年12月28日 | Julia

算額(その80)

福島県船引町 蚕養国神社 明治24年(1891)2月
http://www.wasan.jp/fukusima/kogaikuni.html

正三角形に内接する全円と大円,小円がある。小円の径が 3 寸のとき,全円の径はいくつか。

正三角形の一辺の長さを 1 とすると全円の半径 r0 は √3/3,大円の半径 r1 は √3/5である。小円の半径を r2,その中心座標を (x2, 2r1) として方程式を立て,x2, r2 を求める。

using SymPy
@syms x2::positive, r2::positive;
r1 = √Sym(3) / 5
r0 = √Sym(3) / 3
eq1 = x2^2 + r1^2 - (r1 + r2)^2
eq2 = x2^2 + (2r1 - r0)^2 - (r0 - r2)^2;
solve([eq1, eq2], (x2, r2))

   1-element Vector{Tuple{Sym, Sym}}:
    (sqrt(15)/10, sqrt(3)/10)

r2 = sqrt(3)/10 が 3 寸ならば,全円の径は 3*r0/(sqrt(3)/10) = 10 寸である。

3*r0/(sqrt(Sym(3))/10) |> println

   10

using Plots

function circle(ox, oy, r, color=:red; beginangle=0, endangle=360)
 θ = beginangle:0.1:endangle
 x = r.*cosd.(θ)
 y = r.*sind.(θ)
 plot!(ox .+ x, oy .+ y, color=color, linewidth=0.5)
end;

function point(x, y, string="", color=:green, position=:left, vertical=:top; fontsize=10, mark=true)
  mark && scatter!([x], [y], color=color, markerstrokewidth=0)
  annotate!(x, y, text(string, fontsize, vertical, position, color))
end;

function segment(x1, y1, x2, y2, color=:black; linestyle=:solid, linewidth=0.5)
 plot!([x1, x2], [y1, y2], color=color, linestyle=linestyle, linewidth=linewidth)
end;

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   plot([-1, 1, 0, -1], [0, 0, √3, 0], color=:black, lw=0.5)
   r0 = √3/3
   r1 = √3/5
   (x2, r2) = (sqrt(15)/10, sqrt(3)/10)
   println("r0 = $r0;  r1 = $r1;  r2 = $r2;  3*r0/r2 = $(3r0/r2)")
   circle(0, r0, r0)
   circle(0, r1, r1, :green) 
   circle(0, 3r1, r1, :green) 
   circle(x2, 2r1, r2, :blue)
   circle(-x2, 2r1, r2, :blue)
   if more
       circle(0, 4r1, r1, :gray)
       point(0, √3/3, "r0 ", :red, :right)
       point(0, r1, "r1 ", :green, :right)
       point(0, 3r1, "3r1 ", :green, :right)
       point(x2, 2r1, "(x2,2r1)", :green, :top, :center)
       hline!([0], color=:black, lw=0.5)
       vline!([0], color=:black, lw=0.5)
   end
end;

   r0 = 0.5773502691896257;  r1 = 0.34641016151377546;  r2 = 0.17320508075688773;  3*r0/r2 = 10.0

 


コメント    この記事についてブログを書く
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする
« 算額(その79) | トップ | 算額(その81) »
最新の画像もっと見る

コメントを投稿

Julia」カテゴリの最新記事