裏 RjpWiki

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

算額(その2038)

2024年08月23日 | Julia

算額(その2038)

(15) 京都府夜久野町字額田 妙竜寺 明治20年(1887)
近畿数学史学会:近畿の算額「数学の絵馬を訪ねて」,平成4年5月16日 初版第一刷,大阪教育図書株式会社,大阪市.
キーワード:円5個,外円,菱形

大円の中に菱形 1 個,小円 4 個を容れる。菱形の対角線の短いほうが 10 寸,小円の直径が 4 寸のとき,大円の直径はいかほどか。

菱形の対角線を 2a, 2b; a > b
大円の半径と中心座標を R, (0, 0)
小円の半径と中心座標を r, (r, R - b + r), (r, R - b - r)
とおき,以下の方程式を解く。

include("julia-source.txt");

using SymPy
@syms R::positive, r::positive, a::positive, b::positive
eq1 = dist2(0, R, sqrt(R^2 - (R - b)^2), R - b, r, R - b + r, r)
res = solve(eq1, R)[2] |> factor
res |> println

   (b^2 - 2*b*r + 2*r^2)^2/(2*b*(-b + 2*r)^2)

2res(b => 10/2, r => 4/2) |> println

   33.8000000000000

菱形の対角線の短いほうが 10 寸,小円の直径が 4 寸のとき,大円の直径は 33.8 寸である。

「答」は 「33.3 寸余」である。「術」が読み切れない。

