裏 RjpWiki

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

算額(その766)

2024年03月08日 | Julia

算額(その766)

山形県七日町 長源寺観音堂 大正4年(1915)
http://www.wasan.jp/yamagata/chogenji.html

3 個の甲円が交わり,上の甲円には上の甲円に内接し下の2個の甲円に外接する正方形を入れ,下の甲円には上の甲円に外接し,下の甲円に内接する乙円と,乙円と上の甲円に外接し下の甲円に内接する丙円を入れる。それぞれの大きさを求めよ。

甲円の半径と中心座標を r1, (0, r1), (r1, 0)
乙円の半径と中心座標を r2, (x2, y2)
丙円の半径と中心座標を r3, (x3, y3)
正方形の一辺の長さを a
として,以下の連立方程式を r1 を未知数のままとして解く。

一度に解いてもよいが,乙円・丙円をいれるのと正方形をいれるのは独立なので,まずは乙円と丙円を甲円に入れる。

include("julia-source.txt");

using SymPy
@syms r1::positive, r2::positive, x2::positive, y2::negative,
     r3::positive, x3::positive, y3::positive
y2 = r1 - x2
eq1 = (x2 - r1)^2 + y2^2 - (r1 - r2)^2
eq2 = x2^2 + (r1 - y2)^2 - (r1 + r2)^2
eq3 = (x3 - r1)^2 + y3^2 - (r1 - r3)^2
eq4 = (x2 - x3)^2 + (y3 - y2)^2 - (r2 + r3)^2
eq5 = x3^2 + (r1 - y3)^2 - (r1 + r3)^2
solve([eq1, eq2, eq3, eq4, eq5], (r2, x2, r3, x3, y3))

   1-element Vector{NTuple{5, Sym{PyCall.PyObject}}}:
    (sqrt(2)*r1/2, r1*(1 + sqrt(2))/2, sqrt(2)*r1/6, r1*(1 + sqrt(2))/2, r1*(sqrt(2)/6 + 1/2))

右下の甲円の円周上に (sx, sy) を取り,sx = a/2 かつ (sx, sy + a ) が上の甲円の円周上にあるような sx, sy を求める。

@syms a::positive, sx::positive, sy::positive
a = 2sx
eq6 = (sx - r1)^2 + sy^2 - r1^2
eq7 = sx^2 + (sy + a - r1)^2 - r1^2
solve([eq6, eq7], (sx, sy))

   1-element Vector{Tuple{Sym{PyCall.PyObject}, Sym{PyCall.PyObject}}}:
    (r1/2, sqrt(3)*r1/2)

まとめると,乙円,丙円の直径はそれぞれ甲円の直径の √2/2,√2/6 倍であり,正方形の一辺の長さは甲円の半径に等しい。

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

