裏 RjpWiki

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

算額(その23)

2022年11月13日 | Julia

算額(その23)

直角三角形に接する大円,小円の径がそれぞれ 3,2 である。直角三角形の外形を描け。

山形県天童市山元 若松観音堂
http://www.wasan.jp/yamagata/wakamatu2.html

ほかに必要とする座標は図に示すとおりである。

using SymPy

@syms x::positive, x1::positive, y1::positive, x2::positive, y2::positive, x3::positive;

小円の中心座標を(x2, 2) とする。大円と小円が接していることから,

eq1 = 1 + (x2 - 3)^2 - 25
x2 = solve(eq1)[1]
x2 |> println
x2.evalf() |> println # x2

   3 + 2*sqrt(6)
   7.89897948556636

△ABC, △DEC が相似なので,(x3 - x2) / (x3 - 3) = 2//3

x3 = solve((x3 - x2)/ (x3 - 3) - 2//3, x3)[1]
x3 |>  println # x3

   3 + 6*sqrt(6)

大円と (x1, y1) で接し,(x3, 0) を通る直線について,
円周上に存在するので,

eq2 = (x1 - 3)^2 + (y1 - 3)^2 - 9;
eq3 = (x3 - x1)^2 + y1^2 - (x3 - 3)^2;

x1, y1 = solve([eq2, eq3], (x1, y1))[1] # x1, y1

   (12*sqrt(6)/25 + 3, 144/25)

△FGC,△IOC の相似により,

I = y1*x3/(x3-x1) |> simplify |> together |> println # intercept

   12*(sqrt(6) + 12)/23

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)
   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")
   x3 = 3 + 6sqrt(6)
   x2 = 3 + 2sqrt(6)
   (x1, y1) = (12*sqrt(6)/25 + 3, 144/25)
   println("x2 = $x2")
   println("x1 = $x1;  x2 = $x2")
   intercept = 12(sqrt(6) + 12)/23
   println("x3 = $x3;  intercept = $intercept")
   plot([0, x3, 0, 0], [0, 0, intercept, 0], color=:black, linewidth=0.5)
   circle(3, 3, 3, :green)
   circle(x2, 2, 2, :magenta)
   if more
       point(3, 3, "A:(3,3)", :green, :center)
       point(3, 0, "\nB:(3,0)", :green, :bottom)
       point(x3, 0, " C:(x3,0)", :black, :left, :bottom)
       point(x2, 2, "D:(x2,2)", :magenta, :center)
       point(x2, 0, "\nE:(x2,0)", :magenta, :bottom)
       point(x1, y1, " F:(x1,y1)", :green, :left, :bottom)
       point(x1, 0, "\n\nG:(x1,y1)", :green, :left, :bottom)
       point(0, 0, " O", :black, :left, :bottom)
       point(0, intercept, " I(0,intercept)", :black, :left, :bottom)
   end
end;


コメント    この記事についてブログを書く
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする
« 算額(その22) | トップ | 算額(その24) »
最新の画像もっと見る

コメントを投稿

Julia」カテゴリの最新記事