裏 RjpWiki

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

算額(その861)

2024年04月17日 | Julia

算額(その861)

二十四 岩手県一関市萩荘字八幡 達古袋八幡神社 弘化3年

山村善夫:現存 岩手の算額,昭和52年1月30日,熊谷印刷,盛岡市. http://www.wasan.jp/yamamura/yamamura.html

大円の一部である円弧内に正三角形2個と小円が入っている。正三角形の一辺の長さと小円の直径がわかっているときに大円の直径を求める術は如何に。

問では,「正三角形の一辺の長さと小円の直径がわかっているときに」とあるが,一般的にこの2つを任意に指定すると,図形を構成することは不可能である。正三角形の一辺の長さ,小円の直径,大円の直径の 3 変数のうち,1 つだけを指定して残りの 2 つのパラメータを決定するというのが妥当であろう。

よって,以下のように定めて連立方程式を解く。
大円の半径と中心座標を R, (0, 0)
小円の半径と中心座標を r, (0, R -r)
正三角形の一辺の長さを a とする。

eq1 は小円の中心と正三角形の一辺までの距離が小円の半径に等しいこと,
eq2 は正三角形の頂点が大円の円周上にあることを意味している。

include("julia-source.txt");

using SymPy
@syms R::positive, r::positive, a::positive, x::positive
x = sqrt(R^2 - (R - 2r)^2)
eq1 = dist(x - a, R - 2r, x - a/2, R - 2r + a√Sym(3)/2, 0, R - r) - r^2
eq2 = (x - a/2)^2 + (R - 2r + a√Sym(3)/2)^2 - R^2
res = solve([eq1, eq2], (R, a));

2 組の解が得られるが,2 番目のものが適解である。

大円の半径は,小円の半径の 7/3,正三角形の一辺の長さは小円の半径の √3 倍である。

「術」は不適切である。

res[2]

   (7*r/3, sqrt(3)*r)

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r = 1//2
   (R, a) = (7*r/3, sqrt(3)*r)
   x = sqrt(R^2 - (R - 2r)^2)
   plot()
   circle(0, 0, R, :green)
   circle(0, R - r, r)
   plot!([x - a, x - a/2, x], R - 2r .+ [0, √3a/2, 0], color=:blue, lw=0.5)
   plot!(-[x - a, x - a/2, x], R - 2r .+ [0, √3a/2, 0], color=:blue, lw=0.5)
   segment(-x, R - 2r, x, R - 2r, :black)
   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, 0, " R", :green, :left, :bottom, delta=delta/2)
       point(0, R, " R", :green, :left, :bottom, delta=delta/2)
       point(0, R - 2r, "R-2r", :black, :center, delta=-delta/2)
       point(0, R - r, " R-r", :red, :left, :vcenter)
       point(sqrt(R^2 - (R - 2r)^2), R - 2r, "(√(R^2-(R-2r)^2),R-2r)", :black, :right, delta=-delta/2)
   end
end;

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

算額(その860)

2024年04月17日 | Julia

算額(その860)

二十四 岩手県一関市萩荘字八幡 達古袋八幡神社 弘化3年

山村善夫:現存 岩手の算額,昭和52年1月30日,熊谷印刷,盛岡市. http://www.wasan.jp/yamamura/yamamura.html

水平線の上に菱形と小円 3 個を内接する大円とそれ左側にあり大円と外接する小円がある。小円の直径が 1 寸のとき,左側の小円と大円と直線に挟まれる面積(黒積)を求めよ。

大円とそれに内接する小円 3 個,菱形 1 個は,算額(その851)にあるとおりで,小円の直径を r とすると,大円の直径は 3r である。

include("julia-source.txt");

using SymPy
@syms R::positive, r::positive, x::positive, y::positive,
   x2::negative
y = r
eq1 = x^2 + y^2 - (R - r)^2
eq2 = x^2 + (R - r - y)^2 - 4r^2
eq3 = x2^2 + (r - R)^2 - (R + r)^2 
res = solve([eq1, eq2, eq3], (R, x, x2))[1]

   (3*r, sqrt(3)*r, -2*sqrt(3)*r)

小円,大円と直線により区分される面積は,台形の面積から小円の面積の 1/3 と大円の面積の 1/6 を引いたものである。
S = 2√3*r - 11π*r^2/6

@syms r, R
R = 3r
s3 = √Sym(3)
S = (r + R)*s3(R - r)/2 - PI*r^2/3 - PI*R^2/6
S |> println

   -11*pi*r^2/6 + 2*sqrt(3)*r

r = 1/2 のとき,S = 0.2921541746735554 である。

S(r => 1/2) |> N

   0.2921541746735554

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r = 1/2
   (R, x, x2) = r .* (3, √3, -2√3)
   y = r
   b = R - r
   y0 = -r
   x0 = sqrt(R^2 - y0^2)
   plot([x2, 0, 0, x2, x2], [-R, -R, 0, r - R, -R], seriestype=:shape, fillcolor=:gray30)
   circlef(0, 0, R, :orange)
   circlef(0, R - r, r, :cyan)
   circlef(x, y, r, :cyan)
   circlef(-x, y, r, :cyan)
   plot!([x0, 0, -x0, 0, x0], [-r, R - 2r, -r, -R, b - R], color=:red, seriestype=:shape, lw=0.5, alpha=0.5)
   circlef(x2, r - R, r, :cyan)
   segment(x2, -R, 0, -R, :cyan)
   plot!([x2, 0, 0, x2, x2], [-R, -R, 0, r - R, -R], color=:black, lw=1)
   circle(0, 0, 0.2, :black, beginangle=210, endangle=270)
   circle(x2, r - R, 0.2, :black, beginangle=270, endangle=390)
   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(0, R, " R", :red, :center, :bottom, delta=delta/2)
       point(R, 0, " R", :red, :left, :vcenter)
       point(0, R - r, "小円:r,(0,R-r)", :green, :center, delta=-delta/2)
       point(x, r, "小円:r,(x,r)", :green, :center, delta=-delta/2)
       point(x2, r - R, "小円:r \n(x2,r-R) ", :green, :right, :vcenter)
       point(0, -r, " -r", :white, :left, :vcenter)
       point(2√2r, -r, "(2√2r,-r)  ", :white, :right, :vcenter)
       point(0, -0.25, "60°", :black, :right, mark=false)
       point(x2 + 0.2, r - R, "120°", :black, :left, mark=false)
   end
end;

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

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

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