裏 RjpWiki

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

算額(その86)

2022年12月29日 | Julia

算額(その86)

福島県田村郡三春町平沢担橋 諏訪神社 大正15年(1926)8月
http://www.wasan.jp/fukusima/miharusuwa.html

中村信弥「改訂増補 長野県の算額」
http://www.wasan.jp/zoho/zoho.html
県内の算額
長野県松本市筑摩 筑摩神社 明治6年(1873)
と同じ(求めるものが違うだけ)

外円の中に「圭」と径が 3 寸の等円が 3 個入っている。外円の径を求めよ。

「圭」とは図のような細長い二等辺三角形のことである。

外接円の半径 R だけならば公式で簡単に求めることができる。等円の半径を r とすれば,内接する三角形の各辺の中点から外接円までの距離(「矢」という)を a', b', c' とすると,

a' + b' + c' = 2R - r … (1)
2a'b'c' = r^2R … (2)

a' = c' = 2r
b' = 2R - 5r

(2) に代入して
8 * r^2 * (2R - 5r) = r^2 * R
これより R が求まる。

using SymPy

@syms R::positive, x::positive, y::positive;
r = 3//2
eq0 = 8*r^2*(2R-5r) - (r^2)*R;

solve(eq0, R) |> println

   Sym[4]

R = 4 である。

次に,点 C の x 座標を求める。y 座標は 1/2 - R で,外接円の円周上にあるので以下を解く。

@syms x1
solve(x1^2 + (1//2-4)^2 - 16) |> println

   Sym[-sqrt(15)/2, sqrt(15)/2]

C は (sqrt(15)/2, 1/2-R), A は (-sqrt(15)/2, 1/2-R) である。

最後に,右の等円の中心座標を求める。外円に接することと,原点から (x, y) を結ぶ直線と BC が直交することから以下の 2 式を得る。

@syms x, y
R, r = 4, 3//2
eq1 = x^2 + y^2 - (R - r)^2;
eq2 = y/x * (4-1//2+R)/(sqrt(Sym(15))//2) - 1;

solve([eq1, eq2], (x, y))

   2-element Vector{Tuple{Sym, Sym}}:
    (-5*sqrt(15)/8, -5/8)
    (5*sqrt(15)/8, 5/8)

x 座標は 5*sqrt(15)/8, y 座標は 5/8 である。

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; fontsize=10, mark=true)
  mark && scatter!([x], [y], color=color, markerstrokewidth=0)
  annotate!(x, y, text(string, fontsize, vertical, position, color))
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")
   r = 3/2
   (R, x) = (4, 2)
   plot()
   circle(0, 0, R)
   circle(5*sqrt(15)/8, 5/8, r, :blue)
   circle(-5*sqrt(15)/8, 5/8, r, :blue)
   circle(0, -R+1/2+r, r, :green)
   segment(0, R, -sqrt(15)/2, 1/2-R)
   segment(0, R, sqrt(15)/2, 1/2-R)
   segment(-sqrt(15)/2, 1/2-R, sqrt(15)/2, 1/2-R)
   if more
       hline!([0], color=:black, lw=0.5)
       vline!([0], color=:black, lw=0.5)
       point(sqrt(15)/2, 1/2-R, " C", :red)
       point(-sqrt(15)/2, 1/2-R, "A ", :red, :right)
       point(0, R, "  B", :red, :bottom)
       segment(0, -R, 0, 1/2-R, :magenta)
       point(0, 1/4-R, "  b'", :magenta, :top, :left, mark=false)
       point(5*sqrt(15)/8, 5/8, "(x, y)", :blue)
   end
end;

 

 

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

算額(その85)

2022年12月29日 | Julia

算額(その85)

福島県田村郡三春町平沢担橋 諏訪神社 大正15年(1926)8月
http://www.wasan.jp/fukusima/miharusuwa.html

交差する 2 個の外円の中に,甲円 3 個,乙円 2 個が入っている。乙円の径が 1 寸のとき,甲円の径はいくつか。

甲円の半径を r として方程式を解く。


using SymPy

@syms r::positive;
eq1 = (r + 1//2)^2 + r^2 - (2r - 1//2)^2
solve(eq1)[1] |> println

   3/2

甲円の径は 3 である。

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; fontsize=10, mark=true)
  mark && scatter!([x], [y], color=color, markerstrokewidth=0)
  annotate!(x, y, text(string, fontsize, vertical, position, color))
end;

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r = 3/2
   plot()
   circle(0, 0, r)
   circle(0, 2r, r)
   circle(0, -2r, r)
   circle(0, r, 2r, :blue)
   circle(0, -r, 2r, :blue)
   circle(r + 1/2, 0, 1/2, :green)
   circle(-r - 1/2, 0, 1/2, :green)
   if more
       point(0, 2r, "2r ", :red, :top, :right)
       point(0, r, "r ", :red, :top, :right)
       point(r, 0, "r ", :red, :top, :right)
       point(r+1, 0, "  r+1", :red, :top, :left)
       hline!([0], color=:black, lw=0.5)
       vline!([0], color=:black, lw=0.5)
   end
end;

 

 

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

算額(その84)

2022年12月29日 | Julia

算額(その84)

福島県田村郡三春町平沢担橋 諏訪神社 大正15年(1926)8月
http://www.wasan.jp/fukusima/miharusuwa.html

二本の線分に挟まれて,3個の円がある。大円,中円の径を 4, 2 としたとき,小円の径を求めよ。

大円,中円の半径を 2, 1 として,図のよう記号を定め方程式を解く。

using SymPy

@syms x1::positive, r1::positive, x2::positive, x3::positive;
eq1 = (x2 - x1)^2 + (1 - r1)^2 - (1 + r1)^2
eq2 = (x3 - x2)^2 + (2 - 1)^2 - (2 + 1)^2
eq3 = (2 - r1)/(x3 - x1) - (1 - r1)/(x2 - x1)
eq4 = r1/x1 - 1/x2
solve([eq1, eq2, eq3, eq4], (r1, x1, x2, x3))

   1-element Vector{NTuple{4, Sym}}:
    (1/2, sqrt(2), 2*sqrt(2), 4*sqrt(2))

小円の径は 1 である。

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; fontsize=10, mark=true)
  mark && scatter!([x], [y], color=color, markerstrokewidth=0)
  annotate!(x, y, text(string, fontsize, vertical, position, color))
end;

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (r1, x1, x2, x3) = (1/2, sqrt(2), 2*sqrt(2), 4*sqrt(2))
   println("小円の径(直径) = $(2r1)")
   plot()
   circle(x1, r1, r1)
   circle(x2, 1, 1, :blue)
   circle(x3, 2, 2, :green)
   hline!([0], color=:black, lw=0.5)
   θ = atan(2, x3)
   y = 6tan(2θ)
   plot!([0, 6], [0, y], color=:black, lw=0.5)
   if more
       point(x1, r1, "(x1,r1)", :red, :top, :center)
       point(x2, 1, "(x2,2)", :blue, :top, :center)
       point(x3, 2, "(x3,4)", :green, :top, :center)
       point(6, y, "(6, y)", :black)
   end
end;

   小円の径(直径) = 1.0

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

算額(その83)

2022年12月29日 | Julia

算額(その83)

福島県田村郡三春町平沢担橋 諏訪神社 大正15年(1926)8月
http://www.wasan.jp/fukusima/miharusuwa.html

股が六寸の直角三角形に円が 6 個収まっている。鉤の長さはいくつか。

等円の半径を r, 鉤を x とする。上の円と右の円の中心から弦への距離が r であるとして方程式を解く。

using SymPy

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))
end;

