裏 RjpWiki

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

算額(その1198)

2024年08月09日 | Julia

算額(その1198

(9) 滋賀県マキノ町海津 天神社 明治8年(1875)
近畿数学史学会:近畿の算額「数学の絵馬を訪ねて」,平成4年5月16日 初版第一刷,大阪教育図書株式会社,大阪市.
キーワード:円3個,直角三角形,長方形

長方形の中に直角三角形と天円,地円,人円を 1 個ずつ容れる。長方形の長辺,短辺が 40 寸と 25 寸,股が 41 寸のとき,鈎はいかほどか。

長方形の長辺,短辺を a, b
長方形の辺上にある直角三角形の頂点の座標を (0, c), (d, b)
直角三角形の直角を挟む二辺を鈎,股
とおき以下の連立方程式を解く。
なお,a, b, 股 を変数のまま解こうとすると,不適切解しか求まらない。

include("julia-source.txt");

using SymPy
@syms a::positiveb, b::positive, c::positive,
     d::positive, 鈎::positive, 股::positive
a = 40
b = 25
股 = 41
eq1 = a^2 + c^2 - 股^2
eq2 = (b - c)^2 + d^2 - 鈎^2
eq3 = (a*c + b*(a - d) + (b - c)*d + 股*鈎)/2 - a*b
(鈎, c, d) = solve([eq1, eq2, eq3], (鈎, c, d))[1];
(鈎, c, d) |> println

   (82/5, 9, 18/5)

鈎は 82/5 = 16.4 寸である。
ちなみに,c = 9;  d = 3.6 である。

ここまででは,3 個の円は飾りに過ぎないので,図を描くためにも半径を求めよう。

@syms r1, r2, r3
弦 = sqrt(股^2 + 鈎^2)
r1 = (b + (a - d) - 弦)/2
r2 = (a + c - 股)/2
r3 = (d + (b - c) - 鈎)/2
(r1, r2, r3) |> println

   (307/10 - 41*sqrt(29)/10, 4, 8/5)

半径はそれぞれ,8.620824290748534, 4, 1.6 である。

function draw(a, b, 股, more)
    pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (鈎, c, d) = (82/5, 9, 18/5)
   (r1, r2, r3) = (307/10 - 41*sqrt(29)/10, 4, 8/5)
   @printf("a = %g;  b = %g;  股 = %g;  鈎 = %g;  c = %g;  d = %g;  r1 = %g;  r2 = %g;  r3 = %g\n", a, b, 股, 鈎, c, d, r1, r2, r3)
   plot([0, a, a, 0, 0], [0, 0, b, b, 0], color=:green, lw=0.5)
   plot!([0, a, d, 0], [c, 0, b, c], color=:blue, lw=0.5)
   circle(a - r1, b - r1, r1)
   circle(r2, r2, r2, :blue)
   circle(r3, b - r3, r3, :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(a, 0, "a", :red, :center, delta=-delta)
       point(0, b, "b ", :red, :right, :vcenter)
       point(0, c, "c ", :red, :right, :vcenter)
       point(d, b, " (d,b)", :red, :center, :bottom, delta=delta)
       point(a - r1, b - r1, "天円:r1,(a-r1,b-r1)", :red, :center, delta=-delta)
       point(r2, r2, "地円:r2\n(r2,r2)", :blue, :center, delta=-delta)
       point(r3, b - r3, " 人円:r3,(r3,b-r3)", :magenta, :left, :vcenter)
       plot!(xlims=(-8delta, a + 5delta), ylims=(-8delta, b + 5delta))
   end
end;

draw(40, 25, 41, true)

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

算額(その1197)

2024年08月09日 | Julia

算額(その1197)

(10) 滋賀県マキノ町海津 天神社 明治8年(1875)
近畿数学史学会:近畿の算額「数学の絵馬を訪ねて」,平成4年5月16日 初版第一刷,大阪教育図書株式会社,大阪市.

外円の中に長方形と,対角線,等円 6 個を容れる。等円の直径が 1 寸のとき,外円の直径はいかほどか。

外円の半径と中心座標を R, (0, 0)
等円の半径と中心座標を r, (0, R - r), (x - r, r)
長方形の頂点の座標を (sqrt(R^2 - (R - 2r)^2), R - 2r); x = sqrt(R^2 - (R - 2r)^2), y =R - 2r
とおき,以下の方程式を解く。

include("julia-source.txt");

using SymPy
@syms R::positiveb, r::positive,
     x::positive, y::positive
y = R - 2r
x = sqrt(R^2 - y^2)
eq = dist2(0, 0, x, y, x - r, r, r);
res = solve(eq, R)[3]  # 3 of 5
res |> println

   5*r

外円の直径は,等円の直径の 5 倍である。

function draw(r, more)
    pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   R = 5r
   y = R - 2r
   x = sqrt(R^2 - y^2)
   @printf("等円の直径が %g のとき,外円の直径は %g である。\n", 2r, 2R)
   plot([x, x, -x, -x, x], [-y, y, y, -y, -y], color=:green, lw=0.5)
   circle(0, 0, R, :blue)
   circle22(0, R - r, r)
   circle4(x - r, r, r)
   segment(x, y, -x, -y, :orange)
   segment(-x, y, x, -y, :orange)
   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", :red, :left, :bottom, delta=delta)
       point(0, R, " R", :red, :left, :bottom, delta=delta)
       point(0, R - r, "等円:r\n(0,R-r)", :red, :center, delta=-delta/2)
       point(x - r, r, "等円:r\n(x-r,r)", :red, :center, delta=-delta/2)
       point(x, y, " (x,y)", :green, :left, :vcenter)
   end
end;

draw(1/2, true)

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

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

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