甲円の直径 = 1;  乙円の直径 = 0.707107;  丙円の直径 = 0.235702;  正方形の一辺の長さ = 0.5
   r1 = 0.5;  a = 0.5;  r2 = 0.353553;  x2 = 0.603553;  y2 = -0.103553;  r3 = 0.117851;  x3 = 0.603553;  y3 = 0.367851

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r1 = 1//2
   (r2, x2, r3, x3, y3) = (sqrt(2)/4, 1/4 + sqrt(2)/4, sqrt(2)/12, 1/4 + sqrt(2)/4, sqrt(2)/12 + 1/4)
   y2 = r1 - x2
   (sx, sy) = (1/4, sqrt(3)/4)
   a = 2sx
   @printf("甲円の直径 = %g;  乙円の直径 = %g;  丙円の直径 = %g;  正方形の一辺の長さ = %g\n", 2r1, 2r2, 2r3, a)
   @printf("r1 = %g;  a = %g;  r2 = %g;  x2 = %g;  y2 = %g;  r3 = %g;  x3 = %g;  y3 = %g\n", r1, a, r2, x2, y2, r3, x3, y3)
   plot([sx, sx, -sx, -sx, sx], [sy, sy + a, sy + a, sy, sy], color=:green, lw=0.5)
   circle(0, r1, r1, :blue)
   circle2(r1, 0, r1, :blue)
   circle2(x2, y2, r2)
   circle2(x3, y3, r3, :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(0, r1, "甲円:r1,(0,r1)", :blue, :center, :bottom, delta=delta)
       point(r1, 0, "甲円:r1,(r1,0)", :blue, :center, :bottom, delta=delta)
       point(x2, y2, "乙円:r2,(x2,y2)", :red, :center, :bottom, delta=delta)
       point(x3, y3, " 丙円:r3,(x3,y3)", :black, :center, delta=-delta/2)
       point(sx, sy, "(sx,sy)", :green, :left, delta=-delta/2)
       point(sx, sy + a, " (sx,sy+a)", :green, :left, :vcenter)
   end
end;

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

算額(その765)

2024年03月08日 | Julia

算額(その765)

山形県七日町 長源寺観音堂 大正4年(1915)
http://www.wasan.jp/yamagata/chogenji.html

外円の中に2本の斜線と大円,中円,小円を入れる。中円の直径が与えられたとき,小円の直径を求めよ。

外円の半径と中心座標を R, (0, 0)
大円の半径と中心座標を r1, (0, r1 - R)
中円の半径と中心座標を r2, (0, r2 - R)
小円の半径と中心座標を r3, (x3, y3), (0, 2r1 - R - r3)
斜線と外円の交点座標を (x0, y0); y0 =-sqrt(R^2 - x0^2)
とおき,以下の連立方程式を解く。

include("julia-source.txt");

using SymPy
@syms R::positive, r1::positive, r2::positive,
     r3::positive, x3::positive, y3::positive,
     x0::positive, y0::positive
y0 = -sqrt(R^2 - x0^2)
eq1 = x3^2 + (y3 - r1 + R)^2 - (r1 - r3)^2
eq2 = dist(0, R, x0, y0, 0, 2r1 - R - r3) - r3^2
eq3 = dist(0, R, x0, y0, x3, y3) - r3^2
eq4 = dist(0, R, x0, y0, 0, r2 - R) - r2^2
eq5 = dist(0, R, x0, y0, 0, r1 - R) - (r1 - 2r3)^2
eq6 = r2/(2R - r2) - x0/sqrt((R - y0)^2 + x0^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 Float64.(v), r.f_converged
end;

function H(u)
   (R, r1, r3, x3, y3, x0) = u
   t = (-R - sqrt(R^2 - x0^2))
   u = (-2*R + 2*r1 - r3)
   v = (x0^2 + t^2)
   w = -2*R + r1
   x = -R + y3
   y = -2*R + r2
   return [
       x3^2 - (r1 - r3)^2 + (R - r1 + y3)^2,  # eq1
       -r3^2 + x0^2*t^2*u^2/v^2 + (-2*R + 2*r1 - r3 - t^2*u/v)^2,  # eq2
       -r3^2 + (-x0*(x0*x3 + x*t)/v + x3)^2 + (x - t*(x0*x3 + x*t)/v)^2,  # eq3
       -r2^2 + x0^2*y^2*t^2/v^2 + (y - y*t^2/v)^2,  # eq4
       x0^2*w^2*t^2/v^2 - (r1 - 2r3)^2 + (w - w*t^2/v)^2,  # eq5
       r2/(2R - r2) - x0/sqrt(x0^2 + (R + sqrt(R^2 - x0^2))^2),  # eq6
   ]
end;

r2 = 25
iniv = BigFloat[50, 40, 12, 30, 10, 32]
res = nls(H, ini=iniv)

   ([50.39121365997017, 40.15575464114408, 10.077756774346838, 28.39419413598576, -0.3129747007225315, 31.386069651197772], true)

中円の半径が 25 のとき,小円の半径は 10.077756774346838 である。

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

外円の直径 = 100.782;  大円の直径 = 80.3115;  中円の直径 = 50;  小円の直径 = 20.1555
   R = 50.3912;  r1 = 40.1558;  r2 = 25;  r3 = 10.0778;  x3 = 28.3942;  y3 = -0.312975;  x0 = 31.3861;  y0 = -39.4232

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r2 = 25
   (R, r1, r3, x3, y3, x0) = res[1]
   y0 = -sqrt(R^2 - x0^2)
   @printf("外円の直径 = %g;  大円の直径 = %g;  中円の直径 = %g;  小円の直径 = %g\n", 2R, 2r1, 2r2, 2r3)
   @printf("R = %g;  r1 = %g;  r2 = %g;  r3 = %g;  x3 = %g;  y3 = %g;  x0 = %g;  y0 = %g\n",
       R, r1, r2, r3, x3, y3, x0, y0)
   plot()
   circle(0, 0, R, :magenta)
   circle(0, r1 - R, r1)
   circle(0, r2 - R, r2, :blue)
   circle2(x3, y3, r3, :green)
   circle(0, 2r1 - R - r3, r3, :green)
   segment(0, R, x0, y0, :orange)
   segment(0, R, -x0, y0, :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(0, r1 - R, " 大円:r1\n (0,r1-R)", :red, :left, :vcenter)
       point(0, r2 - R, " 中円:r2\n (0,r2-R)", :blue, :left, :vcenter)
       point(0, 2r1 - R - r3, "小円:r3\n(0,2r1-R-r3)", :green, :center, :bottom, delta=delta/2)
       point(x3, y3, "小円:r3\n(x3,y3)", :green, :center, :bottom, delta=delta/2)
       point(R, 0, " R", :magenta, :left, :bottom, delta=delta/2)
       point(x0, y0, " (x0,y0)")
   end
end;

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

算額(その764)

2024年03月08日 | Julia

算額(その764)

山形県七日町 長源寺観音堂 大正4年(1915)
http://www.wasan.jp/yamagata/chogenji.html

楕円の中に大円(半円)と,中円,小円をいれる。中円,小円の直径が与えられたとき,大円の直径を求めよ。

楕円の長半径と短半径および中心座標を a, b, (0, 0)
大円の半径と中心座標を r0, (0, 2r2 ‐ b)
中円の半径と中心座標を r1, (a - r1, 0)
小円の半径と中心座標を r2, (0, r2 - b)
とおき,以下の連立方程式を解く。

簡単な連立方程式に見えるが,solve() では解けない。

include("julia-source.txt");

using SymPy
@syms a::positive, b::positive,
     r0::positive, r1::positive, r2::positive
@syms a, b, r0, r1, r2
eq1 = r0^2/a^2 + (2r2 - b)^2/b^2 - 1
eq2 = (a - r1)^2 + (2r2 - b)^2 - (r0 + r1)^2
eq3 = r0 + 2r2 - 2b;

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 Float64.(v), r.f_converged
end;

function H(u)
   (a, b, r0) = u
   return [
       -1 + (-b + 2*r2)^2/b^2 + r0^2/a^2,  # eq1
       (a - r1)^2 + (-b + 2*r2)^2 - (r0 + r1)^2,  # eq2
       -2*b + r0 + 2*r2,  # eq3
   ]
end;

(r1, r2) = (3, 2)
iniv = BigFloat[22, 11, 17]
res = nls(H, ini=iniv)

   ([22.21485637843628, 10.669764855602098, 17.339529711204197], true)

中円,小円の直径が 6 寸,4 寸のとき,大円の直径は 34.67905942240839 寸である。

術では「置小圓径三之加中圓径倍」とあるが,正しいものではない。そもそも,中円,小円の直径にかかわらず「三」を加えるのはあきらかにおかしい。

2*17.339529711204197

   34.67905942240839

その他のパラメータは以下のとおりである。
大円の直径 = 34.6791;  中円の直径 = 6;  小円の直径 = 4
r1 = 3;  r2 = 2;  a = 22.2149; b = 10.6698; r0 = 17.3395

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (r1, r2) = (3, 2)
   (a, b, r0) = res[1]
   @printf("大円の直径 = %g;  中円の直径 = %g;  小円の直径 = %g\n", 2r0, 2r1, 2r2)
   @printf("r1 = %g;  r2 = %g;  a = %g; b = %g; r0 = %g\n", r1, r2, a, b, r0)
   plot()
   ellipse(0, 0, a, b, color=:blue)
   circle(0, 2r2 - b, r0, beginangle=0, endangle=180)
   circle2(a - r1, 0, r1, :magenta)
   circle(0, r2 - b, r2, :green)
   segment(-r0, 2r2 - b, r0, 2r2 - b, :red)
   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", :blue, :left, :bottom, delta=delta/2)
       point(a - r1, 0, "a-r1", :blue, :center, :bottom, delta=delta/2)
       point(0, -b, " -b", :blue, :left, :bottom, delta=delta/2)
       point(0, r2 - b, " r2-b", :blue, :left, :bottom, delta=delta/2)
       point(0, 2r2 - b, " 2r2-b", :red, :left, :bottom, delta=delta/2)
   end
end;

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

算額(その763)

2024年03月08日 | Julia

算額(その763)

山形県七日町 長源寺観音堂 大正4年(1915)
http://www.wasan.jp/yamagata/chogenji.html

外円内に,甲円,乙円,丙円が入っている。乙円の直径が与えられたとき,丙円の直径を求めよ。

引用元の画像では乙円と甲円の関係が不明瞭であるが,図のように,乙円は下部の 2 個の甲円に外接し,外円に内接しているものと思われる。
外円の半径と中心座標を R, (0, 0)
甲円の半径と中心座標を r1, (0, 3r1 - R), (r1, y1); y1 = 4r1 - R
乙円の半径と中心座標を r2, (x2, 2r1 - R)
丙円の半径と中心座標を r3, (0, R - r3)
とおき,以下の連立方程式を解く。

include("julia-source.txt");

using SymPy
@syms R::positive, r1::positive, y1::positive,
     r2::positive, x2::positive, r3::positive
y1 = 4r1 - R
eq1 = r1^2 + y1^2 - (R - r1)^2
eq2 = x2^2 + r1^2 - (r1 + r2)^2
eq3 = x2^2 + (2r1 - R)^2 - (R - r2)^2
eq4 = r1^2 + (R - r3 - y1)^2 - (r1 + r3)^2
res = solve([eq1, eq2, eq3, eq4], (R, r1, x2, r3))

   1-element Vector{NTuple{4, Sym{PyCall.PyObject}}}:
    (44*r2/15, 11*r2/10, 4*sqrt(5)*r2/5, 44*r2/105)

丙円の直径は乙円の直径の 44/105 倍である。

術は一部文字が不鮮明であるが「置四拾四個
一百▢除乗乙圓径得丙▢径」と読めるので,「乙円は下部の 2 個の甲円に外接し,外円に内接している」という解釈で間違いなさそうである。

その他,外円の直径は 44/15 倍,甲円の直径は 4√5/5 倍である。

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

   乙円の直径 = 105;  丙円の直径 = 44
   R = 154;  r1 = 57.75;  x2 = 93.9149;  r3 = 22

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r2 = 105//2
   (R, r1, x2, r3) = (44*r2/15, 11*r2/10, 4*sqrt(5)*r2/5, 44*r2/105)
   y1 = 4r1 - R
   @printf("乙円の直径 = %g;  丙円の直径 = %g\n", 2r2, 2r3)
   @printf("R = %g;  r1 = %g;  x2 = %g;  r3 = %g\n", R, r1, x2, r3)
   plot()
   circle(0, 0, R, :blue)
   circle2(r1, y1, r1)
   circle(0, 3r1 - R, r1)
   circle(0, r1 - R, r1)
   circle2(x2, 2r1 - R, r2, :green)
   circle(0, R - r3, r3, :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", :blue, :left, :bottom, delta=delta/2)
       point(0, r1 - R, " r1-R", :red, :left, :vcenter)
       point(0, 3r1 - R, "甲円:r1,(0,3r1-R)", :red, :center, delta=-delta)
       point(r1, 4r1 - R, "甲円:r1,(r1,4r1-R)", :red, :center, :bottom, delta=delta)
       point(x2, 2r1 - R, "乙円:r2,(x2,2r1-R)", :green, :center, delta=-delta)
       point(0, R - r3, "丙円:r3,(0,R-r3)", :black, :center, :bottom, delta=delta)
   end
end;

 

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

算額(その762)

2024年03月08日 | Julia

算額(その762)

山形県新庄市 戸沢神社 文政元年(1818)
http://www.wasan.jp/yamagata/tozawa.html

円弧内に斜線2本を入れ,区分された領域に甲円,乙円 2 個ずつを入れる。矢の長さが与えられたときに甲円の径を求めよ。

矢の長さを「矢」
円弧を構成する円の半径と中心座標を R, (0, 0)
甲円の半径と中心座標を r1, (x1, y1); y1 = 矢/2 + (R - 矢)
乙円の半径と中心座標を r2, (0, R - r2), (0, R - 矢 + r2)
斜線と円弧の交点座標を (sqrt(R^2 - y0^2), y0), (sqrt(R^2 - (R - 矢)^2), R - 矢)
とおき,以下の連立方程式を解く。

include("julia-source.txt");

using SymPy
@syms R::positive, r1::positive, x1::positive, y1::positive,
     r2::positive, x0::positive, y0::positive, 矢::positive
y1 = 矢/Sym(2) + (R - 矢)
eq1 = x1^2 + y1^2 - (R - r1)^2
eq2 = dist(sqrt(R^2 - (R - 矢)^2), R - 矢, -x0, y0, x1, y1) - r1^2
eq3 = dist(-sqrt(R^2 - (R - 矢)^2), R - 矢, x0, y0, x1, y1) - r1^2
eq4 = dist(-sqrt(R^2 - (R - 矢)^2), R - 矢, x0, y0, 0, R - 矢 + r2) - r2^2
eq5 = dist(-sqrt(R^2 - (R - 矢)^2), R - 矢, x0, y0, 0, R - r2) - r2^2
eq6 = x0 - sqrt(R^2 - y0^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 Float64.(v), r.f_converged
end;

function H(u)
   (R, r1, x1, r2, x0, y0) = u
   return [
x1^2 - (R - r1)^2 + (R - 矢/2)^2,  # eq1
-r1^2 + (矢/2 - (矢*(-R + y0 + 矢)/2 + (-x0 - sqrt(R^2 - (R - 矢)^2))*(x1 - sqrt(R^2 - (R - 矢)^2)))*(-R + y0 + 矢)/((-x0 - sqrt(R^2 - (R - 矢)^2))^2 + (-R + y0 + 矢)^2))^2 + (x1 - sqrt(R^2 - (R - 矢)^2) - (-x0 - sqrt(R^2 - (R - 矢)^2))*(矢*(-R + y0 + 矢)/2 + (-x0 - sqrt(R^2 - (R - 矢)^2))*(x1 - sqrt(R^2 - (R - 矢)^2)))/((-x0 - sqrt(R^2 - (R - 矢)^2))^2 + (-R + y0 + 矢)^2))^2,  # eq2
-r1^2 + (矢/2 - (矢*(-R + y0 + 矢)/2 + (x0 + sqrt(R^2 - (R - 矢)^2))*(x1 + sqrt(R^2 - (R - 矢)^2)))*(-R + y0 + 矢)/((x0 + sqrt(R^2 - (R - 矢)^2))^2 + (-R + y0 + 矢)^2))^2 + (x1 + sqrt(R^2 - (R - 矢)^2) - (x0 + sqrt(R^2 - (R - 矢)^2))*(矢*(-R + y0 + 矢)/2 + (x0 + sqrt(R^2 - (R - 矢)^2))*(x1 + sqrt(R^2 - (R - 矢)^2)))/((x0 + sqrt(R^2 - (R - 矢)^2))^2 + (-R + y0 + 矢)^2))^2,  # eq3
-r2^2 + (r2 - (r2*(-R + y0 + 矢) + sqrt(R^2 - (R - 矢)^2)*(x0 + sqrt(R^2 - (R - 矢)^2)))*(-R + y0 + 矢)/((x0 + sqrt(R^2 - (R - 矢)^2))^2 + (-R + y0 + 矢)^2))^2 + (sqrt(R^2 - (R - 矢)^2) - (x0 + sqrt(R^2 - (R - 矢)^2))*(r2*(-R + y0 + 矢) + sqrt(R^2 - (R - 矢)^2)*(x0 + sqrt(R^2 - (R - 矢)^2)))/((x0 + sqrt(R^2 - (R - 矢)^2))^2 + (-R + y0 + 矢)^2))^2,  # eq4
-r2^2 + (sqrt(R^2 - (R - 矢)^2) - (x0 + sqrt(R^2 - (R - 矢)^2))*(sqrt(R^2 - (R - 矢)^2)*(x0 + sqrt(R^2 - (R - 矢)^2)) + (-r2 + 矢)*(-R + y0 + 矢))/((x0 + sqrt(R^2 - (R - 矢)^2))^2 + (-R + y0 + 矢)^2))^2 + (-r2 + 矢 - (sqrt(R^2 - (R - 矢)^2)*(x0 + sqrt(R^2 - (R - 矢)^2)) + (-r2 + 矢)*(-R + y0 + 矢))*(-R + y0 + 矢)/((x0 + sqrt(R^2 - (R - 矢)^2))^2 + (-R + y0 + 矢)^2))^2,  # eq5
x0 - sqrt(R^2 - y0^2),  # eq6
   ]
end;

矢 = 40
iniv = BigFloat[28.5, 7, 15.9, 6.4, 17, 22.9] .* 矢/28
res = nls(H, ini=iniv)

   ([44.26217677053205, 10.0, 24.191807196045545, 9.531899446242074, 25.79218891003677, 35.97086715238879], true)

甲円の直径は矢の半分である。

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

   甲円の直径 = 20;  乙円の直径 = 19.0638;  矢 = 40
   R = 44.2622;  r1 = 10;  x1 = 24.1918;  y1 = 24.2622;  r2 = 9.5319;  x0 = 25.7922;  y0 = 35.9709

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   矢 = 40
   (R, r1, x1, r2, x0, y0) = res[1]
   y1 =  矢/2 + (R - 矢)
   @printf("甲円の直径 = %g;  乙円の直径 = %g;  矢 = %g\n", 2r1, 2r2, 矢)
   @printf("R = %g;  r1 = %g;  x1 = %g;  y1 = %g;  r2 = %g;  x0 = %g;  y0 = %g\n", R, r1, x1, y1, r2, x0, y0)
   θ = atand(R - 矢, sqrt(R^2 - (R - 矢)))
   plot()
   circle(0, 0, R, :blue, beginangle=θ, endangle=180-θ, n=10000)
   circle2(x1, y1, r1)
   circle(0, R - r2, r2, :green)
   circle(0, R - 矢 + r2, r2, :green)
   segment(-sqrt(R^2 - (R - 矢)^2), R - 矢, sqrt(R^2 - (R - 矢)^2), R - 矢)
   segment(-sqrt(R^2 - (R - 矢)^2), R - 矢, sqrt(R^2 - y0^2), y0)
   segment(sqrt(R^2 - (R - 矢)^2), R - 矢, -sqrt(R^2 - y0^2), y0)
   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-矢", :black, :center, delta=-delta/2)
       point(x1, y1, " 甲円:r1\n (x1,y1)", :red, :center, delta=-delta/2)
       point(0, R - 矢 + r2, " 乙円:r2\n (0,R-矢+r2)", :green, :center, delta=-delta)
       point(0, R - r2, " 乙円:r2\n (0,R-r2)", :green, :center, :bottom, delta=delta)
       point(-sqrt(R^2 - (R - 矢)^2), R - 矢)
       point(R, R - 矢, "(R,R-矢)", :blue, :right, delta=-delta)
   end
end;

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

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

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