@syms x::positive, r::positive;
eq1 = distance(6, 0, 0, x, 7r, r) - r
eq2 = distance(6, 0, 0, x, r, 5r) - r 
solve([eq1, eq2], (r, x))

   4-element Vector{Tuple{Sym, Sym}}:
    (17/23 - sqrt(13)/23, 4)
    (sqrt(13)/23 + 17/23, 4)
    (-75*sqrt(2)*sqrt(14 - 3*sqrt(3))/2068 - 9*sqrt(6)*sqrt(14 - 3*sqrt(3))/1034 - 75*sqrt(3)/2068 + 1497/2068, 9/2 - 3*sqrt(3)/2)
    (-9*sqrt(6)*sqrt(3*sqrt(3) + 14)/1034 + 75*sqrt(3)/2068 + 75*sqrt(2)*sqrt(3*sqrt(3) + 14)/2068 + 1497/2068, 3*sqrt(3)/2 + 9/2)

2番目が適切な解である。鉤は 4 寸である。

(sqrt(13)/23 + 17/23, 4)  # r, x

   (0.8958935337158256, 4)

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; fontsize=10, mark=true)
  mark && scatter!([x], [y], color=color, markerstrokewidth=0)
  annotate!(x, y, text(string, fontsize, vertical, position, color))
end;

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (r, x) = (17/23 - sqrt(13)/23, 4)
   println("径(直径) = $(2r);  鉤 = $x")
   plot([0, 6, 0, 0], [0, 0, x, 0])
   for i in 0:3
       circle(i*2r + r, r, r)
   end
   for i in 0:2
       circle(r, i*2r + r, r)
   end
   point(r, 5r, "(r,5r)")
   point(7r, r, "(7r,r)")
   point(0, x, "   x", :green, :bottom)
   hline!([0, 2r, 4r, 6r], color=:black, lw=0.5)
   vline!([0, 2r, 4r, 6r, 8r], color=:black, lw=0.5)
end;

   径(直径) = 1.1647346716987834;  鉤 = 4

 

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

算額(その82)

2022年12月28日 | Julia

算額(その82)

福島県田村郡三春町平沢担橋 諏訪神社 大正15年(1926)8月
http://www.wasan.jp/fukusima/miharusuwa.html

直線の上に乙円と甲円が載り,その上に丙円が載っている。甲円,丙円の径をそれぞれ二寸,三寸としたとき,乙円の径を求めよ。

図のように記号を定め,r, x を求める。

using SymPy
@syms x::positive, r::positive;
eq1 = x^2 + (4 + r - 3)^2 - (r + 3)^2
eq2 = x^2 + 1 - (2 + 3)^2
solve([eq1, eq2], (r, x))

   1-element Vector{Tuple{Sym, Sym}}:
    (4, 2*sqrt(6))

丙円の径は 4 である。


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; fontsize=10, mark=true)
  mark && scatter!([x], [y], color=color, markerstrokewidth=0)
  annotate!(x, y, text(string, fontsize, vertical, position, color))
