裏 RjpWiki

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

算額(その623)

2024年01月09日 | Julia

算額(その623)

和算図形問題あれこれ
https://gunmawasan.web.fc2.com/kongetu-no-mondai.html

正方形内に斜線を引き,5 個の等円を並べる。等円の直径が 1 寸のとき,正方形の辺の長さ,斜線の長さはいかほどか。

正方形の辺の長さを a, 斜線と正方形の辺の交点座標を (b, 0), (0, c) とおく。
等円の半径と中心座標を r, (r, a - r), (x1, y1), (x2, y2), (a - 3r, r), (a - r, r)
とおき,以下の連立方程式を解く。

なお,中心座標が (r, a - r), (a - 3r, r) の 2 個の等円の中心間の距離についての方程式 (a - 4r)^2 + (a - 2r)^2 = 36r^2 を解けば等円の半径が r のとき,正方形の辺の長さは a = r*(3 + sqrt(17)) であることは容易にわかる。つまり,r = 1/2  なら a = 3.5615528128088303 である。
ただし,このようにして a を求めても b, c は簡単には求まらないし,図を描くときのために (x1, y1), (x2, y2) も求めるとすれば,以下の 7 元連立方程式を解くほうが簡単である。

r = 1/2
r*(3 + sqrt(17))

   3.5615528128088303

include("julia-source.txt");
# julia-source.txt ソース https://blog.goo.ne.jp/r-de-r/e/ad3a427b84bb416c4f5b73089ae813cf

using SymPy

@syms a::positive, b::positive, c::positive, r::positive,
     x1::positive, y1::positive, x2::positive, y2::positive
r = 1//2
eq1 = (x1 - r)^2 + (a - r - y1)^2 - 4r^2
eq2 = (x2 - x1)^2 + (y1 - y2)^2 - 4r^2
eq3 = (a - 3r - x2)^2 + (y2 - r)^2 - 4r^2
eq4 = distance(b, 0, 0, c, r, a - r) - r^2
eq5 = distance(b, 0, 0, c, x1, y1) - r^2
eq6 = distance(b, 0, 0, c, x2, y2) - r^2
eq7 = distance(b, 0, 0, c, a - 3r, r) - r^2;

# res = solve([eq2, eq3, eq4, eq5, eq6, eq7], (a, b, c, x1, y1, x2, y2));

using NLsolve

function nls(func, params...; ini = [0.0])
   if typeof(ini) <: Number
       r = nlsolve((vout, vin) -> vout[1] = func(vin[1], params..., [ini]), ftol=big"1e-40")
       v = r.zero[1]
   else
       r = nlsolve((vout, vin)->vout .= func(vin, params...), ini, ftol=big"1e-40")
       v = r.zero
   end
   return v, r.f_converged
end;

function H(u)
   (a, b, c, x1, y1, x2, y2) = u
   return [
       (x1 - 1/2)^2 + (a - y1 - 1/2)^2 - 1,  # eq1
       (-x1 + x2)^2 + (y1 - y2)^2 - 1,  # eq2
       (y2 - 1/2)^2 + (a - x2 - 3/2)^2 - 1,  # eq3
       (-b*(-2*a*c + b + 2*c^2 + c)/(2*(b^2 + c^2)) + 1/2)^2 + (a - c*(2*a*c + 2*b^2 - b - c)/(2*(b^2 + c^2)) - 1/2)^2 - 1/4,  # eq4
       (-b*(b*x1 + c^2 - c*y1)/(b^2 + c^2) + x1)^2 + (-c*(b^2 - b*x1 + c*y1)/(b^2 + c^2) + y1)^2 - 1/4,  # eq5
       (-b*(b*x2 + c^2 - c*y2)/(b^2 + c^2) + x2)^2 + (-c*(b^2 - b*x2 + c*y2)/(b^2 + c^2) + y2)^2 - 1/4,  # eq6
       (-c*(-2*a*b + 2*b^2 + 3*b + c)/(2*(b^2 + c^2)) + 1/2)^2 + (a - b*(2*a*b - 3*b + 2*c^2 - c)/(2*(b^2 + c^2)) - 3/2)^2 - 1/4,  # eq7
   ]
end;
r = 1/2
iniv = BigFloat[3.54, 1.71, 2.79, 0.96, 2.14, 1.54, 1.29]
res = nls(H, ini=iniv)

   (BigFloat[3.561552812808830274910704927987038512573599612686810217199316786547477173168936, 1.780776406404415137455352463993519256286799806343405108599658393273738586584675, 2.921164609606622706183028695990278884430199709515107662899487589910607879873015, 1.020517604269610091636901642662346170857866537562270072399772262182492391055713, 2.207701875205886849940469951991359008382399741791206811466211191031651448778865, 1.54103520853922018327380328532469234171573307512454014479954452436498478211229, 1.353850937602943424970234975995679504191199870895603405733105595515825724389432], true)

正方形の一辺の長さは 3.56155 寸,斜線の長さは = sqrt(b^2 + c^2) = 3.42116 寸である。

その他のパラメータは以下の通り。
a = 3.56155;  b = 1.78078;  c = 2.92116;  x1 = 1.02052;  y1 = 2.2077;  x2 = 1.54104;  y2 = 1.35385

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r = 1/2
   (a, b, c, x1, y1, x2, y2) = res[1]
   斜線 = sqrt(b^2 + c^2)
   @printf("正方形の一辺の長さ = %g;  斜線の長さ = %g;  a = %g;  b = %g;  c = %g;  x1 = %g;  y1 = %g;  x2 = %g;  y2 = %g\n",
       a, 斜線, a, b, c, x1, y1, x2, y2)
   plot([0, a, a, 0, 0], [0, 0, a, a, 0], color=:black, lw=0.5, xlims=(-0.2, 3.7), ylims=(-0.2, 3.7))
   circle(r, a - r, r, :blue)
   circle(x1, y1, r, :blue)
   circle(x2, y2, r, :blue)
   circle(a - 3r, r, r, :blue)
   circle(a - r, r, r, :blue)
   segment(0, c, b, 0, :green)
   if more
       delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3  # size[2] * fontsize * 2
       vline!([0], color=:black, lw=0.5)
       hline!([0], color=:black, lw=0.5)
       point(r, a - r, "(r,a-r)")
       point(x1, y1, "(x1,y1)")
       point(x2, y2, "(x2,y2)")
       point(a - 3r, r, "(a-3r,r)")
       point(a - r, r, "(a-r,r)")
       point(a, 0, " a", :black, :left, :top, delta=-delta/2)
       point(b, 0, " b", :green, :left, :top, delta=-delta/2)
       point(0, a, "a ", :black, :right, :vcenter)
       point(0, c, "c ", :green, :right, :vcenter)
   end
end;

 

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

算額(その622)

2024年01月09日 | Julia

算額(その622)

和算図形問題あれこれ
令和 2 年 12 月の問題 - No.2?
飯塚文庫『関流叚書見題部円類五十問本書』より

https://gunmawasan.web.fc2.com/kongetu-no-mondai.html

正方形内に斜線を引き,甲円,乙円,丙円を入れる。正方形の一辺の長さが 1 寸のとき,甲円の直径はいかほどか。

正方形の一辺の長さを a
甲円の半径と中心座標を r1, (r1, r1)
乙円の半径と中心座標を r2, (a - r2, a - r2)
丙円の半径と中心座標を r3, (r3, a - r2)
斜線の y 切片の座標を (0, b)
とおき,以下の連立方程式を解く。

乙円と丙円の半径と中心座標の間の関係を表す 2 つの式は同等の条件を表現しているので,どちらを使っても方程式は解ける。しかし,今回の場合は方程式1 を使うと SymPy は 'NotImplementedError' を起こしてしまい,解が求まらない。方程式2 を使えば解ける。

方程式1: (a - r2 - r3)^2 + (r2 - r3)^2 = (r2 + r3)^2
方程式2: a - r2 - r3 = sqrt((r2 + r3)^2 - (r2 - r3)^2)

include("julia-source.txt");
# julia-source.txt ソース https://blog.goo.ne.jp/r-de-r/e/ad3a427b84bb416c4f5b73089ae813cf

using SymPy

@syms r1::positive, r2::positive, r3::positive, a::positive, b::positive
@syms r1, r2, r3, a, b

a = 1
eq1 = (a - r2 - r3)^2 + (r2 - r3)^2 - (r2 + r3)^2
eq2 = a - r2 - r3  - sqrt((r2 + r3)^2 - (r2 - r3)^2)
eq3 = a + b - sqrt(a^2 + b^2) - 2r1
eq4 = distance(a, 0, 0, b, a - r2, a - r2) - r2^2
eq5 = distance(a, 0, 0, b, r3, a - r3) - r3^2;res = solve([eq2, eq3, eq4, eq5], (r1, r2, r3, b));

2 組の解が得られるが,2 番目のものが適解である。
それぞれの式はかなり長い。甲円の半径は以下のような式になる。