function draw(b, r, more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   R = (b^2 - 2*b*r + 2*r^2)^2/(2*b*(-b + 2*r)^2)
   a = sqrt(R^2 - (R - b)^2)
   @printf("菱形の対角線の短いほうが %g,小円の直径が %g のとき,大円の直径は %g である。\n", 2b, 2r, 2R)
   @printf("a = %g;  b = %g;  r = %.15g;  R = %.15g\n", a, b, r, R)
   plot([a, 0, -a, 0, a], [R - b, R, R - b, R - 2b, R - b], color=:green, lw=0.5)
   circle(0, 0, R)
   circle2(r, R - b + r, r, :blue)
   circle2(r, R - b - 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 - b + r, " r,(r,R-b+r)", :black, :left, delta=-delta/2)
       point(r, R - b - r, " r,(r,R-b-r)", :black, :left, :bottom, delta=delta/2)
       point(0, R, " R", :red, :left, :bottom, delta=delta/2)
       point(a, R - b, " (a,R-b)", :green, :left, :vcenter)
       point(0, R - 2b, "R-2b", :green, :center, delta=-delta)
   end
end;

draw(10/2, 4/2, true)

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

算額(その2040)

2024年08月23日 | Julia

算額(その2040)

新潟県小千谷市 小千谷二荒神社 天保4年(1833)
涌田和芳,外川一仁:小千谷二荒神社の紛失算額,長岡工業高等専門学校研究紀要,第 51 巻,p.35-40,2015
https://kinpoku.nagaoka-ct.ac.jp/lib/kiyo/vol_51/51_35wakuta.pdf

弧の中に等円 3 個を容れる。弦が 4.8 寸,矢が 1.2 寸のとき,等円の直径はいかほどか。

注:問で「弦が矢の 2 倍」ということは,弧は半円である。上の図は弦が 4.8 寸,矢が 1.2 寸の場合のものである。

円弧の半径と中心座標を R, (0, 0)
等円の半径と中心座標を r, (0, R - r), (x, y + r); ただし y = R - 矢
とおき,以下の連立方程式を解く。

include("julia-source.txt");

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

   ((弦^2 + 4*矢^2)/(8*矢), 矢*(弦^2 + 4*矢^2)/(2*(弦^2 + 8*矢^2)), 弦*矢/sqrt(弦^2 + 8*矢^2), (弦 - 2*矢)*(弦 + 2*矢)/(8*矢))

res[2] |> println
2res[2](弦 => 4.8, 矢 => 1.2) |> println

   矢*(弦^2 + 4*矢^2)/(2*(弦^2 + 8*矢^2))
   1.00000000000000

等円の半径 r は「矢*(弦^2 + 4*矢^2)/(2*(弦^2 + 8*矢^2))」である。
弦が 4.8 寸,矢が 1.2 寸のとき,等円の直径は 1 寸である。

「術」は,「角 = 4矢^2; 矢/(角/(角 + 弦^2) + 1)」である。

@syms 矢, 弦
角 = 4矢^2
矢/(角/(角 + 弦^2) + 1);

角を最終式に代入し,simplify で簡約化すると,前述した式(半径)の 2 倍(直径)になる。

術 = 矢/(4矢^2/(4矢^2 + 弦^2) + 1)
術 |> simplify |> println
術(弦 => 4.8, 矢 => 1.2) |> println

   矢*(弦^2 + 4*矢^2)/(弦^2 + 8*矢^2)
   1.00000000000000

function draw(弦, 矢, more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   弦 /= 2
   (R, r, x, y) = ((弦^2 + 4*矢^2)/(8*矢), 矢*(弦^2 + 4*矢^2)/(2*(弦^2 + 8*矢^2)), 弦*矢/sqrt(弦^2 + 8*矢^2), (弦 - 2*矢)*(弦 + 2*矢)/(8*矢))
   @printf("弦,矢が %g, %g のとき,等円の直径は %g である。\n", 弦, 矢, 2r)
   @printf("R = %g;  r = %g;  x = %g;  y = %g\n", R, r, x, y)
   plot()
   circle(0, 0, R)
   circle(0, R - r, r, :blue)
   circle2(x, y + r, r, :blue)
   y0 = R - 矢
   x0 = sqrt(R^2 - y0^2)
   segment(-x0, y0, x0, y0, :green)
   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, :left, :bottom, delta=delta/2)
       point(0, y, " y", :blue, :left, :bottom, delta=delta/2)
       point(0, R - r, "等円:r,(0,R-r)", :blue, :center, delta=-delta/2)
       point(x, y + r, "等円:r,(x,y+r)", :blue, :center, delta=-delta/2)
   end
end;

draw(4.8, 1.2, true)

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

算額(その2039)

2024年08月23日 | Julia

算額(その2039)

長野県飯山市木島 鳥出神社 天保14年(1843)
http://www.wasan.jp/nagano/toride1.html

大円の中に,中円,小円を容れる。大円,中円の直径がそれぞれ 180 寸,168 寸のとき,小円の直径はいかほどか。

図形としては,算額(その834)算額(その320)と同類であるが,条件の与え方次第で複雑ににも簡単にもなるという例である。

大円の半径と中心座標を R, (0, 0)
中円の半径と中心座標を r1, (0, R - r1)
小円の半径と中心座標を r2, (r2, y2)
とおき,以下の連立方程式を解く。

include("julia-source.txt");

using SymPy
@syms R::positive, r1::positive, r2::positive, y2::negative
eq1 = r2^2 + y2^2 - (R - r2)^2
eq2 = r2^2 + (R - r1 - y2)^2 - (r1 + r2)^2
res = solve([eq1, eq2], (r2, y2))[1];
res[1] |> simplify |> println
res[2] |> simplify |> println

   4*R*r1*(R - r1)/(R + r1)^2
   R*(R - 3*r1)/(R + r1)

大円,中円の直径がそれぞれ 280 寸,168 寸のとき,小円の直径は 105 寸である。

R = 280/2
r1 = 168/2
2(4*R*r1*(R - r1)/(R + r1)^2)

   105.0

その他のパラメータは以下のとおりである。

   R = 140;  r1 = 84;  r2 = 52.5;  y2 = -70

function draw(R, r1, more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r2 = 4R*r1*(R - r1)/(R + r1)^2
   y2 = R*(R - 3r1)/(R + r1)
   @printf("大円,中円の直径が %g, %g のとき,小円の直径は %g である。\n", 2R, 2r1, 2r2)
   @printf("R = %g;  r1 = %g;  r2 = %.15g;  y2 = %.15g\n", R, r1, r2, y2)
   plot()
   circle(0, 0, R)
   circle(0, R - r1, r1, :blue)
   circle2(r2, y2, r2, :magenta)
   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, :left, :bottom, delta=delta/2)
       point(0, R - r1, "中円:r1,(0,R-r1)", :blue, :center, delta=-delta/2)
       point(r2, y2, "小円:r2,(r2,y2)", :magenta, :center, delta=-delta/2)
   end
end;

draw(280/2, 168/2, true)

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

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

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