end;

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (r, x) = (4, 2*sqrt(6))
   plot()
   circle(0, 2, 2)
   circle(0, 4 + r, r, :green)
   circle(x, 3, 3, :blue)
   circle(-x, 3, 3, :blue)
   hline!([0], color=:black, lw=0.5)
   if more
       point(0, 4 + r, "丙円 \n4+r ", :green, :bottom, :right)
       point(0, 2, "甲円 \n2 ", :red, :bottom, :right)
       point(x, 3, "乙円 (x,3)", :blue, :top, :center)
       vline!([0], color=:black, lw=0.5)
   end
end;

 

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

算額(その81)

2022年12月28日 | Julia

算額(その81)

福島県船引町 蚕養国神社 明治24年(1891)2月
http://www.wasan.jp/fukusima/kogaikuni.html

台形の中に,正六角形,正三角形が入っている。大頭が 97 寸のとき,正三角形の辺の長さを求めよ。

正六角形の一辺の長さを2として,それぞれの点の座標を決定して行く。

図の a, c の座標まで決めればよい。大頭は 5,a, c の距離が正三角形の一辺の長さ 5/√3 である。

using SymPy
sqrt((5sqrt(Sym(3))/2-5sqrt(Sym(3))/3)^2+(5//2)^2) |> println  # a,c の距離

   5*sqrt(3)/3

算額では「大頭が 97 寸のとき」なので,97/sqrt(3) = 56.0029761113937 である。

算額の答え「置三個 開平方 以除大頭」は「3 の平方根で大頭を割る」ということである。

97/√3

   56.0029761113937

using Plots

function point(x, y, string="", color=:green, position=:left, vertical=:top; fontsize=10, mark=true)
  mark && scatter!([x], [y], color=color, markerstrokewidth=0)
  annotate!(x, y, text(string, fontsize, vertical, position, color))
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")
   plot(xlims=(-0.3, 6.2), ylims=(-0.3, 5.2))
   hline!([0], color=:black, lw=0.5)
   vline!([0], color=:black, lw=0.5)
   plot!([√3, 0, 0, √3, 2√3, 2√3, √3], [0, 1, 3, 4, 3, 1, 0], color=:blue, lw=0.5)
   plot!([0, 0, √3], [1, 0, 0])
   plot!([0, 0, √3], [3, 5, 4])
   segment(5√3/3, 0, 2√3, 1, :brown)
   segment(2√3, 3, 5√3/2, 5/2, :green)
   segment(2√3, 1, 5√3/2, 5/2, :red)
   segment(5√3/2, 5/2, 10√3/3, 0, :magenta)
   segment(5√3/2, 5/2, 10√3/3, 5/3, :blue)
   segment(10√3/3, 5/3, 10√3/3, 0, :cyan)
   if more
       point(0.05, 2.5, "大 \n\n\n頭 ", :black, :right, mark=false)
       point(5.9, 1.3, "小\n\n\n頭", :black, mark=false)
       point(5√3/2, 5/2, "   a:(5√3/2, 5/2)")
       point(5√3/3, 0, " c:5√3/3")
       point(10√3/3, 0, "  b:10√3/3")
       point(√3, 0, "√3")
       point(2√3, 1, "  (2√3, 1)")
       point(2√3, 3, "  (2√3, 3)")
       point(√3, 4, "  (√3, 4)")
       point(10√3/3, 5/3, " (10√3/3, 5/3)")
   end
end;

 

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

算額(その80)

2022年12月28日 | Julia

算額(その80)

福島県船引町 蚕養国神社 明治24年(1891)2月
http://www.wasan.jp/fukusima/kogaikuni.html

正三角形に内接する全円と大円,小円がある。小円の径が 3 寸のとき,全円の径はいくつか。

正三角形の一辺の長さを 1 とすると全円の半径 r0 は √3/3,大円の半径 r1 は √3/5である。小円の半径を r2,その中心座標を (x2, 2r1) として方程式を立て,x2, r2 を求める。

using SymPy
@syms x2::positive, r2::positive;
r1 = √Sym(3) / 5
r0 = √Sym(3) / 3
eq1 = x2^2 + r1^2 - (r1 + r2)^2
eq2 = x2^2 + (2r1 - r0)^2 - (r0 - r2)^2;
solve([eq1, eq2], (x2, r2))

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

r2 = sqrt(3)/10 が 3 寸ならば,全円の径は 3*r0/(sqrt(3)/10) = 10 寸である。

3*r0/(sqrt(Sym(3))/10) |> println

   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; fontsize=10, mark=true)
  mark && scatter!([x], [y], color=color, markerstrokewidth=0)
  annotate!(x, y, text(string, fontsize, vertical, position, color))
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")
   plot([-1, 1, 0, -1], [0, 0, √3, 0], color=:black, lw=0.5)
   r0 = √3/3
   r1 = √3/5
   (x2, r2) = (sqrt(15)/10, sqrt(3)/10)
   println("r0 = $r0;  r1 = $r1;  r2 = $r2;  3*r0/r2 = $(3r0/r2)")
   circle(0, r0, r0)
   circle(0, r1, r1, :green) 
   circle(0, 3r1, r1, :green) 
   circle(x2, 2r1, r2, :blue)
   circle(-x2, 2r1, r2, :blue)
   if more
       circle(0, 4r1, r1, :gray)
       point(0, √3/3, "r0 ", :red, :right)
       point(0, r1, "r1 ", :green, :right)
       point(0, 3r1, "3r1 ", :green, :right)
       point(x2, 2r1, "(x2,2r1)", :green, :top, :center)
       hline!([0], color=:black, lw=0.5)
       vline!([0], color=:black, lw=0.5)
   end
end;

   r0 = 0.5773502691896257;  r1 = 0.34641016151377546;  r2 = 0.17320508075688773;  3*r0/r2 = 10.0

 

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

算額(その79)

2022年12月27日 | Julia

算額(その79)

福島県田村郡田母神村(現・郡山市田村町)の馬頭観世音

今有如図大円, 内設弦, 容乾坤二円, 欲使黒積至多。
乾円径若干, 問得坤円径術如何。

外円の中に,乾円,坤円が入っている。黒い部分の面積が最大になるとき,坤円の径を乾円の径で表わせ。

90度回転させて,上半分を考える。外円の半径を 1 とし,2円の接点の x 座標を a とする。

using SymPy
@syms x::real, a::positive;

乾円方程式 = sqrt(1 - x^2)
乾円面積 = integrate(乾円方程式, (x, -1, a))
坤円面積 = ((a + 1)/2)^2*PI/2
黒面積 = 乾円面積 - 坤円面積

f = diff(黒面積, a)  # 導関数

using Plots
plot(f, aspectratio=:none, size=(400, 200))
hline!([0])
vline!([(16 - pi^2)/(pi^2 + 16)])

a0 = solve(f)[1]  # 導関数 = 0 を解く
a0 |> println

   (16 - pi^2)/(pi^2 + 16)

乾円径 = 1 + a0
坤円径 = 1 - a0
坤円径 / 乾円径 |> simplify |> println

   pi^2/16

using Plots

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

function polygon(x, y, color=:black)
   plot!(x, y, seriestype=:shape, fillcolor=color)
end;

function point(x, y, string="", color=:green, position=:left, vertical=:top; fontsize=10, mark=true)
   mark && scatter!([x], [y], color=color, markerstrokewidth=0)
   annotate!(x, y, text(string, fontsize, vertical, position, color))
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")
   a = (16 - pi^2)/(16 + pi^2)
   θ0 = acos(a)/pi*180
   θ = θ0:0.1:360-θ0
   x = cosd.(θ)
   y = sind.(θ)
   append!(x, a)
   append!(y, 0)
   plot()
   # segment(a, sqrt(1-a^2), a, -sqrt(1-a^2))
   if more
       polygon(y, -x, :black)
       circle(0, 0, 1, :black)
       circle(0, -(a-1)/2, (a+1)/2, :white, fill=true)
       circle(0, -(a+1)/2, (1-a)/2, :red)
       point(0, -(a-1)/2, "乾円", :blue, :center, mark=false)
       point(0, -(a+1)/2, "坤円", :red, :center, mark=false)
   else
       polygon(x, y, :black)
       circle(0, 0, 1, :black)
       circle((a-1)/2, 0, (a+1)/2, :white, fill=true)
       circle((a+1)/2, 0, (1-a)/2, :red)
       point(a, 0, "a", :black)
       plot!(ylims=(0, 1.05))
   end
end;

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

算額(その78)

2022年12月26日 | Julia

算額(その78)

福島県船引町 蚕養国神社 明治24年(1891)2月
http://www.wasan.jp/fukusima/kogaikuni.html

外円の中に 7 個の円が入っている。乙円の径が二寸のとき甲円の径はいくつか。

図のように記号を定め方程式を解く。

外円の半径を 1 とする。甲円の半径 r1 = 1/3,乙円の半径と中心座標を r2,(x2, r1+r2) とする。

using SymPy
@syms r1::positive, r2::positive, x2::positive;
r1 = 1//3
eq1 = x2^2 + (r1 - r2)^2 - (r1 + r2)^2
eq2 = x2^2 + (r1 + r2)^2 - (1 - r2)^2;
res = solve([eq1, eq2])

println(res)

   Dict{Any, Any}[Dict(r2 => 2/9, x2 => 2*sqrt(6)/9)]

r1 = 1/3, r2 = 2/9 ゆえ,r1 = 3/2 * r2。算額は,「置く一個五分 乗乙径 甲径を得る」という。和算では「一個五分」とは 1.5 = 3/2 を表すのだなあ。

r2 = 2 寸ならば,r1 = 3 寸。

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; fontsize=10, mark=true)
  mark && scatter!([x], [y], color=color, markerstrokewidth=0)
  annotate!(x, y, text(string, fontsize, vertical, position, color))
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")
   (r1, r2, x2) = (1/3, 2/9, 2*sqrt(6)/9)
   plot()
   circle(0, 0, 1, :black)
   circle(0, 0, r1, :green)
   circle(0, 1-r1, r1, :green)
   circle(0, r1-1, r1, :green)
   circle(x2, r1+r2, r2, :blue)
   circle(x2, -r1-r2, r2, :blue)
   circle(-x2, r1+r2, r2, :blue)
   circle(-x2, -r1-r2, r2, :blue)
   circle(1-r1, 0, r1, beginangle=270, endangle=450)
   circle(r1-1, 0, r1, beginangle= 90, endangle=270)
   segment(r1-1, r1, 1-r1, r1, :red)
   segment(r1-1, -r1, 1-r1, -r1, :red)
   if more
       println("甲円の径は $(3/2 * 2)")
       point(0, 0, " O")
       point(0, 1-r1, " 1-r1")
       point(r1, 0, " r1")
       point(x2, r1+r2, "(x2,r1+r2)", :magenta, :top)
       hline!([0], color=:black, lw=0.5)
       vline!([0], color=:black, lw=0.5)
   end
