裏 RjpWiki

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

算額(その593)

2023年12月26日 | Julia

算額(その593)

長崎市 鎮西大社諏訪神社 明治20年(1887)
米光丁: 長崎県の和算の概説

http://hyonemitsu.web.fc2.com/Nagasakiwasan.pdf

問題 12. 外円の中に正三角形と大円,小円を入れる。外円の直径が 50 寸のとき小円の直径はいかほどか。

外円の半径と中心座標を R, (0, 0)
小円の半径と中心座標を r, (0, R - R/2 - r)
必要はないが,大円の半径と中心座標は R/2, (0, 0)
とおき,以下の方程式を解く。

include("julia-source.txt");

using SymPy

@syms R, r
eq1 = r/(R - R/2 - r) - 1//2
res = solve(eq1, r)[1]
res |> println

   R/6

小円の半径は外円の半径の 1/6 である。
外円の直径が 50 寸のとき,小円の直径は 50/6 ≒ 8.33333 である。

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   R = 50/2
   r = R/6
   @printf("小円の直径 = %g;  R = %g;  r = %g\n", 2r, R, r)
   plot([R*cosd(30), 0, -R*cosd(30), R*cosd(30)], [-R*sind(30), R, -R*sind(30), -R*sind(30)], color=:gray, lw=0.5)
   circle(0, 0, R, :blue)
   circle(0, 0, R/2, :orange)
   circle(0, R/2 + r, r)
   if more
       delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3  # size[2] * fontsize * 2
       hline!([0], color=:black, lw=0.5)
       vline!([0], color=:black, lw=0.5)
       point(0, R/2 + r, " 小円:r,(0,R/2+r)", :black, :left, :vcenter)
       point(0, R/2, " R/2+r", :black, :left, delta=-delta)
       point(0, R, " R", :blue, :left, :bottom, delta=delta/2)
   end
end;

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

算額(その592)

2023年12月26日 | Julia

算額(その592)

長崎市 鎮西大社諏訪神社 明治20年(1887)
米光丁: 長崎県の和算の概説

http://hyonemitsu.web.fc2.com/Nagasakiwasan.pdf

問題 11. 外円の中に甲円,乙円,丙円画は一致得る。甲円の直径が 14 寸のとき,乙円の直径はいかほどか。

下部にある甲円,乙円と丙円を対象にすれば,方程式を立てるまでもなく解を求めることができる。

外円の半径と中心座標を R, (0, 0)
甲円の半径と中心座標を r1, (0, r1 - R)
乙円の半径と中心座標を r2, (0, r2 - R)
丙円の半径と中心座標を r3, (0, 0)
として以下の連立方程式を解く。

include("julia-source.txt");

using SymPy

@syms R, r1, r2, r3
eq1 = r1 - (2R - r1)/2
eq2 = r2 - R/4
eq3 = r3 - (2r1 - R)
res = solve([eq1, eq2, eq3], (R, r2, r3))


   Dict{Any, Any} with 3 entries:
     r3 => r1/2
     R  => 3*r1/2
     r2 => 3*r1/8

乙円の半径は,甲円の半径の 3/8 倍である。
甲円の直径が 14 寸のとき,乙円の直径は 14*(3/8) = 5.25 寸である。
算額の答えでは 10.01 寸になっているが,間違いであろう。

r1 = 14/2
(3*r1/8, 3*r1/2, r1/2)

   (2.625, 10.5, 3.5)

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r1 = 14/2
   (r2, R, r3) = (3*r1/8, 3*r1/2, r1/2)
   @printf("乙円の直径 = %g;  R = %g;  r1 = %g;  r2 = %g;  r3 = %g\n", 2r2, R, r1, r2, r3)
   plot([R*cosd(30), 0, -R*cosd(30), R*cosd(30)], [-R*sind(30), R, -R*sind(30), -R*sind(30)], color=:gray, lw=0.5)
   circle(0, 0, R, :blue)
   circle(0, 0, r3, :orange)
   rotate((R - r1)*cosd(30), (R - r1)*sind(30), r1, :green)
   rotate((R - r2)*cosd(30), (R - r2)*sind(30), r2)
   if more
       delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3  # size[2] * fontsize * 2
       hline!([0], color=:black, lw=0.5)
       vline!([0], color=:black, lw=0.5)
       point(0, r1 - R, " r1-R", :green, :left, :bottom, delta=1.5delta)
       point(0, r2 - R, " r2-R", :red)
       point(0, r3, " r3", :orange, :left, :bottom, delta=delta)
       point(0, 2r1-R, "2r1-R ", :green, :right, :bottom, delta=delta)
   end