res[2][1] |> println

   sqrt(7)*(-14^(3/4)*(3*sqrt(183) + 62)^(1/3)*sqrt(3*(-sqrt(14)*(3*sqrt(183) + 62)^(1/6)*sqrt(-44*sqrt(14)*(3*sqrt(183) + 62)^(1/3)*sqrt(-22*(3*sqrt(183) + 62)^(1/3) + 91 + 7*(3*sqrt(183) + 62)^(2/3)) - 7*sqrt(14)*(3*sqrt(183) + 62)^(2/3)*sqrt(-22*(3*sqrt(183) + 62)^(1/3) + 91 + 7*(3*sqrt(183) + 62)^(2/3)) - 91*sqrt(14)*sqrt(-22*(3*sqrt(183) + 62)^(1/3) + 91 + 7*(3*sqrt(183) + 62)^(2/3)) + 444*sqrt(21)*sqrt(3*sqrt(183) + 62)) + 2*2^(1/4)*sqrt(3)*7^(3/4)*(3*sqrt(183) + 62)^(1/3)*(-22*(3*sqrt(183) + 62)^(1/3) + 91 + 7*(3*sqrt(183) + 62)^(2/3))^(1/4) + 14^(3/4)*(3*sqrt(183) + 62)^(1/6)*(-22*(3*sqrt(183) + 62)^(1/3) + 91 + 7*(3*sqrt(183) + 62)^(2/3))^(3/4))^2 + 3087*sqrt(14)*(3*sqrt(183) + 62)^(2/3)*sqrt(-22*(3*sqrt(183) + 62)^(1/3) + 91 + 7*(3*sqrt(183) + 62)^(2/3)))*(-22*(3*sqrt(183) + 62)^(1/3) + 91 + 7*(3*sqrt(183) + 62)^(2/3))^(5/4)/4116 - 14^(1/4)*sqrt(3)*sqrt(3*sqrt(183) + 62)*(-22*(3*sqrt(183) + 62)^(1/3) + 91 + 7*(3*sqrt(183) + 62)^(2/3))^(5/4)*sqrt(-44*sqrt(14)*(3*sqrt(183) + 62)^(1/3)*sqrt(-22*(3*sqrt(183) + 62)^(1/3) + 91 + 7*(3*sqrt(183) + 62)^(2/3)) - 7*sqrt(14)*(3*sqrt(183) + 62)^(2/3)*sqrt(-22*(3*sqrt(183) + 62)^(1/3) + 91 + 7*(3*sqrt(183) + 62)^(2/3)) - 91*sqrt(14)*sqrt(-22*(3*sqrt(183) + 62)^(1/3) + 91 + 7*(3*sqrt(183) + 62)^(2/3)) + 444*sqrt(21)*sqrt(3*sqrt(183) + 62))/294 - sqrt(42)*(3*sqrt(183) + 62)^(2/3)*(-7*sqrt(3*sqrt(183) + 62) + 22*(3*sqrt(183) + 62)^(1/6))*(-22*(3*sqrt(183) + 62)^(1/3) + 91 + 7*(3*sqrt(183) + 62)^(2/3))/294 + sqrt(126*sqrt(183) + 2604)*(-28028*(3*sqrt(183) + 62)^(1/3) + 115934 + 8918*(3*sqrt(183) + 62)^(2/3))/4116 + 9*sqrt(7)*(3*sqrt(183) + 62)^(2/3)*(-22*(3*sqrt(183) + 62)^(1/3) + 91 + 7*(3*sqrt(183) + 62)^(2/3))^(3/2)/98)/((3*sqrt(183) + 62)^(2/3)*(-22*(3*sqrt(183) + 62)^(1/3) + 91 + 7*(3*sqrt(183) + 62)^(2/3))^(3/2))

それぞれの式を評価した結果を以下に示す。
順に,甲円の半径,乙円の半径,丙円の半径,斜線の y 切片 b

res[2][1].evalf(), res[2][2].evalf(), res[2][3].evalf(), res[2][4].evalf()

   (0.246773416321210, 0.336189121793897, 0.176552761905338, 0.734031532621976)

甲円の直径は 0.493546832642421 寸である。

2res[2][1].evalf() |> println

   0.493546832642421

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   a = 1
   (r1, r2, r3, b) = (0.246773416321210, 0.336189121793897, 0.176552761905338, 0.734031532621976)
   @printf("甲円の直径 = %g;  r1 = %g;  r2 = %g;  r3 = %g;  b = %g\n", 2r1, r1, r2, r3, b)
   plot([0, a, a, 0, 0], [0, 0, a, a, 0], color=:black, lw=0.5, xlims=(-0.05, 1.05))
   circle(r1, r1, r1)
   circle(a - r2, a - r2, r2, :blue)
   circle(r3, a - r3, r3, :magenta)
   segment(0, b, a, 0, :green)
   if more
       delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3  # size[2] * fontsize * 2
       vline!([0], color=:black, lw=0.5)
       hline!([0], color=:black, lw=0.5)
       point(r1, r1, "甲円:r1,(r1,r1)", :red, :center, delta=-delta/2)
       point(a - r2, a - r2, "乙円:r2,(a-r2,a-r2)", :blue, :center, delta=-delta/2)
       point(r3, a - r3, "丙円:r3,(r3,a-r3)", :magenta, :center, delta=-delta/2)
       point(0, a, "a ", :green, :right, :vcenter)
       point(a, 0, " a", :green, :left, :bottom, delta=delta/2)
       point(0, b, "b ", :green, :right, :vcenter)
   end
end;

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

算額(その621)

2024年01月09日 | Julia

算額(その621)

和算図形問題あれこれ
令和 2 年 10 月の問題 - No.2?
『絵本工夫之錦』より

https://gunmawasan.web.fc2.com/kongetu-no-mondai.html

垂線(中鈎)で区切られた三角形内に直径が 3 寸と 2 寸の大円と小円を入れる。2 円の直径は変えずに中鈎の長さを変えると三角形の面積も変化する。面積が最小となる中鈎の長さはいかほどか。

大円の半径と中心座標を r1, (r1, r1)
小円の半径と中心座標を r2, (-r2, r2)
中鈎の長さを h,左右の頂点の座標を (-x2, 0), (x1, 0)
とおき,以下の連立方程式を解く。それぞれのパラメータは h を含む式になる。

include("julia-source.txt");
# julia-source.txt ソース

using SymPy

@syms x1, x2, h, 弦1, 弦2, s, r1, r2

(r1, r2) = (3, 2) .// 2

eq1 = h^2 + x1^2 - 弦1^2
eq2 = h^2 + x2^2 - 弦2^2
eq3 = h + x1 - 弦1 - 2r1
eq4 = h + x2 - 弦2 - 2r2
eq5 = h*(x1 + x2)/2 - s;

res = solve([eq1, eq2, eq3, eq4, eq5], (s, x1, x2, 弦1, 弦2))

   1-element Vector{NTuple{5, Sym}}:
    (h*(2*h - 5)*(5*h - 6)/(4*(h - 3)*(h - 2)), 3*(2*h - 3)/(2*(h - 3)), 2*(h - 1)/(h - 2), (2*h^2 - 6*h + 9)/(2*(h - 3)), (h^2 - 2*h + 2)/(h - 2))

h と s の関係を図に示すと,4.7 < h < 4.8 において,面積が最小になるのがわかる。

using Plots
s = h*(2*h - 5)*(5*h - 6)/(4*(h - 3)*(h - 2))
pyplot(size=(300, 200), grid=false, aspectratio=:none, label="", fontfamily="IPAMincho")
plot(s, xlims=(4.5, 5), ylims=(19.7, 19.8), xlabel="h", ylabel="s")
hline!([19.7092342844582])
vline!([4.73850950038331])

面積 s が最小になる h を求めるには,s(h) の式を h で微分して,s(h)′ = 0 を解く(接線の傾きが 0 になるときの h を求める)。

s′ = diff(s, h)
plot(s′, xlims=(4.5, 5), xlabel="h", ylabel="s′")

res2 = solve(s′);

4 組の解が得られるが,2番目のものが適解である。得られる数値解は「虚数解」になっている。
ただ,虚数部は 「0.e-21*I」となっており,実質的に 0 であり,実数部 4.73850950038331 が求める解である。

res2[2].evalf(), real(res2[2].evalf())

   (4.73850950038331 + 0.e-21*I, 4.73850950038331)

そのときの x1, x2, 面積は 19.7092342844582 である。

h = real(res2[2].evalf())
(x1, x2) = (3*(2*h - 3)/(2*(h - 3)), 2*(h - 1)/(h - 2))
s = h*(x1 + x2)/2
s |> println

   19.7092342844582

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   h  = 4.73850950038331
   (x1, x2) = (3*(2*h - 3)/(2*(h - 3)), 2*(h - 1)/(h - 2))
   plot([-x2, x1, 0, -x2], [0, 0, h, 0], color=:black, lw=0.5)
   circle(r1, r1, r1)
   circle(-r2, r2, r2, :blue)
   segment(0, 0, 0, h, :green)
   if more
       delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3  # size[2] * fontsize * 2
       vline!([0], color=:black, lw=0.5)
       hline!([0], color=:black, lw=0.5)
       point(r1, r1, "大円:r1,(r1,r1)", :red, :center, delta=-delta)
       point(-r2, r2, "小円:r2,(-r2,r2)", :blue, :center, delta=-delta)
       point(x1, 0, "x1", :red, :center, delta=-delta)
       point(-x2, 0, "x2", :red, :center, delta=-delta)
       point(0, h, " h", :red, :left, :bottom, delta=delta/2)
       plot!(ylims=(-0.5, 5))
   end