end;

   甲円の径は 3.0

 

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

算額(その77)

2022年12月26日 | Julia

算額(その77)

福島県船引町 蚕養国神社 明治24年(1891)2月
http://www.wasan.jp/fukusima/kogaikuni.html

正方形の中に 7 個の円が入っている。乙円の径が一寸二分のとき甲円の径はいくつか。

図のように記号を定め方程式を解く。

甲円の半径 r1 = 1/3,乙円の半径を r2 とする。

using SymPy
@syms r1::positive, r2::positive;
r1 = 1//3
eq1 = (1 - r2)^2 + r1^2 - (2r1 + r2)^2

$\left(1 - r_{2}\right)^{2} - \left(r_{2} + \frac{2}{3}\right)^{2} + \frac{1}{9}$

res = solve(eq1, r2)
println(res)

   Sym[1/5]

r1 = 1/3, r2 = 1/5 ゆえ,r1 = 5/3 * r2。算額の通り,「乙円の径を 5 倍して 3 で割る」。

r2 = 1.2 寸ならば,r1 = 2 寸。

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; fontsize=10, mark=true)
  mark && scatter!([x], [y], color=color, markerstrokewidth=0)
  annotate!(x, y, text(string, fontsize, vertical, position, color))
end;

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (r1, r2) = (1/3, 1/5)
   plot([-1, 1, 1, -1, -1], [-1, -1, 1, 1, -1], color=:black, lw=0.5)
   circle(0, 0, r1, :green)
   circle(0, 1-r1, r1, :green)
   circle(0, r1-1, r1, :green)
   circle(0, r1, 2r1, :blue)
   circle(0, -r1, 2r1, :blue)
   circle(1 - r2, 0, r2, :magenta)
   circle(r2 - 1, 0, r2, :magenta)
   if more
       println("甲円の直径 = $(5/3 *1.2)")
       point(0, 0, " O")
       point(0, 1-r1, " 1-r1")
       point(r1, 0, " r1")
       point(1-r2, 0, "1-r2 ", :magenta, :right)
       hline!([0], color=:black, lw=0.5)
       vline!([0], color=:black, lw=0.5)
   end
