裏 RjpWiki

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

算額(その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) | トップ | 算額(その83) »
最新の画像もっと見る

コメントを投稿

Julia」カテゴリの最新記事