裏 RjpWiki

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

算額(その2025)

2024年08月17日 | Julia

算額(その2025)

(5) 大阪府池田市畑 畑天満宮 嘉永5年(1852)晩夏
近畿数学史学会:近畿の算額「数学の絵馬を訪ねて」,平成4年5月16日 初版第一刷,大阪教育図書株式会社,大阪市.
キーワード:円10個,外円

外円の中に,大円 2 個,中円 3 個,小円 4 個を容れる。大円の直径が 10 寸のとき,小円の直径はいかほどか。

算額(その1061)に似ている。
https://blog.goo.ne.jp/r-de-r/e/20142cf095d9f0e8c6a1c4c3ab627b1e

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

include("julia-source.txt");

using SymPy

@syms R::positive, r1::positive, r2::positive,
     r3::positive, x3::positive, y3::positive
R = 2r1 - r2
eq1 = x3^2 + y3^2 - (R - r3)^2
eq2 = (R - r2)^2 + (R - r1)^2 - (r1 + r2)^2
eq3 = x3^2 + (R - r1 - y3)^2 - (r1 + r3)^2
eq4 = (x3 - R + r2)^2 + y3^2 - (r2 + r3)^2
res = solve([eq1, eq2, eq3, eq4], (r2, r3, x3, y3))[1]

   (r1*(3 - sqrt(5))/2, r1*(-2 + sqrt(5)), r1*(-1 + sqrt(5)), r1*(-1/2 + sqrt(5)/2))

小円の半径 r3 は,大円の半径の (√5 - 2) 倍である。
大円の直径が 10 寸のとき,小円の直径は 10(√5 - 2) = 2.360679774997898 寸である。

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

  R = 8.09017; r1 = 5;  r2 = 1.90983;  r3 = 1.18034;  x3 = 6.18034;  y3 = 3.09017

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

draw(10/2, true)

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

算額(その2024)

2024年08月17日 | Julia

算額(その2024)

(3) 大阪府茨木市大字総持寺 総持寺 弘化3年(1846)
近畿数学史学会:近畿の算額「数学の絵馬を訪ねて」,平成4年5月16日 初版第一刷,大阪教育図書株式会社,大阪市.
キーワード:円5個,二等辺三角形

二等辺三角形の中に,子,丑,寅,卯,辰の 5 個の円を容れる。子円と,寅円の直径が与えられたとき,丑円,卯円,辰円の直径はいかほどか。

二等辺三角形の底辺の長さと高さを 2a, h
子,丑,寅,卯,辰円の半径を r1, r2, r3, r4, r5
とおき,以下の方程式を解く。

include("julia-source.txt");

using SymPy

@syms a::positive, h::positive, r1::positive, r2::positive,
     r3::positive, r4::positive, r5::positive, sinθ::positive
@syms a, h, r1, r2, r3, r4, r5, sinθ
sinθ = r1/(h - r1)
eq1 = a/sqrt(a^2 + h^2) - sinθ
eq2 = r2/(h - 2r1 - r2) - sinθ
eq3 = r3/(h - 2r1 - 2r2 - r3) - sinθ
eq4 = r4/(h - 2r1 - 2r2 - 2r3 - r4) - sinθ
eq5 = r5/(h - 2r1 - 2r2 - 2r3 - 2r4 - r5) - sinθ;
res = solve([eq1, eq2, eq3, eq4, eq5], (r2, r4, r5, a, h))[3]  # 3 of 4

   (r1*sqrt(r3^3/r1)/r3, sqrt(r3^3/r1), r3^2/r1, r1*sqrt((r1*r3 + 2*r1*sqrt(r3^3/r1) + r3^2)/(r1*sqrt(r3^3/r1) + 2*r3^2 + r3*sqrt(r3^3/r1))), 2*r1^2*(r3 + sqrt(r3^3/r1))/(r3*(r1 - r3)))

r1,r2,r3,r4,r5 は等比数列をなす。
r1 > r2 > r3 > r4 > r5 で,r1, r3 が与えられるとき,公比は sqrt(r3/r1) である。