end;

    甲円の直径 = 2.0
コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする

算額(その76)

2022年12月26日 | Julia

算額(その76)

大阪府茨木市 井於神社 弘化3年(1846)
http://www.wasan.jp/osaka/iyo.html

一般の三角形において,辺の長い順に大斜,中斜,小斜という。それぞれが 4 寸,2 寸 7 分,1 寸 8 分であるとき,内接する円の径を求めよ。

図のように記号を定め方程式を解けば,半径は求まる。単位は「分」で表しておく。

using SymPy
@syms r::positive, s::positive, S::positive;
(大斜, 中斜, 小斜) = (40, 27, 18)
s = (大斜 + 中斜 + 小斜)//2
eq1 = (大斜 + 中斜 + 小斜)*r//2 - S
eq2 = sqrt(Sym(s) * (s - 大斜) * (s - 中斜) * (s - 小斜)) - S  # ヘロンの公式
solve([eq1, eq2])

   Dict{Any, Any} with 2 entries:
     S => 35*sqrt(527)/4
     r => 7*sqrt(527)/34

7*sqrt(527)/34 * 2  # 直径

   9.452668468557999

もとの単位では 9分4厘5毛である。算額では,径は 1寸7厘5毛となっている。

どちらが正しいか,図を描いて確かめると,得られた解で正しいようである。算額における三角形とは随分異なる。

BF = BE = a, CD = CF = b, AE = AD = c, ∠CAB = α, ∠ABC = β として,プログラム中で必要な座標を独自に計算する。

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; fontsize=10, mark=true)
  mark && scatter!([x], [y], color=color, markerstrokewidth=0)
  annotate!(x, y, text(string, fontsize, vertical, position, color))
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")
   (大斜, 中斜, 小斜) = (40, 27, 18)
   α = acos((小斜^2 + 大斜^2 - 中斜^2) / (2*小斜*大斜))
   β = acos((中斜^2 + 大斜^2 - 小斜^2) / (2*中斜*大斜))
   a = 中斜/2 + 大斜/2 - 小斜/2
   b = 中斜/2 - 大斜/2 + 小斜/2
   c = -中斜/2 + 大斜/2 + 小斜/2
   s = (大斜 + 中斜 + 小斜)/2
   S = sqrt(s * (s - 大斜) * (s - 中斜) * (s - 小斜))  # ヘロンの公式
   r = 2S/(大斜 + 中斜 + 小斜)
   plot([0, 大斜, 小斜*cos(α), 0], [0, 0, 小斜*sin(α), 0],
       lwd=0.25, linestyle=more ? :dot : :solid,
       xlims=(-3, 大斜+3), ylims=(-2, 小斜*sin(α)+1))
   circle(c, r, r)
   if more
       println("直径 = $(2r)")
       point(0, 0, "  α", :red, :bottom, :left, mark=false)
       point(大斜, 0, "β    ", :red, :bottom, :right, mark=false)
       segment(c, 0, c, r)
       point(c, r, " O", :black)
       point(c*cos(α), c*sin(α), "D   ", :red, :center, :right)
       segment(c*cos(α), c*sin(α), c, r)
       point(c, 0, "   E", :red, :top, :center)
       point(大斜 - a*cos(β), a*sin(β), "    F", :red, :center)
       segment(大斜 - a*cos(β), a*sin(β), c, r)
       point(0, 0, "A ", :black, :right)
       point(大斜, 0, " B", :black)
       point(小斜*cos(α), 小斜*sin(α), "  C", :black, :bottom)
       segment(0, 0, c, 0, :green)
       point(c/2, 0, "c", :green, mark=false)
       segment(大斜, 0, 大斜 - a*cos(β), a*sin(β), :magenta)
       point(大斜 - a*cos(β)/2, a*sin(β)/2, "a ", :magenta, :right, mark=false)
       segment(小斜*cos(α), 小斜*sin(α), c*cos(α), c*sin(α), :blue)
       point((小斜 + c)*cos(α)/2, (小斜+c)*sin(α)/2, "b", :blue, :bottom, :right, mark=false)
   end
