算額(その15)
岩手県東磐井郡川崎村 浪分神社 年代不詳(文久か)
http://www.wasan.jp/iwate/namiwake5.html
岩手県陸前高田市気仙町 今泉諏訪神社慶応 4 年
http://www.wasan.jp/iwate/suwa.html
下図のように,半径 1 の円の中に 2 種類の円がありそれぞれ接している。それぞれの円の半径を求めよ。
紙と鉛筆でも求めることができる。
小さい円の半径は r2 = 1/5 である。大きい円の半径は r1 = 3*r2。右の小さい円の中心を (x, ±r2) とする。
using SymPy
@syms x::positive;
r2 = 1//5
r1 = 3r2
eq1 = x^2 + r2^2 - (1 - r2)^2
eq1 |> expand |> println
x^2 - 3/5
solve(eq1, x)[1] |> println # x について解く
sqrt(15)/5
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=:center)
scatter!([x], [y], color=color, markerstrokewidth=0)
annotate!(x, y, text(string, 10, position, color, vertical))
end;
function draw(more=false)
pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
x = sqrt(15)/5
r2 = 1/5
r1 = 3r2
println("r2 = $r2, x = $x")
plot()
circle(0, 2r2, 3r2, :blue)
circle(0, -2r2, 3r2, :blue)
circle( x, r2, r2, :green)
circle( x, -r2, r2, :green)
circle(-x, r2, r2, :green)
circle(-x, -r2, r2, :green)
circle( 0, 0, r2, :green)
if more
hline!(-1:r2:1, linewidth=0.1)
point(x, r2, "(x,r2)\n", :green, :center, :bottom)
plot!([0, x], [0, r2], linewidth=0.5, linestyle=:dash)
end
circle(0, 0, 1)
end;