end;

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

算額(その620)

2024年01月09日 | Julia

算額(その620)

和算図形問題あれこれ
令和 4 年 3 月の問題 - No.2

https://gunmawasan.web.fc2.com/kongetu-no-mondai.html

正方形を 3 本の線で区切る。線の端は,横辺の 3 等分点,縦辺の 2 等分点を通る。
正方形の辺の長さが 21 寸のとき,赤色で塗られた部分の面積はいかほどか。

正方形の一辺の長さを a とする。また,線分の交点座標を,左側のもの (x1, y1),右側のもの (x2, y2) とおき,求める面積を s とする。
面積は色の付いた大きい三角形の面積から左側部分の小さい三角形の面積を引いたもの s = (2a/3*y2 - a/3*y1)/2 である。

以下の連立方程式を解く。eq5 は eq1〜eq4 で求まる (x1, y1),(x2, y2) を使って後で計算してもよいが。

include("julia-source.txt");
# プログラムソース julia-source.txt

using SymPy

@syms a, s, x1, y1, x2, y2
eq1 = (y1 - a)/x1 - (-3)
eq2 = y1/x1 - (1//2)
eq3 = (y2 - a)/x2 - (-3//2)
eq4 = y2/x2 - (1//2)
eq5 = (4a/6*y2 - 2a/6*y1)/2 - s
res = solve([eq1, eq2, eq3, eq4, eq5], (s, x1, y1, x2, y2))

   Dict{Any, Any} with 5 entries:
     x2 => a/2
     s  => 5*a^2/84
     x1 => 2*a/7
     y2 => a/4
     y1 => a/7

面積は s = 5*a^2/84
a = 21 のとき,s = 105/4 = 26.25

ちなみに a = 42 のときは s = 21, a = 84 なら s = 84 になる。

a = 21
5*a^2//84, 5*a^2/84

   (105//4, 26.25)

function draw(more=false)
   pyplot(size=(300, 300), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   a = 21
   (x1, y1) = (2*a/7, a/7)
   (x2, y2) = (a/2, a/4)
   plot([0, a, a, 0, 0], [0, 0, a, a, 0], color=:black, lw=0.5)
   plot!([0, 2a/3, x2, 0], [0, 0, y2, 0], color=:blue, seriestype=:shape, fillcolor=:red, alpha=0.2)
   plot!([0, a/3, x1, 0], [0, 0, y1, 0], color=:blue, seriestype=:shape, fillcolor=:blue, alpha=0.2)
   segment(0, a, a/3, 0, :blue)
   segment(0, a, 2a/3, 0, :blue)
   segment(0, 0, a, a/2, :blue)
   if more
       delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3  # size[2] * fontsize * 2
       vline!([0], color=:black, lw=0.5)
       hline!([0], color=:black, lw=0.5)
       point(x1, y1, "(x1,y1)  ", :red, :right, :vcenter)
       point(x2, y2, "  (x2,y2)", :red, :left, :top)
       point(a, 0, " a", :red, :left, :bottom, delta=delta/2)
       point(0, a, "  a", :red, :center, :bottom, delta=delta/2)
   end
end;

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

Julia 関数ソースプログラム

2024年01月09日 | Julia

算額シリーズで使っている関数をまとめました

using Plots
using Printf
using SymPy

##################

function dimension_line(x1, y1, x2, y2, str; horizontal=:center, vertical=:vcenter, color=:black, linestyle=:solid, lw=0.5)
    plot!([x1, x2], [y1, y2], color=color; arrow=:arrow, linestyle=linestyle, lw=lw)
    plot!([x2, x1], [y2, y1], color=color; arrow=:arrow, linestyle=linestyle, lw=lw)
    annotate!((x1 + x2)/2, (y1 + y2)/2, text(str, color, horizontal, vertical, 10))
end;

##################

function segment(x1, y1, x2, y2, color=:black; linestyle=:solid, lw=0.5)
    plot!([x1, x2], [y1, y2], color=color; linestyle=linestyle, lw=lw)
end;

##################

function abline(x0, y0, slope, minx, maxx, color=:black; lw=0.5)
    f(x) = slope * (x - x0) + y0
    segment(minx, f(minx), maxx, f(maxx), color; lw=lw)
end;

##################

function intersectionXY(x1, y1, x2, y2, x3, y3, x4, y4)
    denominator = (x1*y3 - x1*y4 - x2*y3 + x2*y4 - x3*y1 + x3*y2 + x4*y1 - x4*y2)
    X = (x1*x3*y2 - x1*x3*y4 - x1*x4*y2 + x1*x4*y3 - x2*x3*y1 + x2*x3*y4 + x2*x4*y1 - x2*x4*y3) / denominator
    Y = (x1*y2*y3 - x1*y2*y4 - x2*y1*y3 + x2*y1*y4 - x3*y1*y4 + x3*y2*y4 + x4*y1*y3 - x4*y2*y3) / denominator
    (X, Y)
end

##################

function distance(x1, y1, x2, y2, x0, y0)
    p1, p2 = sympy.Point(x1, y1), sympy.Point(x2, y2)
    l = sympy.Line(p1, p2)
    l.distance(sympy.Point(x0, y0))^2  # 二乗距離を返す!!
end;

function dist(x1, y1, x2, y2, x0, y0)
    # @syms dx, dy, line_length, vx, vy, projection_length, nearest_point_x, nearest_point_y
    # 直線の方向ベクトル
    dx = x2 - x1
    dy = y2 - y1
    
    # 直線の長さ
    line_length = sqrt(dx^2 + dy^2)
    
    # 直線上の点までのベクトル
    vx = x0 - x1
    vy = y0 - y1
    
    # 直線上の点までの射影ベクトルの長さ
    projection_length = (vx * dx + vy * dy) / line_length
    
    # 直線上の最近点の座標
    nearest_point_x = x1 + (projection_length * dx) / line_length
    nearest_point_y = y1 + (projection_length * dy) / line_length
    
    # 点 (x0, y0) から直線までの二乗距離
    return (x0 - nearest_point_x)^2 + (y0 - nearest_point_y)^2
end;

##################

function circle(ox, oy, r, color=:red; beginangle=0, endangle=360, by=0.5, n=0)
    n != 0 && (by = (endangle - beginangle) / n)
    θ = beginangle:by:endangle
    x = r.*cosd.(θ)
    y = r.*sind.(θ)
    plot!(ox .+ x, oy .+ y, color=color, linewidth=0.5)
end;

#### 回転角度を指定して複数個描く
function rotate(ox, oy, r, color=:red; angle=120, beginangle=0, endangle=360, by=0.5, n=0)
    for deg in 0:angle:360-1
        (ox2, oy2) = [cosd(deg) -sind(deg); sind(deg) cosd(deg)] * [ox; oy]
        circle(ox2, oy2, r, color; beginangle, endangle, by, n)
        beginangle += angle
        endangle += angle
    end
end;

function rotatef(ox, oy, r, color=:red; angle=120, beginangle=0, endangle=360, by=0.5, n=0)
    for deg in 0:angle:360-1
        (ox2, oy2) = [cosd(deg) sind(deg); -sind(deg) cosd(deg)] * [ox; oy]
        circlef(ox2, oy2, r, color; beginangle, endangle, by, n) 
    end
end;

##### 4 個描く
function circle4(x, y, r, color=:red)
   circle(x, y, r, color)
   circle(x, -y, r, color)
   circle(-x, y, r, color)
   circle(-x, -y, r, color)
end;

##### 4 個描く --2
function circle42(x, y, r, color=:red)
   circle(x, y, r, color)
   circle(x, -y, r, color)
   circle(y, -x, r, color)
   circle(-y, -x, r, color)
end;

# 塗りつぶしバージョン

function circlef(ox, oy, r, color=:red; beginangle=0, endangle=360, by=0.5, n=0)
    n != 0 && (by = (endangle - beginangle) / n)
    θ = beginangle:by:endangle
    x = r.*cosd.(θ)
    y = r.*sind.(θ)
    plot!(ox .+ x, oy .+ y, linecolor=color, linewidth=0.5, seriestype=:shape, fillcolor=color)
end;

# アノテーション
function point(x, y, string="", color=:green, position=:left, vertical=:top; mark=true, delta=0)
    mark && scatter!([x], [y], color=color, markerstrokewidth=0, markersize=3)
    annotate!(x, y + delta, text(string, 10, position, color, vertical))
end;

# 矩形

function rect(x1, y1, x2, y2, color=:pink; fill=false)
    if fill == false
        plot!([x1, x2, x2, x1, x1], [y1, y1, y2,  y2, y1], color=color, linewidth=0.5)
    else
        plot!([x1, x2, x2, x1, x1], [y1, y1, y2,  y2, y1], color=color, linewidth=0.5, seriestype=:shape, fillcolor=color)
    end
end;

# 楕円

function ellipse(ox, oy, ra, rb; φ=0, beginangle=0, endangle=360,
                     color=:black, lty=:solid, lwd=0.5, fcolor="")
"""
(ox, oy) を中心,ra, rb を半径とする楕円(楕円弧)。
fcolor を指定すると塗りつぶし。
"""
    θ = beginangle:0.1:endangle
    if φ == 0
        if fcolor == ""
            plot!(ra .* cosd.(θ) .+ ox, rb .* sind.(θ) .+ oy,
                  linecolor=color, linestyle=lty, linewidth=lwd)
        else
            plot!(ra .* cosd.(θ) .+ ox, rb .* sind.(θ) .+ oy,
                  linecolor=color, linestyle=lty, linewidth=lwd,
                  seriestype=:shape, fillcolor=fcolor)
        end
    else
        x = ra .* cosd.(θ)
        y = rb .* sind.(θ)
        cosine = cosd(φ)
        sine = sind(φ)
        if fcolor == ""
            plot!(cosine .* x .- sine .* y .+ ox,
                  sine .* x .+ cosine .* y .+ oy,
                  linecolor=color, linestyle=lty, linewidth=lwd)
        else
            plot!(cosine .* x .- sine .* y .+ ox,
                  sine .* x .+ cosine .* y .+ oy,
                  linecolor=color, linestyle=lty, linewidth=lwd,
                  seriestype=:shape, fillcolor=fcolor)
        end
    end
end;

#=
引数
楕円の長径 a,短径 b,接線の傾き(符号に注意)
戻り値
接点の座標 (x, y),楕円に外接する円の半径 r

func(a, b, tanθ) = (-a^2*tanθ/sqrt(a^2*tanθ^2 + b^2), b^2/sqrt(a^2*tanθ^2 + b^2), -b + sqrt(a^2*tanθ^2 + b^2));
=#;

##### 多角形の面積

function area(xy)
    x = xy[:, 1]
    sum((vcat(x[2:end], x[1]) - vcat(x[end], x[1:end-1])) .* xy[:, 2]) / 2
end;

##### 二直線の交点座標

function intersection(x1, y1, x2, y2, x3, y3, x4, y4)
    p1, p2, p3, p4 = sympy.Point(x1, y1), sympy.Point(x2, y2), sympy.Point(x3, y3), sympy.Point(x4, y4)
    l1, l2 = sympy.Line(p1, p2), sympy.Line(p3, p4)
    a = l1.intersection(l2)[1]
    (a.x, a.y)
end;

 

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

算額(その619)

2024年01月08日 | Julia

算額(その619)

和算図形問題あれこれ
令和 4 年 4 月の問題 - No.2

https://gunmawasan.web.fc2.com/kongetu-no-mondai.html

正方形の一辺の長さを a とする。図のように,正方形内に 3 本の線を引く。

甲,乙,丙の三角形の面積が 111 平方寸,68 平方寸, 8 平方寸のとき,正方形の一辺の長さはいかほどか。

周りにある直角三角形の面積は計算できる。中央の三角形の面積を x とおき,以下の連立方程式を解けばよい。

include("julia-source.txt");

using SymPy

@syms a::positive, b::positive, c::positive, x::positive;

eq1 = a*b/2 - 68
eq2 = a*c/2 - 111
eq3 = (a - b)*(a - c)/2 - 8
eq4 = 111 + 8 + 68 + x - a^2
res = solve([eq1, eq2, eq3, eq4], (a, b, c, x))

   1-element Vector{NTuple{4, Sym}}:
    (sqrt(187 - sqrt(4777))*(sqrt(31191) + 11*sqrt(1887))/444, 2*sqrt(352869 - 1887*sqrt(4777))/111, sqrt(1221/4 - 111*sqrt(4777)/68), sqrt(4777))

a = sqrt(187 - sqrt(4777))*(sqrt(31191) + 11*sqrt(1887))/444 となり,SymPy ではこれ以上簡約化できない。
しかし,裏をかいて a^2 を求めて簡約化すると以下のようになる。この平方根をとれば a = sqrt(sqrt(4777) + 187) である。

res[1][1]^2 |> simplify |> println

   sqrt(4777) + 187

a = sqrt(sqrt(4777) + 187) = 16.003619739999756 である。

sqrt(sqrt(4777) + 187) 

   16.003619739999756

その他のパラメータは以下の通り。

   a = 16.0036;  b = 8.49808;  c = 13.8719;  x = 69.1158

function draw(more=false)
   pyplot(size=(300, 300), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (a, b, c, x) = res[1]
   @printf("正方形の一辺の長さ a = %g;  b = %g;  c = %g;  x = %g\n", a, b, c, x)
   plot([0, a, a, 0, 0,  a, c, 0], [0, 0, a, a, 0,  b, a, 0], color=:black, lw=0.5)
   if more
       delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3  # size[2] * fontsize * 2
       vline!([0], color=:black, lw=0.5)
       hline!([0], color=:black, lw=0.5)
       point(a, 0, " a", :red, :left, :bottom, delta=delta/2)
       point(a, b, " (a,b)", :red, :left, :vcenter)
       point(c, a, "(c,a)", :red, :center, :bottom, delta=delta/2)
       point(0, a, "  a", :red, :center, :bottom, delta=delta/2)
       point(5, 12, "甲: 111", :green, :center, :vcenter, mark=false)
       point(12.5, 2.5, "乙: 68", :green, :center, :vcenter, mark=false)
       point(16, 13, "丙: 8 ", :green, :right, :vcenter, mark=false)
       point(11, 9, "x", :green, :center, :vcenter, mark=false)
   end
end;

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

算額(その618)

2024年01月08日 | Julia

算額(その618)

三重県四日市市 神明神社 寛政2年(1790)
「三重県に現存する算額の研究」福島完(2007/2/13)

https://mie-u.repo.nii.ac.jp/?action=repository_uri&item_id=7216

今,「角」から「軫」まで二十八宿の名前を冠する 28 種の香がある。図のように環状に置き,初日に「角」を薫し,二日目に「氐」,三日目に「尾」,四日目に「女」のように n 日目に n*(n + 1)/2 番目の香を薫す。なお 28 番目の「軫」を過ぎれば,29 番目は「角」になる。7 番目の「箕」が焚かれるのは何日目か。

n 日目に焚かれる香の順番を an とすれば,a1 = 1, a2 = 2, a3 = 6, ..., an = n*(n + 1)/2 である。
「箕」の番号は 7, 35, 63, ..., 7 + 28k である。
両者が一致すると,その日に「箕」が焚かれるので,n*(n + 1)//2 = 7 + 28k を満たす n を求めればよい。

include("julia-source.txt");

using SymPy

@syms n, an, k, 箕
an = n*(n + 1)//2
箕 = 7 + 28k
res = solve(an - 箕, n)
res |> println

   Sym[-sqrt(224*k + 57)/2 - 1/2, sqrt(224*k + 57)/2 - 1/2]

n は正の整数なので,少なくとも 2 番目のものが適解である。
さらに,224*k + 57 は平方数でなくてはならない。
k を順次増やして計算すればよい。k = 3, n = sqrt(224*k + 57)/2 - 1/2 = 13 は手計算でも見つかるが,そのあとはちょっと面倒かもしれないので,プログラムを書いてみる。

sqrt(224*3 + 57)/2 - 1/2

   13.0

for k = 1:100
   k2 = 224*k + 57
   if isapprox(isqrt(k2), sqrt(k2))
       println("k = $k, k2 = $k2, $(Int(sqrt(224*k + 57)/2 - 1/2))日目")
   end
end

   k = 3, k2 = 729, 13日目
   k = 8, k2 = 1849, 21日目
   k = 21, k2 = 4761, 34日目
   k = 32, k2 = 7225, 42日目
   k = 86, k2 = 19321, 69日目

当然といえば当然だが,簡単な数列ではない。
オンライン整数列大辞典 https://oeis.org/welcome にもない。

ブルートフォースで解を求めるのも簡単でよい。

二十八宿 = [
   "角", "亢", "氐", "房", "心", "尾", "箕",  # 東方青龍
   "斗", "牛", "女", "虚", "危", "室", "壁",  # 北方玄武
   "奎", "婁", "胃", "昴", "畢", "觜", "参",  # 西方白虎
   "井", "鬼", "柳", "星", "張", "翼", "軫"   # 南方朱雀
]
for n = 1:100
   an = Int(n*(n + 1)//2)
   suffix = mod(an - 1, 28) + 1
   if suffix == 7
       println(n, "日目,通し番号 ", an, " 番目の香,通し番号を 28 で割ったあまり ", suffix, "。香の名前は ", 二十八宿[suffix])
   end
end

   13日目,通し番号 91 番目の香,通し番号を 28 で割ったあまり 7。香の名前は 箕
   21日目,通し番号 231 番目の香,通し番号を 28 で割ったあまり 7。香の名前は 箕
   34日目,通し番号 595 番目の香,通し番号を 28 で割ったあまり 7。香の名前は 箕
   42日目,通し番号 903 番目の香,通し番号を 28 で割ったあまり 7。香の名前は 箕
   69日目,通し番号 2415 番目の香,通し番号を 28 で割ったあまり 7。香の名前は 箕
   77日目,通し番号 3003 番目の香,通し番号を 28 で割ったあまり 7。香の名前は 箕
   90日目,通し番号 4095 番目の香,通し番号を 28 で割ったあまり 7。香の名前は 箕
   98日目,通し番号 4851 番目の香,通し番号を 28 で割ったあまり 7。香の名前は 箕

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (R, r) = (1, 0.1)
   plot(showaxis=false)
   rotate(0, R, 1.1r, :blue, angle=360//28)
   for i = 1:28
       θ = (i + 6)*360/28
       x = (R - 0.01r)*cosd(θ)
       y = (R - 0.01r)*sind(θ)
       annotate!(x, y, text(二十八宿[i], :center, :vcenter, 18))
   end
   if more
       delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3  # size[2] * fontsize * 2
       #vline!([0], color=:black, lw=0.5)
       #hline!([0], color=:black, lw=0.5)
   end
end;

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

算額(その617)

2024年01月08日 | Julia

算額(その617)

三重県四日市市 神明神社 寛政2年(1790)
「三重県に現存する算額の研究」福島完(2007/2/13)
https://mie-u.repo.nii.ac.jp/?action=repository_uri&item_id=7216

問題文2
菱形の中に,大円 1 個,小円 2 個が入っている。菱形の面積から3個の円の面積を除いた面積(A),菱形の対角線の長さの和(B)と,大円と小円の直径の差(C)が与えられているとき,小円の直径を求めよ。

菱形の対角線 2a, 2b (a > b),大円と小円の半径をそれぞれ r1, r2 とする。

以下の方程式を解く。

include("julia-source.txt");

using SymPy

@syms r1::positive, y1::positive, r2::positive, y2::negative, a::positive, b::positive,
   A::positive, B::positive, C::positive;
円周率 = 3.16  # 円積率 3.16/4 = 0.79
eq1 = r2^2 + (y1 - y2)^2 - (r1 + r2)^2
eq2 = distance(0, b, a, 0, 0, y1) - r1^2
eq3 = distance(0, -b, a, 0, r2, y2) - r2^2
eq4 = 2a*b - 円周率*r1^2 - 2円周率*r2^2 - A
eq5 = 2a + 2b - B
eq6 = 2r1 - 2r2 - C;

using NLsolve

function nls(func, params...; ini = [0.0])
   if typeof(ini) <: Number
       r = nlsolve((vout, vin) -> vout[1] = func(vin[1], params..., [ini]), ftol=1e-14)
       v = r.zero[1]
   else
       r = nlsolve((vout, vin)->vout .= func(vin, params...), ini, ftol=1e-14)
       v = r.zero
   end
   return v, r.f_converged
end;

function H(u)
   (a, b, r1, y1, r2, y2) = u
   return [
       r2^2 - (r1 + r2)^2 + (y1 - y2)^2,  # eq1
       a^2*b^2*(b - y1)^2/(a^2 + b^2)^2 - r1^2 + (-b*(a^2 + b*y1)/(a^2 + b^2) + y1)^2,  # eq2
       -r2^2 + (-a*(a*r2 + b^2 + b*y2)/(a^2 + b^2) + r2)^2 + (-b*(-a^2 + a*r2 + b*y2)/(a^2 + b^2) + y2)^2,  # eq3
       2*a*b - 3.16*r1^2 - 6.32*r2^2 - 53.7,  # eq4
       2*a + 2*b - 32,  # eq5
       2*r1 - 2*r2 - 5.2,  # eq6
   ]
end;

(A, B, C) = (53.7, 32, 5.2)
iniv = BigFloat[8.62, 7.38, 4.23, 1.81, 1.63, -3.83]
res = nls(H, ini=iniv)
  (BigFloat[8.618869516619060933261217496129591164127618589189709440245477710397030837896864, 7.381130483380939066738782503870408835872381410810290559754522289595245106897612, 4.234238957828194708369843972428936199044440731565763308078691436517181518285074, 1.806377116536225577423953366326376812684128330422196332266830152186767547254349, 1.634238957828194619552002002416412965153907284300138308078691438199894855227677, -3.829959998582366768106243609407652459638817222378998651702439496268955544637784], true)

菱形の面積から3個の円の面積を除いた面積(A) = 53.7
菱形の対角線の長さの和(B) = 32
大円と小円の直径の差(C) = 5.2
のとき,
小円の直径 = 3.26848
その他のパラメータは以下の通りである。
a = 8.61887; b = 7.38113;  r1 = 4.23424;  y1 = 1.80638;  r2 = 1.63424;  y2 = -3.82996

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (A, B, C) = (53.7, 32, 5.2)
   (a, b, r1, y1, r2, y2) = res[1]
   @printf("菱形の面積から3個の円の面積を除いた面積(A) = %g\n", A)
   @printf("菱形の対角線の長さの和(B) = %g\n", B)
   @printf("大円と小円の直径の差(C) = %g\n", C)
   @printf("小円の直径 = %g;  a = %g; b = %g;  r1 = %g;  y1 = %g;  r2 = %g;  y2 = %g\n", 2r2, a, b, r1, y1, r2, y2)
   plot([a, 0, -a, 0, a], [0, b, 0, -b, 0], color=:black, lw=0.5)
   circle(0, y1, r1)
   circle(r2, y2, r2, :blue)
   circle(-r2, y2, r2, :blue)
   if more
       delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3  # size[2] * fontsize * 2
       vline!([0], color=:black, lw=0.5)
       hline!([0], color=:black, lw=0.5)
       point(0, y1, " 大円:r1,(0,y1)", :red, :left, :vcenter)
       point(r2, y2, "小円:r2\n(r2,y2)", :blue, :center, delta=-delta/2)
       point(0, b, " b", :black, :left, :bottom)
       point(a, 0, " a", :black, :left, :bottom)
   end
end;

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

能登地震への対応の遅れ...怠慢

2024年01月07日 | 雑感

https://asahi.5ch.net/test/read.cgi/newsplus/1704585681?v=pc

<quote>石川県で最大震度7を観測した能登半島地震で、人命救助などのために派遣されている自衛隊員は、5日時点で約5000人となった。政府は、地理的条件や近隣の部隊配置などに違いがあり、単純比較できないとするが、2016年に震度7を記録した熊本地震の5分の1にとどまる。野党からは、政府の初動対応の遅れを批判する声も出ている。
◆「自衛隊員が足りない影響」

 防衛省は地震発生翌日の2日、陸海空自衛隊の指揮系統を一元化した統合任務部隊を1万人規模で編成した。ただ実際に現地で活動するのは2日の段階で約1000人、3日は約2000人、5日も約5000人にとどまっている。発災から5日目で約2万4000人が活動していた熊本地震と比べて規模が小さく見える。
 立憲民主党の泉健太代表は5日、記者団に「自衛隊が逐次投入になっており、あまりに遅く小規模だ」と批判。別の立民幹部も「物資が届かず、被害の全容が明らかにならないのは、自衛隊員が足りない影響だ」と指摘する。
◆首相「単に人数だけを比較するのは適当ではない」
 岸田文雄首相は記者団に「(陸上自衛隊西部方面隊の拠点がある)熊本にはそもそも1万人を超える自衛隊が存在したが、今回は大規模部隊はいなかった。単に人数だけを比較するのは適当ではない」と主張。木原稔防衛相も「道路の復旧状況も見ながら人数を増やした。逐次投入との批判は全く当たらない」と反論した。</quote>

引用が長くなってしまったが,要するに「熊本にはそもそも1万人を超える自衛隊が存在し」ており「発災から5日目で約2万4000人が活動した」のに対し,今回の能登地震では「今回は大規模部隊はいなかった」にもかかわらず「5日時点で約5000人」なのでしょ?

今回こそ,熊本地震を上回る派遣が必要だったということでしょう。

論理が破綻していますね。

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

算額(その616)

2024年01月07日 | Julia

算額(その616)

福島県白河市明神 境明神 万延元年(1860)
http://www.wasan.jp/fukusima/sakai1L2.html

団扇の中に小円 1 個と長方形が内接し,長方形の中に大円 2 個,小円 7 個が入っている。

小円の径を 1 としたとき,団扇の径はいかほどか。

長方形内の小円の入り方で長方形の長辺,短辺の長さおよび小円の中心座標は簡単に計算できる。

小円の半径を r,外円の半径と中心座標を R, (0, 0),長方形の右上の頂点座標を (x1, y1) とする。
(x1, y1) は外円の円周上にあるので,等円の半径,外円の半径を r, R として以下の方程式をとき R = r*(4*sqrt(2) + 13)/4 を得る。

include("julia-source.txt")

using SymPy
@syms r::positive, R::positive, x5::positive, y5::negative
x1 = 2√Sym(2)r + r
y1 = R - 2r
eq = x1^2 + y1^2 - R^2
R = solve(eq, R)[1]
R |> println

   r*(4*sqrt(2) + 13)/4

r = 1/2 のとき,R = 2.3321067811865475 で,直径は 4.664213562373095 となる。答えでは 団扇の著系は 5 寸 となっているので,一致しない。

r = 1/2
R = r*(4*sqrt(2) + 13)/4
R, 2R

   (2.3321067811865475, 4.664213562373095)

以上で団扇の主要部を描くことができるが追加で,団扇の下部の竹の骨が見えている円弧部分の描画に必要な座標 (x5, y5) を計算する。

@syms r::positive, R::positive, x5::positive, y5::negative
y2 = R - 3r - √Sym(2)r
eq2 = x5^2 + (R + y5)^2 - (R + y2)^2/4
eq3 = x5^2 + y5^2 - R^2
solve([eq2, eq3], (x5, y5))

   1-element Vector{Tuple{Sym, Sym}}:
    (sqrt(3*R^4/4 - 3*R^3*r/2 - sqrt(2)*R^3*r/2 - 11*R^2*r^2/8 - 3*sqrt(2)*R^2*r^2/4 + 29*sqrt(2)*R*r^3/8 + 45*R*r^3/8 - 193*r^4/64 - 33*sqrt(2)*r^4/16)/R, (-4*R^2 - 12*R*r - 4*sqrt(2)*R*r + 6*sqrt(2)*r^2 + 11*r^2)/(8*R))

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r = 1/2
   R = r*(4*sqrt(2) + 13)/4  # R は後々の制約条件から決まる
   println("R = $R, $(1 + sqrt(2))")
   println("2R = $(2R), $(2(1 + sqrt(2)))")
   a = 1 + sqrt(2)
   x1 = 2√2r + r
   y1 = R - 2r
   # (x1, y1) が外円の円周上にあるには x1^2 + y1^2 = R^2 でなければならない。
   y2 = R - 3r - √2r
   x2 = x1 - r - √2r
   y3 = y1 - 2a*r
   plot([x1, -x1, -x1, x1, x1], [y1, y1, y3, y3, y1], color=:blue, lw=0.5)
   circle(0, 0, R, :black)
   circle(0, R - r, r)
   circle(x2, y2 + √2r, r)
   circle(x2, y2 - √2r, r)
   circle(x2 - √2r, y2, r)
   circle(x2 + √2r, y2, r)
   circle(x2, y2, (√2 + 1)r, :green)
   circle(-x2, y2 + √2r, r)
   circle(-x2, y2 - √2r, r)
   circle(-x2 - √2r, y2, r)
   circle(-x2, y2, ( √2 + 1)r, :green)
   (x5, y5) = (sqrt(3*R^4/4 - 3*R^3*r/2 - sqrt(2)*R^3*r/2 - 11*R^2*r^2/8 - 3*sqrt(2)*R^2*r^2/4 + 29*sqrt(2)*R*r^3/8 + 45*R*r^3/8 - 193*r^4/64 - 33*sqrt(2)*r^4/16)/R, (-4*R^2 - 12*R*r - 4*sqrt(2)*R*r + 6*sqrt(2)*r^2 + 11*r^2)/(8*R))
   θ = atand(y5+R, x5)
   println(θ)
   circle(0, -R, (R + y2)/2, :black, beginangle=θ, endangle=181-θ)
   if more
       delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3  # size[2] * fontsize * 2
       vline!([0], color=:black, lw=0.5)
       hline!([0], color=:black, lw=0.5)
       point(x1, y1, " (x1,y1)")
       point(x1, y2  - (√2 + 1)r, " (x1,y2)")
       point(x2, y2, " (x2,y2)", :green, :left, :vcenter)
       point(0, 0, " O0", :red, :left, delta=-delta/2)
       point(x2, y2 + √2r, " O1", :red, :left, :vcenter)
       point(0, y2, " O2", :red, :left, :vcenter)
       point(x2 + √2r, y2, " O3", :red, :left, :vcenter)
       point(0, R, " R", :black, :left, :bottom, delta=delta/2)
       point(x5, y5, " (x5,y5)", :black, :left, :vcenter)
   end
end;

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

算額(その615)

2024年01月06日 | Julia

算額(その615)

福島県楢葉町北田 北田神社 明治27年(1894)
ならはの絵馬―村人の祈り― 018/036page

http://is2.sss.fukushima-u.ac.jp/fks-db/txt/10088.002/html/00018.html

福島県楢葉町北田には,北田天満宮と大山祇神社があるが北田神社はないようだ。

二円が交わってできる三日月型の中に仁,禮,義,智の 4 円が入っている。仁円と禮円の直径の和と智円の直径の積は 3 寸,智円と禮円の直径の和と仁円の直径の積は 4 寸,禮円の面積は 2 歩である。義円の面積はいかほどか。

三日月形を形成する2円の半径を r0,中心間の距離を x とする。
仁円の半径,中心座標を r1, (x1, y1)
禮円の半径,中心座標を r2, (x2, y2)
義円の半径,中心座標を r3, (x3, y3)
智円の半径,中心座標を r4, (x4, y4)
仁円と禮円の直径の和と智円の直径の積を「仁義和乗智」
智円と禮円の直径の和と仁円の直径の積を「智禮和乗仁」
禮円の面積を「禮円積」
とおき,以下の連立方程1式の数値解を nlsolve() で求める。

なお,算額では「仁義和乗智」= 3,「智禮和乗仁」= 4 の場合の解を要求しているが,算額の図は「仁義和乗智」= 4,「智禮和乗仁」= 3 の場合のもののようである。上に示した図も後者の設定での解である。

実際の解は以下の通り。

include("julia-source.txt");

using SymPy

@syms r0, x, r1, x1, y1, r2, x2, y2, r3, x3, y3, r4, x4, y4,
     仁義和乗智, 智禮和乗仁, 禮円積
eq1 = x1^2 + y1^2 - (r0 - r1)^2
eq2 = x2^2 + y2^2 - (r0 - r2)^2
eq3 = x3^2 + y3^2 - (r0 - r3)^2
eq4 = x4^2 + y4^2 - (r0 - r4)^2
eq5 = (x1 - x)^2 + y1^2 - (r0 + r1)^2
eq6 = (x2 - x)^2 + y2^2 - (r0 + r2)^2
eq7 = (x3 - x)^2 + y3^2 - (r0 + r3)^2
eq8 = (x4 - x)^2 + y4^2 - (r0 + r4)^2
eq9 = (x1 - x2)^2 + (y1 - y2)^2 - (r1 + r2)^2
eq10 = (x2 - x3)^2 + (y2 - y3)^2 - (r2 + r3)^2
eq11 = (x3 - x4)^2 + (y3 - y4)^2 - (r3 + r4)^2
eq12 = 2(r1 + r3)*2r4 - 仁義和乗智
eq13 = 2(r4 + r2)*2r1 - 智禮和乗仁
eq14 = (2r2)^2 * 0.79 - 禮円積;

using NLsolve

function nls(func, params...; ini = [0.0])
   if typeof(ini) <: Number
       r = nlsolve((vout, vin) -> vout[1] = func(vin[1], params..., [ini]), ftol=1e-14)
       v = r.zero[1]
   else
       r = nlsolve((vout, vin)->vout .= func(vin, params...), ini, ftol=1e-14)
       v = r.zero
   end
   return v, r.f_converged
end;

function H(u)
   (r0, x, r1, x1, y1, r2, x2, y2, r3, x3, y3, r4, x4, y4) = u
   return [
       x1^2 + y1^2 - (r0 - r1)^2,  # eq1
       x2^2 + y2^2 - (r0 - r2)^2,  # eq2
       x3^2 + y3^2 - (r0 - r3)^2,  # eq3
       x4^2 + y4^2 - (r0 - r4)^2,  # eq4
       y1^2 - (r0 + r1)^2 + (-x + x1)^2,  # eq5
       y2^2 - (r0 + r2)^2 + (-x + x2)^2,  # eq6
       y3^2 - (r0 + r3)^2 + (-x + x3)^2,  # eq7
       y4^2 - (r0 + r4)^2 + (-x + x4)^2,  # eq8
       -(r1 + r2)^2 + (x1 - x2)^2 + (y1 - y2)^2,  # eq9
       -(r2 + r3)^2 + (x2 - x3)^2 + (y2 - y3)^2,  # eq10
       -(r3 + r4)^2 + (x3 - x4)^2 + (y3 - y4)^2,  # eq11
       2*r4*(2*r1 + 2*r3) - 仁義和乗智,  # eq12
       2*r1*(2*r2 + 2*r4) - 智禮和乗仁,  # eq13
       3.16*r2^2 - 禮円積,  # eq14
   ]
end;
(仁義和乗智, 智禮和乗仁, 禮円積) = (3, 4, 2)
iniv = BigFloat[3.68, -1.6, 0.76, 2.7, 1.11, 0.8, 2.85, -0.43, 0.69, 2.36, -1.84, 0.52, 1.57, -2.75]
res = nls(H, ini=iniv)
println([round(Float64(x), digits=10) for x in res[1]], " 収束? ", res[2])

   [3.6827310728, -1.6028875866, 0.7619151516, 2.6996483947, 1.1149278859, 0.7955572842, 2.8542380589, -0.4348535258, 0.6889728183, 2.3644695589, -1.8362658282, 0.5169248182, 1.5738882089, -2.7468536816] 収束? true

義円の面積は 3.16*r3^2 ≒ 1.5 である。

その他のパラメータは以下の通り。
r0 = 3.68273;  x = -1.60289;
r1 = 0.761915;  x1 = 2.69965;  y1 = 1.11493
r2 = 0.795557;  x2 = 2.85424;  y2 = -0.434854
r3 = 0.688973;  x3 = 2.36447;  y3 = -1.83627
r4 = 0.516925;  x4 = 1.57389;  y4 = -2.74685

using Plots

function draw(more)
    pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (r0, x, r1, x1, y1, r2, x2, y2, r3, x3, y3, r4, x4, y4) = res[1]
   @printf("義円の面積 = %g;  r0 = %g;  x = %g;
r1 = %g;  x1 = %g;  y1 = %g
r2 = %g;  x2 = %g;  y2 = %g
r3 = %g;  x3 = %g;  y3 = %g
r4 = %g;  x4 = %g;  y4 = %g\n",
       3.16*r3^2, r0, x, r1, x1, y1, r2, x2, y2, r3, x3, y3, r4, x4, y4)
   plot()
   circle(0, 0, r0, :black)
   circle(-x, 0, r0, :black)
   circle(-x1, y1, r1, :black)
   circle(-x2, y2, r2, :red)
   circle(-x3, y3, r3, :orange)
   circle(-x4, y4, r4, :green)
   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(-x1, y1, "仁:r1,(x1,y1)", :black, :center, :vcenter, mark=false)
       point(-x2, y2, "禮:r2,(x2,y2)", :red, :center, :vcenter, mark=false)
       point(-x3, y3, "義:r3,(x3,y3)", :orange, :center, :vcenter, mark=false)
       point(-x4, y4, "智:r4,(x4,y4)", :green, :center, :vcenter, mark=false)
       plot!(xlims=(-4, 1))
   end
end;

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

算額(その614)

2024年01月06日 | Julia

算額(その614)

高山忠直編: 算法評論
国立国会図書館 デジタルコレクション

https://dl.ndl.go.jp/pid/3508431/1/7

2 本の直線に挟まれて大円,中円,小円が互いに接している。中円と小円の直径が与えられたとき,大円の直径を求めよ。

時計回りに 90° 回転させた図で考える。
大円の半径と中心座標を r1, (x1, 0)
中円の半径と中心座標を r2, (0, r2)
小円の半径と中心座標を r3, (x3, 0)
2 直線の交点座標を (a, 0)
とおき,以下の連立方程式を解く。

include("julia-source.txt");

using SymPy
@syms a::positive, r1::positive, x1::positive, r2::positive,
     r3::positive, x3::positive
(r2, r3) = (5, 2)
tt = r3/(a - x3)
eq1 = r2/a - r3/(a - x3)
eq2 = x1^2 + r2^2 - (r1 + r2)^2
eq3 = (x3 - x1)^2 + r3^2 - (r1 + r3)^2
eq4 = r1/sqrt((a - x1)^2 - r1^2) - 2tt/(1 - tt^2)
res = solve([eq1, eq2, eq3, eq4], (a, r1, x1, x3))

   1-element Vector{NTuple{4, Sym}}:
    (5*sqrt(169 + 56*sqrt(10))/3, -21/8 - 49*sqrt(10)/160 + 7*sqrt(10)*sqrt(56*sqrt(10) + 209)/160 + 3*sqrt(56*sqrt(10) + 209)/8, 3*sqrt(169 + 56*sqrt(10))*sqrt(56*sqrt(10) + 209)/(2*(160 + 56*sqrt(10))) - (139 + 56*sqrt(10))*sqrt(169 + 56*sqrt(10))/(2*(3 - sqrt(169 + 56*sqrt(10)))*(3 + sqrt(169 + 56*sqrt(10)))), sqrt(169 + 56*sqrt(10)))

大円の半径の式

res[1][2] |> println

   -21/8 - 49*sqrt(10)/160 + 7*sqrt(10)*sqrt(56*sqrt(10) + 209)/160 + 3*sqrt(56*sqrt(10) + 209)/8

簡約化できる

res[1][2] |> sympy.sqrtdenest |> simplify |> println

   7/4 + 3*sqrt(10)/2

r2,r3 を未知数として解くと不適切解しか得られない。
r2, r3 として整数を与えて解を吟味することにより一般解を得ることができる。
r2 = 9, r3 = 1〜7 を試せば,r1 は (r2 + r3)/4 + 3sqrt(r2*r3)/2 らしいことがわかる。
また,整数値でなくても成り立つこともわかる。

術では「中径と小径を乗じて得られる数を開平して二倍し,これを極と名付ける。この値から中径,小径を引き四で割る。極からこの値を引けば大円の径になる」と記している。
Julia で書くと
極 = 2sqrt(r2*r3)
極 - (極 - r3 - r2)/4
のようになる。これは十分簡約化された数式であるが,Julia はもっと簡約化する。すなわち r2/4 + r3/4 + 3*sqrt(r2*r3)/2 でこれは前述した式に等しい。

@syms r2, r3
極 = 2sqrt(r2*r3)
極 - (極 - r3 - r2)/4 |> println

   r2/4 + r3/4 + 3*sqrt(r2*r3)/2

(r2/4 + r3/4 + 3*sqrt(r2*r3)/2)(r2 =>5, r3=>2) |> println

   7/4 + 3*sqrt(10)/2

中円,小円の直径が 10, 4 のとき,大円の直径は 12.9868。

その他のパラメータは以下の通り。

   a = 31.0057;  r1 = 6.49342;  x1 = 10.3488;  x3 = 18.6034

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (r2, r3) = (5, 2)
   (a, r1, x1, x3) = res[1]
   @printf("a = %g;  r1 = %g;  x1 = %g;  x3 = %g\n", a, r1, x1, x3)
   plot()
   circle(0, r2, r2)
   circle(0, -r2, r2)
   circle(x1, 0, r1, :blue)
   circle(x3, r3, r3, :green)
   circle(x3, -r3, r3, :green)
   abline(a, 0, r1/sqrt((a - x1)^2 - r1^2), -r2, a)
   abline(a, 0, -r1/sqrt((a - x1)^2 - r1^2), -r2, a)
   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(x1, 0, " 大円:r1,(r1,0)", :blue, :center, :bottom, delta=delta)
       point(0, r2, " 中円:r2\n (0,r2)", :red, :left, :vcenter)
       point(x3, r3, "小円:r3,(x3,r3)", :black, :left, delta=-2delta)
       point(a, 0, "a", :black, :left, :bottom, delta=delta)
   end
end;

 

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

算額(その613)

2024年01月05日 | Julia

算額(その613)

高山忠直編: 算法評論
国立国会図書館 デジタルコレクション

https://dl.ndl.go.jp/pid/3508431/1/6

円弧内に斜線と等円 2 個を入れる。等円の直径が 4 寸で,弦の長さから「子 = 14 寸」を引いた丑の長さ」(図での xa - x)を求めよ。

円弧をなす円の半径と中心座標を R, (0, 0)
弦と y 軸の交点座標を (0, y) とする。
等円の半径と中心座標を r, (x, y + r), (x2, y2); x = 14 - sqrt(R^2 - y^2)

include("julia-source.txt");

using SymPy
@syms r::positive, R::positive, x::positive, y::positive,
     x2::negative, y2::positive, y3::positive, xa::positive, xb::positive
r = 4//2
xa = sqrt(R^2 - y^2)
xb = sqrt(R^2 - y3^2)
eq1 = (14 - sqrt(R^2 - y^2))^2 + (y + r)^2 - (R - r)^2
eq2 = x2^2 + y2^2 - (R - r)^2
eq3 = (y3 - y)/(xa + xb) * y2/x2 + 1
eq4 = distance(-xa, y, xb, y3, 14 - sqrt(R^2 - y^2), y + r) - r^2
eq5 = (xb - xa)^2/4 + ((y3 - y)/2+y)^2  - (R - 2r)^2;

using NLsolve

function nls(func, params...; ini = [0.0])
   if typeof(ini) <: Number
       r = nlsolve((vout, vin) -> vout[1] = func(vin[1], params..., [ini]), ftol=big"1e-40")
       v = r.zero[1]
   else
       r = nlsolve((vout, vin)->vout .= func(vin, params...), ini, ftol=big"1e-40")
       v = r.zero
   end
   return v, r.f_converged
end;

function H(u)
   (R, y, x2, y2, y3) = u
   return [
       (14 - sqrt(R^2 - y^2))^2 - (R - 2)^2 + (y + 2)^2,  # eq1
       x2^2 + y2^2 - (R - 2)^2,  # eq2
       1 + y2*(-y + y3)/(x2*(sqrt(R^2 - y^2) + sqrt(R^2 - y3^2))),  # eq3
       (y - ((y + 2)*(R^2 - y*y3 + sqrt(R^2 - y^2)*sqrt(R^2 - y3^2)) - (sqrt(R^2 - y^2) + sqrt(R^2 - y3^2))*(7*y - 7*y3 + sqrt(R^2 - y^2) + sqrt(R^2 - y3^2)))/(R^2 - y*y3 + sqrt(R^2 - y^2)*sqrt(R^2 - y3^2)) + 2)^2 + (-sqrt(R^2 - y^2) - ((14 - sqrt(R^2 - y^2))*(R^2 - y*y3 + sqrt(R^2 - y^2)*sqrt(R^2 - y3^2)) - (y - y3)*(7*y - 7*y3 + sqrt(R^2 - y^2) + sqrt(R^2 - y3^2)))/(R^2 - y*y3 + sqrt(R^2 - y^2)*sqrt(R^2 - y3^2)) + 14)^2 - 4,  # eq4
       -(R - 4)^2 + (y/2 + y3/2)^2 + (-sqrt(R^2 - y^2) + sqrt(R^2 - y3^2))^2/4,  # eq5
   ]
end;

iniv = BigFloat[8.8, 2.5, -1.67, 6.6, 6.7]
res = nls(H, ini=iniv)

   (BigFloat[9.165816326530612244897959183673469387755102040816326530612244897959183673469382, 2.839183673469387755102040816326530612244897959183673469387755102040816326530621, -2.00642857142857142857142857142857142857142857142857137843826725205845906344671, 6.879183673469387755102040816326530612244897959183673492933533457683883923317655, 7.079183673469387755102040816326530612244897959183673469387755102040816326530546], true)

丑の長さは xa - x = 8.715 - 5.285 = 3.43 寸である。

   R = 9.16582;  x = 5.285;  y = 2.83918;  x2 = -2.00643;  y2 = 6.87918;  y3 = 7.07918;  xa = 8.715;  xb = 5.82214

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r = 2
   (R, y, x2, y2, y3) = res[1]
   xa = sqrt(R^2 - y^2)
   xb = sqrt(R^2 - y3^2)
   x = 14 - xa
   @printf("R = %g;  x = %g;  y = %g;  x2 = %g;  y2 = %g;  y3 = %g;  xa = %g;  xb = %g\n", R, x, y, x2, y2, y3, xa, xb)
   @printf("丑 = %g\n", xa - x)
   plot()
   circle(0, 0, R, beginangle=0, endangle=180)
   circle(x, y + r, r)
   circle(x2, y2, r)
   plot!([sqrt(R^2 - y3^2), -sqrt(R^2 - y^2), sqrt(R^2 - y^2)], [y3, y, y], color=:blue, lw=0.5)
   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, y, " y", :blue, :left, delta=-delta/2)
       point(-xa, y, "(-xa,y)", :blue)
       point(xa, y, "(xa,y)", :blue, :right, delta=-delta/2)
       point(x, y, "(x,y)", :blue, :center, delta=-delta/2)
       point(sqrt(R^2 - y3^2), y3, " (xb,y3)", :blue, :left, :vcenter)
       point(x, y + r, "(x,y+r)", :red, :center, delta=-delta/2)
       point(x2, y2, "(x2,y2)", :red, :center, delta=-delta/2)
       point(R, 0, "R ", :red, :right, :bottom, delta=delta/2)
       segment(x, y, xa, y, lw=2)
       point((x+xa)/2, y, "丑", :black, :center, :bottom, delta=delta, mark=false)
   end
end;

 

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

算額(その612)

2024年01月05日 | Julia

算額(その612)

高山忠直編: 算法評論
国立国会図書館 デジタルコレクション

https://dl.ndl.go.jp/pid/3508431/1/9

鈎股弦(直角三角形)内に長方形と中鈎(直角の頂点とから斜辺におろした垂線)と 2 個の等円を入れる。長方形の長辺と短辺が 40 寸,20 寸であるとき,等円の直径を求めよ。

長方形の長辺と短辺を「長」,「平」
直角三角形の直角を挟む二辺を「鈎」,「股」
中鈎と斜辺の交点座標を (x2, y2)
中鉤と長方形の長辺の交点座標を (x, 20)
等円の半径と中心座標を r, (r, a), (b, 20 + r)
とおき,以下の連立方程式を解き,r, x, 鈎, 股, x2, y2 を求める。
なお,等円の半径 r を求めるだけであれば,eq1, eq2 のみの二元連立方程式を解くだけでよい。

include("julia-source.txt");

using SymPy
@syms 長::positive, 平::positive,
     鈎::positive, 股::positive, x::positive, y::positive, r::positive,
     x2::positive, y2::positive, a::positive, b::positive
eq1 = sqrt(x^2 + 平^2) - (長 - x)
eq2 = 平 + x - sqrt(x^2 + 平^2) - 2r
eq3 = x/平 - 鈎/股
eq4 = 長*平 + 長*(鈎 - 平)/2 + 平*(股 - 長)/2 - 鈎*股/2
eq5 = x2^2 + y2^2 + (鈎 -y2)^2 + x2^2 - 鈎^2
eq6 = x2^2 + y2^2 + (股 - x2)^2 + y2^2 - 股^2;
res = solve([eq1, eq2, eq3, eq4, eq5, eq6], (r, x, 鈎, 股, x2, y2))

   1-element Vector{NTuple{6, Sym}}:
    ((-平^2 + 長*(2*平 + 長) - sqrt(4*平^2*長^2 + (平^2 - 長^2)^2))/(4*長), (-平^2 + 長^2)/(2*長), (平^2 + 長^2)/(2*平), -長*(平^2 + 長^2)/(平^2 - 長^2), 長*(-平^2 + 長^2)/(平^2 + 長^2), 2*平*長^2/(平^2 + 長^2))

長,平が 40, 20 のとき,等円の半径は 5 である。

半径 = (-平^2 + 長*(2*平 + 長) - sqrt(4*平^2*長^2 + (平^2 - 長^2)^2))/(4*長)
半径(長 => 40, 平 => 20)

   5

半径の式中の sqrt の中は平方になるので sqrt を剥ぎ取ることができる。

sqrt(4*平^2*長^2 + (平^2 - 長^2)^2) |> factor |> println

   平^2 + 長^2

2倍して直径を求める式を得る。

2(-平^2 + 長*(2*平 + 長) - (平^2 + 長^2))/(4*長) |> simplify |> println

   平*(-平 + 長)/長

カッコの中を「長」で割ると,平*(1 - 平/長) となり,術の「平以長除之得數以減一個余剰平得等径合問」に一致する。
長,平が 40, 20 のとき,等円の直径は 10 である。

直径 = 平*(1 - 平/長)
直径(長 => 40, 平 => 20)

   10

「平」と「長」を未知数のままにしておいても構わないが,煩雑なので数値解を求めると,
(r, x, 鈎, 股, x2, y2) = (5, 15, 50, 200/3, 24, 32)
となる。このパラメータを既知として,更に図を描くために,等円の中心座標 (r, a), (b, 20 + r) の a, b を求める。

@syms 鈎::positive, 股::positive, x::positive, y::positive, r::positive,
     x2::positive, y2::positive, a::positive, b::positive
(r, x, 鈎, 股, x2, y2) = (5, 15, 50, 200/3, 24, 32)
eq7 = distance(0, 0, x2, y2, r, a) - r^2
eq8 = distance(0, 0, x2, y2, b, 20 + r) - r^2
solve([eq7, eq8], (a, b))

   2-element Vector{Tuple{Sym, Sym}}:
    (15, 25/2)
    (15, 25)

2 番目のものが適解である。すなわち等円の中心座標は (5, 15), (25, 25) である

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (r, x, 鈎, 股, x2, y2) = (5, 15, 50, 200/3, 24, 32)
   (a, b) = (15, 25)
   @printf("等円の直径 = %g;  r = %g;  x = %g;  鈎 = %g;  股 = %g;  x2 = %g;  y2 = %g;  a = %g;  b = %g\n",
       2r, r, x, 鈎, 股, x2, y2, a, b)
   plot([0, 股, 0, 0], [0, 0, 鈎, 0], color=:black, lw=0.5)
   rect(0, 0, 40, 20, :blue)
   segment(0, 0, x2, y2, :green)
   circle(r, a, r)
   circle(b, 20 + 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(x, 20, "(x,20)", :black)
       point(x2, y2, " (x2,y2)", :black, :left, :vcenter)
       point(股, 0, "股", :black, :left, :bottom, delta=delta/2)
       point(0, 鈎, " 鈎", :black, :left, :bottom, delta=delta/2)
       point(r, a, "(r,a)", :red, :center, delta=-delta/2)
       point(b, 20 + r, "(b,20+r)", :red, :center, delta=-delta/2)
   end
end;

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

万博の縮小延期ではなく,中止せよ

2024年01月05日 | 雑感

吉村知事、万博の縮小延期を否定 能登地震との「二者択一でない」 2024/01/04 15:56共同通信https://news.goo.ne.jp/article/kyodo_nor/politics/kyodo_nor-2024010401000831.html

吉村知事の発言に対して、万博の縮小延期を否定する姿勢に疑問が残る。

まず、吉村知事が「能登半島地震の影響で縮小や延期をする可能性を否定した」と発言しているが、この主張には十分な説明や根拠が欠如している。能登半島地震がもたらす影響を具体的に検証し、それに基づいてなぜ縮小や延期が不要であると結論づけているのかについて、より詳細な情報が求められる。

また、「二者択一の関係ではない。万博があるから(復興の)費用が削減されるものではない」との発言も疑問を呼び起こす。吉村知事はなぜ、万博の開催と災害復興の費用には直接の因果関係がないと断言できるのか、その理由や具体的な根拠についての説明が必要だ。災害復興に使われるべき財源が万博に流用される可能性はないのか、十分な検証が求められる。

さらに、吉村知事は「被災地の救助活動や復興支援については国と自治体が全力でやるべきである」と主張しているが、それが万博の開催にどのように影響するかについてもっと具体的に説明されるべきだ。万博の成功に向けた勝負の年とされる中、ほんとうにそれほどの期待が寄せられているのか、その背景や具体的な計画についての情報が不足している。

総じて、吉村知事の発言には論理的な説明や具体的な根拠が欠如しており、災害と万博の関連性やリスクについて十分な説明が必要だ。

猛省と方針変換を望む。

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

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

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