end;

   直径 = 9.452668468557997

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

算額(その75)

2022年12月26日 | Julia

算額(その75)

大阪府茨木市 井於神社 弘化3年(1846)
http://www.wasan.jp/osaka/iyo.html

鉤が 2 寸 7 分,股が 3 寸 6 分,弦が 4 寸 5 分の直角三角形の内部に正三角形が内接している。正三角形の一辺の長さを求めよ。

寸法を 10 倍し(「分」で表し)図のように記号を定め,方程式を解く。

算額の問題文に明確な記載はないが,∠DBC = 45° が仮定されているのだろうか(これ以外の仮定をする場合の解を後半に示す)。

using SymPy
@syms a::positive, b::positive, x::positive
a = 36*27//(36+27)
eq1 = (a-b)^2 + a^2 - x^2
eq2 = x/sqrt(Sym(2)) - b
solve([eq1, eq2])

   1-element Vector{Dict{Any, Any}}:
    Dict(b => sqrt(2)*(-108*sqrt(2)/7 + 108*sqrt(6)/7)/2, x => -108*sqrt(2)/7 + 108*sqrt(6)/7)

-108*sqrt(Sym(2))/7 + 108*sqrt(Sym(6))/7 |> factor |> println

   -108*(-sqrt(6) + sqrt(2))/7

(√6 - √2)*108/7

   15.972832497755562

正三角形の一辺の長さは (√6 - √2)*108/7 = 15.972832497755562 となる。もとの単位では 1寸5分9厘7毛...であるが,算額では1寸5分5厘8毛になっている。

using Plots

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

function draw(more=false)
    pyplot(size=(500, 500), grid=false, aspectratio=1, label="")
    a = 36*27/(36+27)
    b = sqrt(2)*(-108*sqrt(2)/7 + 108*sqrt(6)/7)/2
   x = 108*(sqrt(6) - sqrt(2))/7
   println("x = $x")
    plot([0, 36, 0, 0], [0, 0, 27, 0], xlims=(-2, 37), ylims=(-2, 28))
    plot!([b, a, 0, b], [0, a, b, 0])
   if more == true
       point(0, 27, "A ", :black, :right)
       point(0, 0, "B ", :black, :right)
       point(36, 0, " C", :black)
       point(a, a, "   D (a,a)")
       point(0, b, "b ", :green, :right)
       point(a, 0, " a")
       point(b, 0, " b")
       plot!([0, a], [0, a])
   end
end;

---

上述の解は,左下にできる三角形が二等辺三角形であると仮定したものである。この仮定の代わりに左下にできる三角形が外形の三角形と相似であると仮定した場合の解について考察してみる。

方程式は以下のようになる。正三角形の一辺を x として,5本の方程式を立てて解く。

using SymPy
@syms Dy::positive, Ex::positive, Fx::positive, Fy::positive, x::positive;
eq1 = Ex^2 + Dy^2 - x^2
eq2 = (Fx - Ex)^2 + Fy^2 - x^2
eq3 = Fx^2 + (Fy - Dy)^2 - x^2
eq4 = Dy - x*27//45
eq5 = 27Fx + 36Fy - 27*36;  # 面積の制約
p = solve([eq1, eq2, eq3, eq4, eq5])

   1-element Vector{Dict{Any, Any}}:
    Dict(Ex => -6912/433 + 7200*sqrt(3)/433, Dy => -5184/433 + 5400*sqrt(3)/433, x => -8640/433 + 9000*sqrt(3)/433, Fx => 1008*sqrt(3)/433 + 4644/433, Fy => 8208/433 - 756*sqrt(3)/433)

p[1][x].evalf()

    16.0472454229097

function draw2(more=false)
    pyplot(size=(500, 500), grid=false, aspectratio=1, label="")
    p = Dict(Dy => -5184/433 + 5400*sqrt(3)/433, Ex => -6912/433 + 7200*sqrt(3)/433, Fx => 1008*sqrt(3)/433 + 4644/433, x => -8640/433 + 9000*sqrt(3)/433, Fy => 8208/433 - 756*sqrt(3)/433)
    plot([0, 36, 0, 0], [0, 0, 27, 0], xlims=(-2, 37), ylims=(-2, 28))
   plot!([0, p[Ex], p[Fx], 0], [p[Dy], 0, p[Fy], p[Dy]])
   if more
       println("x = $(p[x])\nDy = $(p[Dy])\nEx = $(p[Ex])\n(Fx, Fy) = $((p[Fx], p[Fy]))")
       point(0, p[Dy], "Dy ", :green, :right)
       point(p[Ex], 0, " Ex")
       point(p[Fx], p[Fy], "  (Fx, Fy)")
   end