end;

 

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

算額(その591)

2023年12月26日 | Julia

算額(その591)

長崎市 鎮西大社諏訪神社 明治20年(1887)
米光丁: 長崎県の和算の概説

http://hyonemitsu.web.fc2.com/Nagasakiwasan.pdf

問題 9. 外円の中に正三角形と菱形を入れる。外円の直径が 60 寸のとき,菱形の一辺の長さはいかほどか。

左右にあるのは大きな正三角形と相似比が 2:1 の正三角形であるから,その一辺の長さが菱形の一辺の長さである。
外円の半径を R とすると,菱形の一辺の長さは √3R/2 である。
外円の直径が 60 寸のとき,菱形の一辺の長さは 25.980762113533157 寸である。

R = 60//2
√3R/2

   25.980762113533157

include("julia-source.txt");

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   R = 60//2
   l = √3R/2
   @printf("菱形の一辺の長さ = %g;  R = %g\n", l, R)
   (Rsin, Rcos) = R .* (sind(30), cosd(30))
   plot([0, Rcos/2, 0, -Rcos/2, 0], [-Rsin, Rsin/2, R, Rsin/2, -Rsin], color=:red, lw=1)
   plot!([-Rcos/2, -Rcos, Rcos, Rcos/2], [Rsin/2, -Rsin, -Rsin, Rsin/2], color=:red, lw=0.5)
   circle(0, 0, R, :blue)
   if more
       delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3  # size[2] * fontsize * 2
       hline!([0], color=:black, lw=0.5)
       vline!([0], color=:black, lw=0.5)
   end
end;

 

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

算額(その590)

2023年12月26日 | Julia

算額(その590)

長崎市 鎮西大社諏訪神社 明治20年(1887)
米光丁: 長崎県の和算の概説

http://hyonemitsu.web.fc2.com/Nagasakiwasan.pdf

問題 7. 外円の中に菱形と正方形を入れる。長矢と短矢の長さが 18 寸,8 寸のとき,外円の直径はいかほどか。

外円の半径と中心座標を R, (0, 0)
正方形の一辺の長さを 2a とする。
菱形の長径と短径を 2x, 2y とする。
長矢,短矢の長さは x - a, y - a である。

以下の連立方程式を解く。

include("julia-source.txt");

using SymPy

@syms R::positive, a::positive, 長矢::positive, 短矢::positive
eq1 = a + 長矢 - R
eq2 = 短矢/a - (a + 短矢)/R
solve([eq1, eq2], (R, a))

   1-element Vector{Tuple{Sym, Sym}}:
    (sqrt(短矢)*sqrt(長矢) + 長矢, sqrt(短矢)*sqrt(長矢))

外円の半径は「短矢と長矢の積の平方根に長矢を加える」ことで得られる。
長矢と短矢の長さが 18 寸,8 寸のとき,外円の半径は 30 寸,直径は 60 寸である。

(長矢, 短矢) = (18, 8)
sqrt(長矢*短矢) + 長矢

   30.0

ちなみに正方形の一辺の長さは「短矢と長矢の積の平方根」= sqrt(長矢*短矢) = sqrt(18*8) = 12 寸である。

using Plots

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (長矢, 短矢) = (18, 8)
   (R, a) = (sqrt(短矢)*sqrt(長矢) + 長矢, sqrt(短矢)*sqrt(長矢))
   @printf("外円の直径 = %g;  R = %g;  a = %g\n", 2R, R, a)
   plot([0, 30, 0, -30, 0], [-20, 0, 20, 0, -20], color=:green, lw=0.5)
   plot!([12, 12, -12, -12, 12], [-12, 12, 12, -12, -12], color=:red, lw=0.5)
   circle(0, 0, R, :blue)
   segment(0, a, 0, a + 短矢, lw=3)
   segment(a, 0, a + 長矢, 0, lw=3)
   if more
       delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3  # size[2] * fontsize * 2
       hline!([0], color=:black, lw=0.5)
       vline!([0], color=:black, lw=0.5)
       point(R, 0, " R", :blue, :left, delta=-delta/2)
       point(R, 0, " x", :green, :left, :bottom, delta=delta/2)
       point(a, 0, "a ", :red, :right, delta=-delta/2)
       point(0, a, " a", :red, :left, :top, delta=-delta/2)
       point(0, a + 短矢, " y", :green, :left, :bottom, delta=delta/2)
       point(0, a + 短矢/2, " 短矢", :black, :left, :vcenter)
       point(a + 長矢/2, 0, " 長矢", :black, :center, :bottom, delta=delta/2)
   end
end;

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

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

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