裏 RjpWiki

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

算額(その119)

2023年02月02日 | Julia

算額(その119)

二 岩手県花巻市大田 清水寺 嘉永三年(1850)
山村善夫:現存 岩手の算額,昭和52年1月30日,熊谷印刷,盛岡市.
http://www.wasan.jp/yamamura/yamamura.html

一関市博物館 > 和算に挑戦 > 令和4年度出題問題(2) [中級問題](中学・高校生向き)
岩手県花巻市の清水寺に嘉永3年(1850)に奉納された算額より
https://www.city.ichinoseki.iwate.jp/museum/wasan/r4/normal.html

図のように外円の中に直角三角形,大円,中円,小円が入っている。中円,小円の直径をそれぞれ 2 寸,1 寸としたとき,大円の直径を求めよ。

出題は円の直径であるが,小数点がつかないように2倍して半径を用いる。また,昨図のため外円の半径 R も求める。

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

eq1 だけで R=10 がわかる(R=2 は不適切解)。

using SymPy

@syms r, R

eq1 = (R-4)^2 + (R - 2)^2 - R^2
solve(eq1) |> println

   Sym[2, 10]

次に eq2 を解いて大円の半径 4 を得る。もとの単位では直径 4 寸である

eq2 = 2(R-4)*(R-2) - r*(3R - 6)
solve(eq2(R => 10)) |> println

   Sym[4]

using Plots
using Printf

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)
    pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (r, R) = (4, 10)
   println((R, r))
   x = R - 2
   y = R - 4
   plot()
   circle(0, 0, R, :black)
   circle(-x-1, 0, 1)
   circle(0, -y-2, 2, :magenta)
   circle(-x + r, -y + r, r, :blue)
   plot!([-x, x, -x, -x], [y, -y, -y, y], color=:black, lw=0.5)
   if more == true
       point(-x, y, "A  ", :black, :right)
       point(x, -y, " B", :black)
       point(-x, -y, "C  ", :black, :right)
       point(1 - R, 0, "1-R", :red, :top)
       point(0, 2 - R, "2-R", :magenta)
       point(-x + r, -y + r, "(r-x,r-y)", :blue, :top)
       hline!([0], color=:black, lw=0.5)
       vline!([0], color=:black, lw=0.5)
   else
       plot!(showaxis=false)
   end
end;

 


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

コメントを投稿

Julia」カテゴリの最新記事