end
draw2(true)

   x = 16.047245422909686
   Dy = 9.628347253745813
   Ex = 12.837796338327747
   (Fx, Fy) = (14.757291487365883, 15.932031384475586)

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

Julia 1.8.4

2022年12月25日 | ブログラミング

Julia 1.8.4 が出ました

Current stable release: v1.8.4 (December 23, 2022)

 

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

算額(その74)

2022年12月25日 | Julia

算額(その74)

大阪府茨木市 井於神社 弘化3年(1846)
http://www.wasan.jp/osaka/iyo.html

鉤3寸,股4寸,弦5寸に甲円,乙円が入っている。それぞれの径を求めよ。

径は SymPy を使うまでもなく筆算(暗算)でも答えを出せる。

using SymPy
@syms AD::positive, DC::positive, BD::positive;
(AB, BC, CA) = (3, 4, 5)
eq1 = BD - AB * 4//5;
eq2 = AD - AB * 3//5;
eq3 = DC - (CA - AD);
result = solve([eq1, eq2, eq3], (BD, AD, DC))

   Dict{Any, Any} with 3 entries:
     BD => 12/5
     AD => 9/5
     DC => 16/5

r(鉤, 股, 弦) = 鉤 + 股 - 弦;  # 鉤股弦に内接する円の径(直径)

r(result[BD], result[DC], BC).evalf() |> println  # 甲円: 1.6 = 1寸6分

   1.60000000000000

r(result[AD], result[BD], AB).evalf() |> println  # 乙円: 1.2 = 1寸2分

   1.20000000000000

円の中心座標を求めて図を描く。

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; fontsize=10, mark=true)
   mark && scatter!([x], [y], color=color, markerstrokewidth=0)
   annotate!(x, y, text(string, fontsize, 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 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))
end;

function centerofcircle(x1, y1, x2, y2, x3, y3)
   """ 鉤股弦に内接する円の中心座標を求める"""
   a = (x1 - x2)^2 + (y1 - y2)^2
   b = (x1 - x3)^2 + (y1 - y3)^2
   c = (x3 - x2)^2 + (y3 - y2)^2
   if isapprox(a + b, c) || isapprox(b + c, a) || isapprox(c + a, b)
       @syms Ox::positive, Oy::positive
       (a, b, c) = sqrt.((a, b, c))
       r = (a + b + c)/2 - max(a, b, c)
       eq1 = distance(x1, y1, x2, y2, Ox, Oy) - r
       eq2 = distance(x1, y1, x3, y3, Ox, Oy) - r
       res = solve([eq1, eq2])
       if typeof(res) == Dict{Any, Any}
           return (res[Ox], res[Oy], r)
       else
           for i in 1:length(res)
               x, y = res[i][Ox], res[i][Oy]
               if min(x1, x2, x3) <= x <= max(x1, x2, x3) &&
                   min(y1, y2, y3) <= y <= max(y1, y2, y3)
                   return (x, y, r)
               end
           end
       end
   else
       println("鉤股弦ではない")
       return
   end
end;

function draw(more=false)
    pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (AB, BC, CA) = (3, 4, 5)
   (BD, AD, DC) = (12/5, 9/5, 16/5)
   (Ax, Ay) = (0, AB)
   (Bx, By) = (0, 0)
   (Cx, Cy) = (BC, 0)
   gap = 0.15
   (sine, cosine) = (3, 4) ./ 5
    plot([Ax, Bx, Cx, Ax], [Ay, By, Cy, Ay], color=:black, lw=0.5,
        xlims=(-gap, Cx+gap), ylims=(-1.5gap, Ay+gap))
   (Dx, Dy) = (AD*cosine, Ay-AD*sine)
   segment(Bx, By, Dx, Dy, :black)
   (r1, r2) = (1.6, 1.2) ./ 2
   println("甲円の半径 = $r1;  乙円の半径 = $r2")
   O1x, O1y, r = centerofcircle(Bx, By, Dx, Dy, Cx, Cy)
   circle(O1x, O1y, r)
   O2x, O2y, r = centerofcircle(Ax, Ay, Bx, By, Dx, Dy)
   circle(O2x, O2y, r)
    if more
       point(Ax, Ay, "A ", :black, :right)
       point(Bx, By, "B ", :black, :right)
       point(Cx, Cy, " C", :black)
       point(Dx, Dy, "  D", :black)
       point(O2x, O2y, "乙円\n(O2x,O2y)", :red, :center)
       point(O1x, O1y, "甲円\n(O1x,O1y)", :red, :center)
    end
end;

   甲円の半径 = 0.8;  乙円の半径 = 0.6

 

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

算額(その73)

2022年12月25日 | Julia

算額(その73)

三九 加須市不動岡 総願寺不動堂 弘化5年(1848)
埼玉県立図書館:埼玉県史料集 第二集『埼玉の算額』,昭和44年,誠美堂印刷所,埼玉県与野市.

埼玉県加須市不動岡 総願寺不動堂 弘化5年
http://www.wasan.jp/saitama/hudou.html

キーワード:円3個,直角三角形,正方形

鉤股弦の中に,1 個の正方形と大きさの異なる 3 個の円が互いに接して入っている。円の径を求めよ。

