裏 RjpWiki

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

算額(その98)

2023年01月13日 | Julia

算額(その98)

以下の解は不適切。「改訂版を参照のこと。

東京都渋谷区渋谷 金王八幡神社 安政6年(1859)4月
http://www.wasan.jp/tokyo/konnou2.html

金王八幡宮③「宝物館」(渋谷散歩③)
https://wheatbaku.exblog.jp/30049403/

参照先の画像では問題文が全く読めない。外円の半径を 1 として,方程式は 3 本立てられるが,条件が一つ足りない。
下図において,両脇の小円の中心の y 座標が小円の直径に等しいとすれば解が得られる。

using SymPy
@syms r1::positive, r2::positive, x::positive, y::positive, y2::positive;
y2 = 2(r1 + r2) - 1  # 外円の中心
y = 2r1  # 追加する条件
eq1 = x^2 + (2r1 + r2 - y)^2 - (r1 + r2)^2;
eq2 = x^2 + (y2 - y)^2 - (1 - r1)^2;
eq3 = x^2 + y^2 - 9r1^2;
solve([eq1, eq2, eq3], (r1, r2, x))

   1-element Vector{Tuple{Sym, Sym, Sym}}:
    (3/10, 3/5, 3*sqrt(5)/10)

using Plots

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

function point(x, y, string="", color=:green, position=:left, vertical=:top; mark=true)
   mark && scatter!([x], [y], color=color, markerstrokewidth=0)
   annotate!(x, y, text(string, 10, position, color, vertical))
end;

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

function draw(more=false)
    pyplot(size=(500, 500), grid=false, aspectratio=1, label="")#, fontfamily="IPAMincho")
   @syms r1::positive, r2::positive, x::positive, y::positive, y2::positive;
   (r1, r2, x) = (3/10, 3/5, 3*sqrt(5)/10)
   y2 = 2(r1 + r2) - 1
   y = 2r1
   println("r1 = $r1;  r2 = $r2;  x = $x;  y = $y")
    plot()
    circle(0, y2, 1, :green)
    circle(0, r1, r1, :magenta)
    circle(x, y, r1, :magenta)
    circle(-x, y, r1, :magenta)
    circle(0, 2r1 + r2, r2, :brown)
    circle(0, 0, 2r1, :blue, beginangle=0, endangle=180)
    segment(-2r1, 0, 2r1, 0, :blue)
    if more
        point(0, 2r1, "2r1 ", :brown, :right)
        point(0, 2r1+r2, "2r1+r2 ", :brown, :right)
        point(0, r1, "r1 ", :magenta, :right)
        point(x, y, "(x,y)", :magenta, :top)
       point(0, 2(r1 + r2) - 1, "y2 ", :green, :right)
        hline!([0, 2r1], color=:black, lw=0.5)
        vline!([0], color=:black, lw=0.5)
    end
end;

   r1 = 0.3;  r2 = 0.6;  x = 0.6708203932499369;  y = 0.6

 

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

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

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