r1 = 16, r3 = 4 のとき,公比は sqrt(4/16) = 1/2 で,r1 = 16 が初項の場合,16, 8, 4, 2, 1 となる。

function draw(r1, r3, more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (r2, r4, r5, a, h) = (r1*sqrt(r3^3/r1)/r3, sqrt(r3^3/r1), r3^2/r1, r1*sqrt((r1*r3 + 2*r1*sqrt(r3^3/r1) + r3^2)/(r1*sqrt(r3^3/r1) + 2*r3^2 + r3*sqrt(r3^3/r1))), 2*r1^2*(r3 + sqrt(r3^3/r1))/(r3*(r1 - r3)))
   @printf("r1 = %g;  r2 = %g;  r3 = %g;  r4 = %g;  r5 = %g;  a = %g; h = %g\n", r1, r2, r3, r4, r5, a, h)
   plot([a, 0, -a, a], [0, h, 0, 0], color=:black, lw=0.5)
   #plot()
   circle(0, r1, r1)
   circle(0, 2r1 + r2, r2, :blue)
   circle(0, 2r1 + 2r2 + r3, r3, :green)
   circle(0, 2r1 + 2r2 + 2r3 + r4, r4, :orange)
   circle(0, 2r1 + 2r2 + 2r3 + 2r4 + r5, r5, :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, r1, " 子:r1,(0,r1)", :red, :left, :vcenter)
       point(0, 2r1 + r2, " 丑:r2,(0,2r1+r2)", :blue, :left, :vcenter)
       point(0, 2r1 + 2r2 + r3, " 寅:r3,(0,2r1+2r2+r3)", :green, :left, :vcenter)
       point(0, 2r1 + 2r2 + 2r3 + r4, " 卯:r4,(0,2r1+2r2+2r3+r4)", :orange, :left, :vcenter)
       point(0, 2r1 + 2r2 + 2r3 + 2r4 + r5, " 辰:r5,(0,2r1+2r2+2r3+2r4+r5)", :magenta, :left, :vcenter)
   end
end;

draw(16, 4, true)

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

算額(その2023)

2024年08月17日 | Julia

算額(その2023)

(3) 大阪府茨木市大字総持寺 総持寺 弘化3年(1846)
近畿数学史学会:近畿の算額「数学の絵馬を訪ねて」,平成4年5月16日 初版第一刷,大阪教育図書株式会社,大阪市.
キーワード:円2個,長方形,斜線2本

長方形の中に2本の斜線と甲円,乙円を容れる。長方形の長辺と短辺が 120 寸,70 寸のとき,乙円の直径を求めよ。

長方形の長辺,短辺を a, 2b
甲円の半径と中心座標を r1, (a - r1, 0); r1 = b
乙円の半径と中心座標を r2, (a - r2 - 2r1, 0)
とおき,以下の方程式を解く。

include("julia-source.txt");

using SymPy

@syms a::positive, b::positive, r1::positive, r2::positive
r1 = b
eq1 = r2/(a - r2 - 2r1) ⩵ b/sqrt(a^2 + b^2)
res = solve(eq1, r2)[1]
res |>  println
res(a => 120, b => 70/2) |> println

   b*(a - 2*b)/(b + sqrt(a^2 + b^2))
   10.9375000000000

長方形の長辺と短辺が 120 寸,70 寸のとき,乙円の直径は 10.9375 寸である。

function draw(a, b, more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r1 = b
   r2 = b*(a - 2*b)/(b + sqrt(a^2 + b^2))
   plot([a, a, 0, 0, a], [-b, b, b, -b, -b], color=:green, lw=0.5)
   plot!([a, 0, a], [b, 0, -b], color=:magenta, lw=0.5)
   circle(a - r1, 0, r1)
   circle(a - r2 - 2r1, 0, r2, :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(a - r1, 0, "甲円:r1\n(a-r1,0)", :red, :center, :bottom, delta=delta)
       point(a - r2 - 2r1, 0, "乙円:r2\n(a-r2-2r1,0)", :blue, :center, :bottom, delta=delta)
       point(a, b, "(a,b)", :green, :right, :bottom, delta=delta)
   end
end;

draw(120, 70/2, true)

 

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

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

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