座標の割当の都合で,算額を左右反転させて記号を割り振り,方程式を解く。

円の径だけならば「径 = 鉤 + 股 - 弦」でよいが,図を描くためには円の中心座標を求めなければならない。

また,鉤股弦のいずれかが定数として与えられているのだろうが,写真では不鮮明なので,任意の定数を設定する。

鉤:AB, 股:BC, 弦:CA を 3, 4, 5 として各線分の長さを求めると 「長さ/37」 になるので,鉤股弦を 37 倍しておけば整数解が得られる。

using SymPy
@syms AD::positive, DE::positive, EA::positive,
     EB::positive, BF::positive,
     GC::positive, CF::positive;
(AB, BC, CA) = (3, 4, 5) .* 37
EF = DE
FG = DE
eq1 = AD - DE*(AB//BC);
eq2 = EB - DE*(AB//CA);
eq3 = FG - GC*(AB//BC);
eq4 = EA + EB - AB;
eq5 = BF + CF - BC;
eq6 = AD + EF + GC - CA;
eq7 = FG - GC * EB / BF
results = solve([eq1, eq2, eq3, eq4, eq5, eq6, eq7],
   (AD, EA, EB, BF, CF, DE, GC))

    (45, 75, 36, 48, 100, 60, 80)

小円,中円,大円の径は 12, 15, 20 である。

(AD, EA, EB, BF, CF, DE, GC) = (45, 75, 36, 48, 100, 60, 80)
EF = DE
FG = DE
(EB + BF - EF)/2 |> println
(AD + DE - EA)/2 |> println
(FG + GC - CF)/2 |> println

   12.0
   15.0
   20.0

function centerofcircle(x1, y1, x2, y2, x3, y3)
    """ 鉤股弦に内接する円の中心座標を求める"""
    a = (x1 - x2)^2 + (y1 - y2)^2
    b = (x1 - x3)^2 + (y1 - y3)^2
    c = (x3 - x2)^2 + (y3 - y2)^2
    if isapprox(a + b, c) || isapprox(b + c, a) || isapprox(c + a, b)
        @syms Ox::positive, Oy::positive
        (a, b, c) = sqrt.((a, b, c))
        r = (a + b + c)/2 - max(a, b, c)
        eq1 = dist2(x1, y1, x2, y2, Ox, Oy, r)
        eq2 = dist2(x1, y1, x3, y3, Ox, Oy, r)
        res = solve([eq1, eq2])
        for i = 1:length(res)
            (Ox1, Oy1) = (res[i][Ox], res[i][Oy])
            ((minimum([x1, x2, x3]) <= Ox1 <= maximum([x1, x2, x3])) &&
            (minimum([y1, y2, y3]) <= Oy1 <= maximum([y1, y2, y3]))) && return (float(Ox1), float(Oy1), r)
        end
    else
        println("鉤股弦ではない")
        return
    end
end;

function draw(more=false)
    pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
    gap = 10
    (sine, cosine) = (3, 4) ./ 5
    (AD, EA, EB, BF, CF, DE, GC)= (45, 75, 36, 48, 100, 60, 80)
    (AB, BC, CA) = (3, 4, 5) .* 37
    EF = DE
    FG = DE
    (Ax, Ay) = (0, AB)
    (Bx, By) = (0, 0)
    (Cx, Cy) = (BC, 0)
    plot([Ax, Bx, Cx, Ax], [Ay, By, Cy, Ay], color=:black, lw=0.5,
         xlims=(-gap, Cx+gap), ylims=(-1.5gap, Ay+gap))
    (Dx, Dy) = (AD*cosine, Ay-AD*sine)
    (Ex, Ey) = (0, EB)
    (Fx, Fy) = (BF, 0)
    segment(Dx, Dy, Ex, Ey, :black)
    segment(Ex, Ey, Fx, Fy, :black)
    (Gx, Gy) = (Dx + BF, Dy - EB)
    segment(Fx, Fy, Gx, Gy)
    r3 = (EB + BF - EF)/2
    r2 = (AD + DE - EA)/2
    r1 = (FG + GC - CF)/2
    println("小円の半径 = $r3;  中円の半径 = $r2;  大円の半径 = $r1")
    O3x, O3y, r = centerofcircle(Bx, By, Ex, Ey, Fx, Fy)
    circle(O3x, O3y, r)
    O2x, O2y, r = centerofcircle(Ax, Ay, Ex, Ey, Dx, Dy)
    circle(O2x, O2y, r)
    O1x, O1y, r = centerofcircle(Fx, Fy, Cx, Cy, Gx, Gy)
    println((Fx, Fy, Cx, Cy, Gx, Gy))
    circle(O1x, O1y, r)
    if more
        point(Ax, Ay, "A ", :black, :right)
        point(Bx, By, "B ", :black, :right)
        point(Cx, Cy, " C", :black)
        point(Dx, Dy, "  D", :black)
        point(Ex, Ey, " E", :black)
        point(Fx, Fy, "\nF", :black)
        point(Gx, Gy, "  G", :black)
        point(O3x, O3y, "小円\n(O3x,O3y)", :red, :center)
        point(O2x, O2y, "中円\n(O2x,O2y)", :red, :center)
        point(O1x, O1y, "大円\n(O1x,O1y)", :red, :center)
    end
end;

   小円の半径 = 12.0;  中円の半径 = 15.0;  大円の半径 = 20.0

 

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

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

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