裏 RjpWiki

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

算額(その242)

2023年05月24日 | Julia

算額(その242)

中村信弥「改訂増補 長野県の算額」
http://www.wasan.jp/zoho/zoho.html
県内の算額3(206)
長野県長野市芋井笹峯 笹峯天神社 文久2年(1862)

鉤股弦の中に大円と小円が入っている。長弦 3寸2分,短弦 1寸8分,中鉤 2寸4分のとき大円,小円の径を求めよ。

鉤股弦(直角三角形)の長弦とは AD,短弦とは CD,中鉤とは BD をいう。
鉤股弦に内接する円の直径は「鉤 + 股 - 弦」である。
AD = x, BC = y とおく。
小円の半径,中心座標を r1, (x - r1, y1)
大円の半径,中心座標を r2, (x2, r2)

x, y, r1, r2, y1, x2 の順に求める。

include("julia-source.txt");

using SymPy

@syms x::positive, y::positive, r1::positive, r2::positive, y1::positive, x2::positive;

eq1 = x^2 - (3.2^2 + 2.4^2)  # AB = x
x = solve(eq1)[1];

eq2 = y^2 - (1.8^2 + 2.4^2)  # BC = y
y = solve(eq2)[1];

eq3 = 2r1 -(1.8 + 2.4 - 3.0)
r1 = solve(eq3)[1];

eq4 = 2r2 - (2.4 + 3.2 - 4.0)
r2 = solve(eq4)[1];

eq5 = y1 + r1 - 2.4
y1 = solve(eq5)[1];

eq6 = x2 + r2 - 3.2
x2 = solve(eq6)[1];

x, y, r1, y1, r2, x2

   (4.00000000000000, 3.00000000000000, 0.600000000000000, 1.80000000000000, 0.800000000000000, 2.40000000000000)

小円,大円の半径がそれぞれ 6分,8分なので,直径は 1寸2分,1寸6分である。

using Plots
using Printf

function draw(more)
    pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (x, y, r1, y1, r2, x2) = (4.0, 3.0, 0.6, 1.8, 0.8, 2.4)
   @printf("x = %.3f;  y = %.3f;  r1 = %.3f;  y1 = %.3f;  r2 = %.3f;  x2 = %.3f\n", x, y, r1, y1, r2, x2)
   plot([0, x, x, 0], [0, 0, y, 0], color=:black, lw=0.5)
   circle(x - r1, y1, r1)
   circle(x2, r2, r2, :blue)
   (x0, y0) = 3.2 .* (4//5, 3//5)
   segment(x, 0, x0, y0)
   if more == true
       point(0, 0, "A ", :black, :right, :bottom)
       point(x, 0, " B", :black, :left, :bottom)
       point(x, y, " C" , :black, :left, :bottom)
       point(x0, y0, "D ", :black, :right, :bottom)
       point(4.0 - r1, y1, "(4-r1,y1)", :red, :center, :top)
       point(4.0 - r1, 1.1y1, " 小円", :red, :left, :bottom, mark=false)
       point(x2, r2, "(x2,r2)", :blue, :center, :top)
       point(x2, 1.1r2, " 大円", :blue, :left, :bottom, mark=false)
       hline!([0], color=:black, lw=0.5)
       vline!([0], color=:black, lw=0.5, xlims=(-0.2, 4.2))
   else
       plot!(showaxis=false)
   end
end;


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

コメントを投稿

Julia」カテゴリの最新記事