Amaryllis@hatena

何箇所目かのAmaryllisですよ。いつもの。果たして使い続けるかどうかは当にハテナです。

ではちょっと公開してみましょう。LuaLaTeXの原稿です。arctanの話題から

%!TEX TS-program = lualatex
¥documentclass[report,fleqn,a4paper]{ltjsbook}% ---------------10pt-%¥documentclass[report,fleqn]{ltjsbook}
% --------------------------------------------------------------------------------------------------------
¥usepackage{fontspec}%--------------------------------------- --%fontspec:OpenType等使用
¥usepackage{mflogo,listings}%-----------
¥usepackage{amsmath,amssymb}%-------------------------------- --%amsmath,amssymb
¥usepackage{multicol,example,tascmac,enumitem}%-------------- --%multicol,example,tascmac,enumitem
%¥usepackage{hyperref}%¥usepackage{url}
¥usepackage{luamplib,luatexja-ruby}%------------------------- --%luamplib,luatexja-ruby
¥usepackage{graphics}
¥usepackage{rotating}%--------------------------------------- --%rotating 何でも回転
%¥usepackage{xhfill}%--------------------------------------- --%rotating 何でも回転
%¥usepackage[ipaex]{luatexja-preset}%------------------------- --luatexja-preset
%¥usepackage{unicode-math}%----------------------------------- --unicode-math
¥usepackage{luacode}%---------------------------------------- --luacode:luaでプログラム
¥usepackage{mpgraphR}%---------------------------------------- --mpgraphR:私家版スタイル Renewal版
¥usepackage{moonlight}%---------------------------------------- --mpgraphR:私家版スタイル Renewal版
%¥lstset{language=TeX}%
%¥everymplib{input mpcolornames; beginfig(1);}%--------------| | luamplib環境のデフォルト
%¥everyendmplib{endfig;}%------------------------------------| | の設定。カラーネーム読込
%
¥setlength{¥oddsidemargin}{-16mm}%--------------------------| | 奇数ページ左余白(設定値+1in)
¥setlength{¥evensidemargin}{-16mm}%-------------------------| | 偶数ページ左余白(設定値+1in)
¥setlength{¥topmargin}{-28mm}%------------------------------| | 上余白(設定値+1in)
¥setlength{¥textwidth}{191mm}%------------------------------| | 本文部分の幅
¥setlength{¥textheight}{278mm}%-----------------------------| | 本文部分の高さ
¥fboxrule=0.1pt
%
% temporaly macros
¥def¥tmpBBox[#1](#2,#3){%----------------------------------------| | ¥tmpBBox #1:単位長 #2:横 #3:縦
¥begin{mplibcode}
¥mpBaseSize(#1mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)
¥mpPlattice(0,0)(#2,#3)
¥end{mplibcode}%
}%---------------------------------------------------------------| | #1mm幅で横#2縦#3の格子を描く

¥pagestyle{empty}% -------------------------------------------------------------------¥pagestyle{empty}
%
¥def¥tmpRule[#1]{%
¥vspace{0.01¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(#1mm)¥mpHandWriteSet¥mpHandWriteOff%¥mpPenSize(2)
¥mpPenSize(0.6)%
for i=-5 upto 11:%
draw (((i*1/2,2)--(0,0)--(3,0)--cycle) scaled w) shifted (3.5*i*w,0) withcolor red+0.5green;%
endfor;%
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
}%
%
¥def¥mpGlineLabel #1#2(#3){label(textext("$_{"&"#3"&"}$"),(z.#1+z.#2)/2+2mm*unitvector(z.#1-z.#2) rotated 90);}%
¥def¥mpGlineLabels#1#2(#3)#4.{¥mpGlineLabel#1#2(#3)¥ifx#4¥@empty¥else¥mpGlineLabels#4.¥fi}%

¥def¥tmpFlr(#1){¥left¥lfloor #1¥right¥rfloor}
%=========================================================================================
¥begin{document}%---------------------------------------------------------¥begin{document}
%=========================================================================================
%
¥noindent¥tmpBBox[3](3,3)¥hfill~%----------------------------------------------------title
%¥raise4pt¥hbox{¥textsf{¥Huge$¥mathbb{Namagiri¥ Thayar’¥!s¥ Oracle}$}}
¥raise4pt¥hbox{¥textsf{¥Huge 例の角度の問題}}
¥hfill¥tmpBBox[3](3,3)¥par~%---------------------------------------------------------title
%
%{¥HUGE$¥mathbb{Na}$}

%
¥par¥noindent¥hfill¥begin{minipage}{0.64¥textwidth}¥begin{itembox}{もんだい}¥parindent=1¥zh
よくあるパターン。

次の図は正方形を3つ並べた図形です。
角$¥alpha$と$¥beta$の和を求めなさい。
%~¥par~¥vspace{1¥zw}
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(36mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(0,1)B(0,0)C(1,0)D(2,0)E(3,0)F(3,1)G(2,1)H(1,1).
¥mpPenSize(0.4)¥mpGlines BEFABFC.¥mpPenSize(0.2)¥mpGline CH¥mpGline DG
¥mpGangleMarkX BEF[2]¥mpGangleMarkX CEF[2]
¥mpGangleLabelX BEF(¥alpha)[1]¥mpGangleLabelX CEF(¥beta)[1]
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
¥end{itembox}¥end{minipage}¥hfill~¥par¥vspace{1¥zw}
%
¥begin{multicols}{2}%------------------------------------------------------------------|||
%
これは三角関数の言葉を使えば,
¥begin{align}
¥arctan¥fracm{1}{2}+¥arctan¥fracm{1}{3}
¥nonumber¥end{align}
の値を求めなさいという話になる。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
arctan$なんて初めて見たという人でも,
¥begin{align}
¥arctan 0&=0=¥kaku{0}
¥nonumber¥¥
¥arctan¥fracm{1}{¥sqrt{3}}&=¥fracm{¥pi}{6}=¥kaku{30}
¥nonumber¥¥
¥arctan 1&=¥fracm{¥pi}{4}=¥kaku{45}
¥nonumber¥¥
¥arctan¥sqrt{3}&=¥fracm{¥pi}{3}=¥kaku{60}
¥nonumber¥end{align}
と幾つか並べてみると,「なんだそんなことか」と思うかもしれない。
そう。$¥tan$の値から角度を得る$¥tan$の¥textgt{逆関数}だ。

高校生が学ぶ数学Iで登場する三角比で教わる$¥tan$は
¥begin{align}
¥tan¥kaku{30}&=¥tan¥fracm{¥pi}{6}=¥fracm{1}{¥sqrt{3}}
¥nonumber¥¥
¥tan¥kaku{45}&=¥tan¥fracm{¥pi}{4}=1
¥nonumber¥¥
¥tan¥kaku{60}&=¥tan¥fracm{¥pi}{3}=¥sqrt{3}
¥nonumber¥end{align}
となっている。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
そんなことではなくて,$¥arctan¥fracm{1}{2}+¥arctan¥fracm{1}{3}$である。
この値については,彼のレオンハルト・オイラーさんが$¥cdots$とか,
そのオイラー氏は$¥arctan¥fracm{1}{p+q}+¥arctan¥fracm{q}{p^2+pq+1}$も計算しただのとある$¥cdots$。
がこの手のものではやはり,マチンの式
¥begin{align}
arctan¥fracm{1}{5}-¥arctan¥fracm{1}{239}=¥ ¥lower6pt¥hbox{¥text{¥Huge ?}}
¥nonumber¥end{align}
が有名だ。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
ちなみに,¥ruby{レオンハルト・オイラー}{Leonhard Euler}さんは1707年スイスのバーゼルで生まれた18世紀の数学者・天文学者
¥ruby{ジョン・マチン}{John Machin}さんはオイラーさんより少し早い生まれらしい。
1680年頃洗礼とあるだけで生まれた年は分からないのかも。
17世紀末に誕生したことは確か。
天文学者
円周率πを求めるのにとても強力な手法というか式を1706年に発表し,
それを利用して更に円周率を 100 桁まで計算した。
マチンはライプニッツニュートン微分積分学論争の裁決を行った委員会の一人。
21世紀になっても日本の高校で学ぶ数学の1つのゴールとされているのはこの微分積分なわけで$¥cdots$。

ちなみに1700年前後の日本はといえば,江戸時代の中期か。
冲方丁さんの「天地明察」で描かれる関孝和渋川春海が活躍した時代。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
さて,最初に揚げた問題が簡単なら,
マチンの式だって簡単に判る(¥ruby{筈}{はず}だ)よねって話だ。

どう分かるのかって?それを観ていこう。

先ずは$4¥arctan¥fracm{1}{5}$の謎だ。
これは$¥tan$が$¥fracm{1}{5}$になる角4つ分ってことだ。
図に描くと,
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(12mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(5,1)B(0,0)C(5,0)b(0,1).
¥mpPenSize(0.2)numeric mx,my;mx=5;my=1;
for i=0 upto mx:draw (((0,0)--(0,my)) shifted (i,0)) scaled w;endfor;
for j=0 upto my:draw (((0,0)--(mx,0)) shifted (0,j)) scaled w;endfor;
¥mpPenSize(0.4)¥mpGlines ABCA.¥mpGangleMarkX BAC[3]
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
こんな感じの角だ。これを4つ分。

いきなり4つ分はアレだから先ずは2つ分を図示してみよう。
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(12mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(5,1)B(0,0)C(5,0)b(0,1).
¥mpPenSize(0.4)¥mpGlines ABCA.¥mpGangleMarkX BAC[3]
picture tmpp;tmpp=currentpicture;currentpicture:=nullpicture;
¥mpPenSize(0.2)numeric mx,my;mx=5;my=1;
for i=0 upto mx:draw (((0,0)--(0,my)) shifted (i,0)) scaled w;endfor;
for j=0 upto my:draw (((0,0)--(mx,0)) shifted (0,j)) scaled w;endfor;
draw tmpp;draw tmpp rotated angle(gpA);
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
ってこれでは...どう描けばよいだろう。
そこが冒頭の問題でも問題だったわけだけど。

¥newpage

そこで,このように描いてみた。
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(3mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(25,5)B(0,0)C(25,0)D(26,0).
%¥mpPenSize(0.4)¥mpGlines ABCA.¥mpGangleMarkX BAC[3]
%picture tmpp;tmpp=currentpicture;currentpicture:=nullpicture;
¥mpPenSize(0.2)numeric mx,my;mx=26;my=12;
for i=0 upto mx:draw (((0,0)--(0,my)) shifted (i,0)) scaled w;endfor;
for j=0 upto my:draw (((0,0)--(mx,0)) shifted (0,j)) scaled w;endfor;
%draw tmpp;draw tmpp rotated angle(gpA);
¥mpPenSize(0.4)¥mpGlines ABCA.¥mpGlineCs ADCA[red]¥mpGangleMarkX BAC[2.4]
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
わかるだろうか。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
横$5$縦$1$の三角形(つまり$¥arctan¥fracm{1}{5}$の角をもつ直角三角形)を,
そのままではなく,5倍の大きさで描いたわけだ。
そうすると,右に横$1$縦$5$の直角三角形を図のようにつけて,
更に一回り大きな$¥arctan¥fracm{1}{5}$の角をもつ直角三角形を描くことができたわけだ。

そこで,次のように,
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(3mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(25,5)B(0,0)C(25,0)D(26,0).
¥mpPenSize(0.4)¥mpGlines ABDA.¥mpGlineCs AC[red]¥mpGangleMarkX BAC[2.4]
picture tmpp;tmpp=currentpicture;currentpicture:=nullpicture;
¥mpPenSize(0.2)numeric mx,my;mx=26;my=12;
for i=0 upto mx:draw (((0,0)--(0,my)) shifted (i,0)) scaled w;endfor;
for j=0 upto my:draw (((0,0)--(mx,0)) shifted (0,j)) scaled w;endfor;
draw tmpp;draw tmpp reflectedabout(gpB,gpA);
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
線対称にその三角形を描き加えると,
図の中に,$2¥arctan¥fracm{1}{5}$の角をもつ直角三角形を具現化できる。
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(3mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(25,5)B(0,0)C(25,0)D(26,0).
¥mpPenSize(0.4)¥mpGlines ABDA.¥mpGlineCs AC[red]¥mpGangleMarkX BAC[2.4]
picture tmpp;tmpp=currentpicture;currentpicture:=nullpicture;
¥mpPenSize(0.2)numeric mx,my;mx=26;my=12;
for i=0 upto mx:draw (((0,0)--(0,my)) shifted (i,0)) scaled w;endfor;
for j=0 upto my:draw (((0,0)--(mx,0)) shifted (0,j)) scaled w;endfor;
draw tmpp;draw tmpp reflectedabout(gpB,gpA);
¥mpPointsDef E(24,10)F(24,0).¥mpGlineCs EBFE[blue]
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
このようにして,$2¥arctan¥fracm{1}{5}$の角を作図することができた。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
言い換えれば,
¥begin{align}
arctan¥fracm{1}{5}=¥arctan¥fracm{10}{24}=¥arctan¥fracm{5}{12}
¥nonumber¥end{align}
を得たわけだ。

これって$¥cdots$そう。$5-12-13$という全部の辺が整数な直角三角形だ。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
まぁそれはおいておいて,同じこと,
つまり適当に拡大して,小さな直角三角形を付け足したものを,線対称に変換して描き加える,
ということを,
$2¥arctan¥fracm{1}{5}$,つまり$¥arctan¥fracm{10}{24}$,
つまりは$¥arctan¥fracm{5}{12}$の角を持つ直角三角形,
つまり,$底辺:高さ=12:5$の直角三角形に対して
もう一度行うと,$4¥arctan¥fracm{1}{5}$を作図できるわけだ。

そうすると,マチンの公式が確認できるのではないか。

図に描くと,
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(6mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(12,5)B(0,0)C(12,0)b(0,5).
¥mpPenSize(0.2)numeric mx,my;mx=12;my=5;
for i=0 upto mx:draw (((0,0)--(0,my)) shifted (i,0)) scaled w;endfor;
for j=0 upto my:draw (((0,0)--(mx,0)) shifted (0,j)) scaled w;endfor;
¥mpPenSize(0.4)¥mpGlines ABCA.¥mpGangleMarkX BAC[3]
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
こんな感じの角だ。これを2つ分。
今回は$底辺:高さ=12:5$だから,先ず$12$倍して$¥cdots$
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(0.5mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(144,60)B(0,0)C(144,0)D(169,0).
¥mpPenSize(0.4)¥mpGlines ABDA.¥mpGlineCs AC[red]¥mpGangleMarkX BAC[2.4]
picture tmpp;tmpp=currentpicture;currentpicture:=nullpicture;
¥mpPenSize(0.4)numeric mx,my;mx=169;my=120;
for i=0 upto mx:draw (((0,0)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=0 upto my:draw (((0,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
for i=0 step 5 until mx:draw (((0,0)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.5white;endfor;
for j=0 step 5 until my:draw (((0,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.5white;endfor;
draw tmpp;draw tmpp reflectedabout(gpB,gpA);
¥mpPenSize(0.4)¥mpPointsDef E(119,120)F(119,0).¥mpGlineCs EF[red+0.5green]
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
とこうなる。これで長さを数えれば,
%
%言い換えれば,
¥begin{align}
arctan¥fracm{5}{12}=¥arctan¥fracm{120}{119}=4¥arctan¥fracm{1}{5}
¥nonumber¥end{align}
%
が分かる。

ところで,この$¥arctan¥fracm{120}{119}$の角の直角三角形ってほぼ直角二等辺三角形だよね。
つまりほぼ$¥kaku{45}$だ。
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(0.5mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(144,60)B(0,0)C(144,0)D(169,0).
¥mpPenSize(0.4)¥mpGlines ABDA.¥mpGlineCs AC[red]¥mpGangleMarkX BAC[2.4]
picture tmpp;tmpp=currentpicture;currentpicture:=nullpicture;
¥mpPenSize(0.4)numeric mx,my;mx=169;my=120;
for i=0 upto mx:draw (((0,0)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=0 upto my:draw (((0,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
for i=0 step 5 until mx:draw (((0,0)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.5white;endfor;
for j=0 step 5 until my:draw (((0,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.5white;endfor;
draw tmpp;draw tmpp reflectedabout(gpB,gpA);
¥mpPenSize(0.4)¥mpPointsDef E(119,120)F(119,0).¥mpGlineCs EBFE[red+0.5green]
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
そして描き直したり数えたりすると分かるが,
arctan¥fracm{120}{119}$つまり$4¥arctan¥fracm{1}{5}$な角は
$¥kaku{45}$よりもほんの少し大きい。

つまり少し引けばぴったり$¥kaku{45}$になるわけだ。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
では,どのような角を引けばよいのか。

少し簡単というか小さな数で考えてみよう。

例えば,¥reAns
¥begin{align}
¥arctan¥fracm{5}{4}-¥arctan¥fracm{¥MAns}{¥MAns}=¥fracm{¥pi}{4}=¥kaku{45}
¥nonumber¥end{align}
みたいな問題を解けるか。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
¥newpage
%
問題は
¥begin{align}
¥arctan¥fracm{5}{4}-¥arctan¥fracm{¥MAns}{¥MAns}=¥fracm{¥pi}{4}=¥kaku{45}
¥nonumber¥end{align}
の空欄を埋めることができるか,だ。

それは次のような図が描ければ簡単に解決する問題だ。
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(8mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(4,5)B(0,0)C(4,0)D(4,1)E(9,1).
¥mpPenSize(0.4)¥mpGlines ABCA.%¥mpGlineCs AC[red]¥mpGangleMarkX BAC[2.4]
picture tmpp;tmpp=currentpicture;currentpicture:=nullpicture;
¥mpPenSize(0.1)numeric mx,my;mx=9;my=5;
for i=0 upto mx:draw (((0,0)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=0 upto my:draw (((0,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
for i=0 step 5 until mx:draw (((0,0)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.5white;endfor;
for j=0 step 5 until my:draw (((0,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.5white;endfor;
draw tmpp;draw tmpp rotated -90 shifted gpA withcolor 0.6white;
¥mpPenSize(0.8)draw gpB--gpB rotatedabout(gpA,90)--gpA--gpB withcolor red;
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
もうお分かりだろう。
図の中に$¥kaku{45}$を特徴とする直角二等辺三角形が鎮座ましましてる。

図より
%
¥begin{align}
¥arctan¥fracm{5}{4}-¥arctan¥fracm{1}{9}=¥fracm{¥pi}{4}=¥kaku{45}
¥nonumber¥end{align}
%
が分かるというわけだ。

一般的に$b>a$とすれば,
%
¥begin{align}
¥arctan¥fracm{b}{a}-¥arctan¥fracm{b-a}{b+a}=¥fracm{¥pi}{4}=¥kaku{45}
¥nonumber¥end{align}
%
が成り立つ。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
つまり,
%
¥begin{align}
¥arctan¥fracm{120}{119}-¥arctan¥fracm{1}{239}=¥fracm{¥pi}{4}=¥kaku{45}
¥nonumber¥¥
arctan¥fracm{1}{5}-¥arctan¥fracm{1}{239}=¥fracm{¥pi}{4}=¥kaku{45}
¥nonumber¥end{align}
%
というわけだ。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
さて,この$¥arctan$を組み合わせて,$¥kaku{45}$を作る遊びは余程楽しいようで,
いろんな人が結果を残している。

例えば,¥ruby{ヤコブ・ハーマン}{Jacob Hermann}$^{1678}_{〜1733}$は,
¥begin{align}
arctan¥fracm{1}{2}-¥arctan¥fracm{1}{7}=¥fracm{¥pi}{4}=¥kaku{45}
¥nonumber¥end{align}
と。練習問題に丁度良さそうだ。

先ず,$2¥arctan¥fracm{1}{2}$の図示,
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(9mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(2,1)B(0,0)C(2,0).
¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-1;msy=-1;mx=6;my=5;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
¥mpPenSize(0.4)¥mpGlineCs ABCA[0.6white]%¥mpGlineCs AC[red]¥mpGangleMarkX BAC[2.4]
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
¥columnbreak
%
次に,直角二等辺三角形の作図の要領だ。
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(9mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(2,1)B(0,0)C(2,0).
¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-1;msy=-1;mx=8;my=5;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
%¥mpPenSize(0.4)¥mpGlineCs ABCA[0.6white]%¥mpGlineCs AC[red]¥mpGangleMarkX BAC[2.4]
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
首尾よく描けただろうか。そして,
¥begin{align}
arctan¥fracm{1}{2}-¥arctan¥fracm{1}{7}=¥fracm{¥pi}{4}=¥kaku{45}
¥nonumber¥end{align}
が図から確認できただろうか。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
さて,幾つか試してみることで,だんだんと慣れてきただろうか。

似たような式はまだまだある。
¥ruby{チャールズ・ハットン}{Charles Hutton}$^{1737}_{〜1823}$は,
¥begin{align}
arctan¥fracm{1}{4}+¥arctan¥fracm{5}{99}&=¥fracm{¥pi}{4}=¥kaku{45}
¥nonumber¥¥
arctan¥fracm{1}{3}+¥arctan¥fracm{1}{7}&=¥fracm{¥pi}{4}=¥kaku{45}
¥nonumber¥end{align}
の2つを示したらしい。
さてさて,上手く確認できるかな?
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
2つめの$2¥arctan¥fracm{1}{3}+¥arctan¥fracm{1}{7}=¥fracm{¥pi}{4}$については,
もう簡単に確認できるだろうと思うので紙面での解説は省略しよう。
問題は,1つ目の$3¥arctan¥fracm{1}{4}+¥arctan¥fracm{5}{99}=¥fracm{¥pi}{4}$の方だ。
2倍の角の作図の手順は確認したから4倍や8倍は面倒でも何とかるが,
$3¥arctan¥fracm{1}{4}$ということは3倍の角の図示が必要になりそうだ。
は如何すればよいだろうか。

ここでは初登場なので暫し考えてみてほしい。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(6mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(2,1)B(0,0)C(2,0).
¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-1;msy=-1;mx=14;my=12;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
%¥mpPenSize(0.4)¥mpGlineCs ABCA[0.6white]%¥mpGlineCs AC[red]¥mpGangleMarkX BAC[2.4]
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
¥newpage
%
問題は,$3¥arctan¥fracm{1}{4}+¥arctan¥fracm{5}{99}=¥fracm{¥pi}{4}$の確認であり,
その為には,$3¥arctan¥fracm{1}{4}$つまり,$底辺:高さ=4:1$の直角三角形の角の3倍の角を具体化する,
つまり描いてみるところから始まるのだが$¥cdots$2倍の角は描けるわけだから,
あとは下に付け加えれば簡単にできそうだ。

こんな説明でピンとくるだろうか。実際に描いてみよう。
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(4mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(4,1)B(0,0)C(4,0).
¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-1;msy=-5;mx=18;my=10;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
¥mpPenSize(0.4)¥mpGlineCs ABCA[0.6white]¥mpGangleMarkX BAC[2.4]
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
何とかなっただろうか。
そう,次の図のような感じで具現化できていれば良いのではないか。
%
%¥end{multicols}¥end{document}%---debug用
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(4mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(4,1)B(0,0)C(4,0).
¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-1;msy=-2;mx=18;my=9;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
¥mpPenSize(0.4)¥mpGlineCs ABCA[0.8white]¥mpGangleMarkX BAC[2.4]
¥mpPointsDef A(16,4)B(0,0)C(16,0)D(17,0)E(15,8)F(4,-1).
¥mpPenSize(0.4)¥mpGlineCs ABCADC[0.6white]¥mpGlineCs AEBF[0.4white]¥mpGangleMarkX BEF[1.2]
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
さて,そうなると次は,$¥kaku{45}$との差をどう確認するか。
これも今までのパターンとは少し違う。

もう少し簡単そうな例で実験してみよう。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
¥noindent¥textgt{<簡単そうな例>} %
適当な数で空欄を埋めなさい。
¥begin{align}
¥arctan¥fracm{1}{2}+¥arctan¥fracm{1}{4}+¥arctan¥fracm{¥MAns}{¥MAnss}=¥fracm{¥pi}{4}=¥kaku{45}
¥nonumber¥end{align}

えっ?って思ったかもう慣れたか,つまり,
$底辺:高さ=2:1$の直角三角形の角と
$底辺:高さ=4:1$の直角三角形の角に
$底辺:高さ=¥moveAns{-2}¥MAnssr:¥moveAns{-3}¥MAnsr$の直角三角形の角を加えると,
丁度$¥kaku{45}$になるように$¥cdots$できる?っていうパズルだね。

図で描くとこんな感じかな。
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(4mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(2,1)B(0,0)C(2,0)D(4,-1)E(4,0)F(3,-1).
¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-1;msy=-5;mx=18;my=7;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
¥mpPenSize(0.4)¥mpGlineCs BCABDEC[0.6white]¥mpGlineCs ABF[0.3white]
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
この図だと,太い線で$¥kaku{45}$を示しているので,
三角形になってない角(下側の薄い角)を持つ直角三角形が作図できれば解決するけど$¥cdots$
できるかな?
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(4mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(2,1)B(0,0)C(2,0)D(4,-1)E(4,0)F(3,-1).
¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-1;msy=-8;mx=22;my=1;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
¥mpPenSize(0.4)¥mpGlineCs DBF[0.6white]
¥mpPenSize(2)for i=1 upto 5:draw i*gpD;endfor;for i=1 upto 7:draw i*gpF;endfor;
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
もう少し拡げて描かないと無いなぁ。
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(2mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(2,1)B(0,0)C(2,0)D(4,-1)E(4,0)F(3,-1).
¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-1;msy=-15;mx=43;my=1;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
¥mpPenSize(0.4)¥mpGlineCs DBF[0.6white]
¥mpPenSize(2)for i=1 upto 10:draw i*gpD;endfor;for i=1 upto 14:draw i*gpF;endfor;
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
よしよし。見つかったね。

図をよく見て数えれば,
$底辺:高さ=¥kbss{6mm}:¥kbss{6mm}$の直角三角形の角だと分かる。
つまり,
¥begin{align}
¥arctan¥fracm{1}{2}+¥arctan¥fracm{1}{4}+¥arctan¥fracm{1}{13}=¥fracm{¥pi}{4}=¥kaku{45}
¥nonumber¥end{align}
ということだ。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
では,元の問題に戻ろう。
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(4mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(4,1)B(0,0)C(4,0).
¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-1;msy=-2;mx=18;my=9;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
¥mpPenSize(0.4)¥mpGlineCs ABCA[0.8white]¥mpGangleMarkX BAC[2.4]
¥mpPointsDef A(16,4)B(0,0)C(16,0)D(17,0)E(15,8)F(4,-1).
¥mpPenSize(0.4)¥mpGlineCs ABCADC[0.6white]¥mpGlineCs AEBF[0.4white]¥mpGangleMarkX BEF[1.2]
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
この図を得るところまで来たので,先ほどの問題と同様に式にしてみると,
¥begin{align}
¥arctan¥fracm{8}{15}+¥arctan¥fracm{1}{4}+¥arctan¥fracm{¥MAns}{¥MAnss}=¥fracm{¥pi}{4}=¥kaku{45}
¥nonumber¥end{align}
を解けばよいということか。
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(4mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(4,1)B(0,0)C(4,0).
¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-1;msy=-2;mx=18;my=9;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
¥mpPenSize(0.4)¥mpGlineCs ABCA[0.8white]¥mpGangleMarkX BAC[2.4]
¥mpPointsDef A(16,4)B(0,0)C(16,0)D(17,0)E(15,8)F(4,-1)G(5,3).
¥mpPenSize(0.4)¥mpGlineCs ABCADC[0.6white]¥mpGlineCs AEBF[0.4white]¥mpGangleMarkX BEF[1.2]
¥mpGlines GBF.
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
¥newpage
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(4mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(4,1)B(0,0)C(4,0).
¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-1;msy=-2;mx=18;my=10;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
¥mpPenSize(0.4)¥mpGlineCs ABCA[0.8white]¥mpGangleMarkX BAC[2.4]
¥mpPointsDef A(16,4)B(0,0)C(16,0)D(17,0)E(15,8)F(4,-1)G(5,3).
¥mpPenSize(0.4)¥mpGlineCs ABCADC[0.6white]¥mpGlineCs AEBF[0.4white]¥mpGangleMarkX BEF[1.2]
¥mpGlines GBF.
¥mpPenSize(2)for i=1 upto 3:draw i*gpG;endfor;for i=1 upto 1:draw i*gpE;endfor;
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
これでは何ともならん。拡げてみよう。
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(1.32mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(4,1)B(0,0)C(4,0).
¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-1;msy=-2;mx=61;my=37;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
¥mpPenSize(0.4)¥mpGlineCs ABCA[0.8white]¥mpGangleMarkX BAC[2.4]
¥mpPointsDef A(16,4)B(0,0)C(16,0)D(17,0)E(15,8)F(4,-1)G(5,3).
¥mpPenSize(0.4)¥mpGlineCs ABCADC[0.6white]¥mpGlineCs AEBF[0.4white]¥mpGangleMarkX BEF[1.2]
¥mpGlines GBF.
¥mpPenSize(2)for i=1 upto 12:draw i*gpG;endfor;for i=1 upto 4:draw i*gpE;endfor;
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
まったく見当たらない...

更に拡大してみよう。
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(0.36mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPointsDef A(4,1)B(0,0)C(4,0).
¥mpPenSize(0.2)numeric msx,msy,mx,my;msx=-1;msy=-2;mx=241;my=144;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
¥mpPenSize(0.4)¥mpGlineCs ABCA[0.8white]%¥mpGangleMarkX BAC[2.4]
¥mpPointsDef A(16,4)B(0,0)C(16,0)D(17,0)E(15,8)F(4,-1)G(5,3).
¥mpPenSize(0.4)¥mpGlineCs ABCADC[0.6white]¥mpGlineCs AEBF[0.4white]%¥mpGangleMarkX BEF[1.2]
¥mpGlines GBF.
¥mpPenSize(1)for i=1 upto 48:draw i*gpG;endfor;for i=1 upto 16:draw i*gpE;endfor;
path subpp;pair clpP;
clpP[1]=13*gpE+(-3w,5w);subpp[1]=fullcircle scaled 20w shifted clpP[1];
¥mpPenSize(0.1)draw subpp[1] withcolor red;
clpP[2]=15*gpE+(-3w,5w);subpp[2]=fullcircle scaled 20w shifted clpP[2];
¥mpPenSize(0.1)draw subpp[2] withcolor green;
picture allp,subp;allp=currentpicture;
clip currentpicture to subpp[1];subp[1]=currentpicture;draw allp;
clip currentpicture to subpp[2];subp[2]=currentpicture;draw allp;
pair drwP
;
drwP[1]=(120,20) scaled w;
fill *1 shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
¥mpPenSize(0.4)¥mpGlineCs ABCA[0.8white]¥mpGangleMarkX BAC[2.4]
¥mpPointsDef A(16,4)B(0,0)C(16,0)D(17,0)E(15,8)F(4,-1)G(5,3).
¥mpPenSize(0.4)¥mpGlineCs ABCADC[0.6white]¥mpGlineCs AEBF[0.4white]¥mpGangleMarkX BEF[1.2]
¥mpPenSize(2)for i=1 upto 3:draw i*gpG;endfor;for i=1 upto 1:draw i*gpE;endfor;
¥mpPenSize(0.4)¥mpGlines GBE.
¥mpPointsDef P(-5,10)Q(10,5).¥mpPenSize(0.4)¥mpGlineCs PBQ[red]
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
惜しいね。

拡大した右の円の3点の場合の確認は任せよう。
おそらく惜しいけど上手く直角にはならない筈だ。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
では,計算して「上手くいく」点を見つけるためにはどうすればよいだろう。

上で駄目な例を確認したわけだけど,
結局のところ,

$横:縦=15:8$な直角三角形,
つまり$(15,¥ 8)$という点を基本に,それを$k$倍したところにある点$(15k,¥ 8k)$と,
$横:縦=5:3$な直角三角形,
つまり$(5,¥ 3)$という点を基本に,それを$¥ell$倍したところにある点$(5¥ell,¥ 3¥ell)$で,
その2点を繋いでできる$横:縦=5¥ell-15k:8k-3¥ell$な直角三角形の斜辺が,
$横:縦=15:8$な直角三角形の斜辺か$横:縦=5:3$な直角三角形の斜辺に垂直になればよい。

つまり,$横:縦=8k-3¥ell:5¥ell-15k=15:8¥ or¥ 5:3$となれば良いわけだ。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
では解いてみよう。
解くのは,
¥begin{align}
8k-3¥ell:5¥ell-15k=15:8
¥nonumber¥end{align}

¥begin{align}
8k-3¥ell:5¥ell-15k=5:3
¥nonumber¥end{align}
だ。どちらを解いてもよいのなら,下の方が数が小さくて楽そうだ。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
そんなこんなで,
¥begin{align}
8k-3¥ell:5¥ell-15k=5:3
¥nonumber¥end{align}
を解いてみよう。
¥begin{align}
3(8k-3¥ell)&=5(5¥ell-15k)
¥nonumber¥¥
24k-9¥ell)&=25¥ell-75k
¥nonumber¥¥
99k&=34¥ell
¥nonumber¥¥
k&=34m,¥ ¥ell=99m¥ ¥ (mは整数)
¥nonumber¥end{align}
ってことだ。

ということはつまり,
$(15,¥ 8)$という点を基本に,それを$k=34$倍したところにある点$(15¥times 34,¥ 8¥times 34)=(510,¥ 272)$と
$(5,¥ 3)$という点を基本に,それを$¥ell=99$倍したところにある点$(5¥times 99,¥ 3¥times 99)=(495,¥ 297)$を
繋げば,
$横:縦=510-495:297-272=15:25=3:5$な直角三角形の斜辺が生じて,
それは,$横:縦=5:3$な直角三角形の斜辺に垂直になるよという事が分かったわけだ。

そうして,問題であった$3¥arctan¥fracm{1}{4}+¥arctan¥fracm{5}{99}=¥fracm{¥pi}{4}$の確認ができた。

えっ?って?なんで$¥fracm{5}{99}$だって分かるの?って。
そこは肝心なところなので,各自で確認して欲しい。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
さて,此処までで判ったことを少し纏めてみると面白いかもしれない。
途中で使った
%
¥begin{align}
¥arctan¥fracm{b}{a}-¥arctan¥fracm{b-a}{b+a}=¥fracm{¥pi}{4}=¥kaku{45}
¥nonumber¥end{align}
%
のような結果だ。

例えば,
¥begin{align}
2¥arctan¥fracm{b}{a}=¥arctan¥fracm{¥kbs{16mm}}{¥kbs{16mm}}
¥nonumber¥end{align}
はきっちり決まるのだろうか。
などなど。

考えてみると面白いと思う。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
さて,此処まで初等幾何学的な,というよりは図形の組み合わせ的な確認方法を観てきましたが,
よくよく考えてみれば,座標平面で角度の話となれば,複素数を利用することを忘れては困ります。

例えば冒頭で紹介した
¥begin{align}
¥arctan¥fracm{1}{2}+¥arctan¥fracm{1}{3}=¥kaku{45}
¥nonumber¥end{align}
の場合は,
¥begin{align}
(2+i)(3+i)=6+5i+i^2=5(1+i)
¥nonumber¥end{align}
なので明らかだ,ととても簡単に確認できます。

マチンの公式
¥begin{align}
4¥arctan¥fracm{1}{5}-¥arctan¥fracm{1}{239}=¥kaku{45}
¥nonumber¥end{align}
の場合は,
¥begin{align}
(5+i)^4&=(24+10i)^2=4(12+5i)^2
¥nonumber¥¥
&=4(144-25+120i)=476+480i
¥nonumber¥¥
&=2(238+240i)
¥nonumber¥¥
(1+i)(239-i)&=240+238i
¥nonumber¥end{align}
なので明らかだ。となります。

なんというかとても簡単ですね。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
ちょっと判らないって。

計算はなんとなく判るけど,だからどう明らかなのかは判らない。

そう。この計算の意味するところを知って「なるほど明らかだ」と分かるためには,
基本的な複素数とその計算と座標平面との関係を確認しておく必要があります。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
まず複素数は,$¥overset{実数}{a}+¥overset{実数}{b}¥overset{~^{虚数}_{単位}}{i}$の形をした数で,
虚数単位と呼ばれる$i$は$i^2=-1$とする実数には存在しなかった数とします。

具体的には,$1+i,¥ 2+3i,¥ 4-¥sqrt{5}i,¥ ¥cdots$のような数を複素数といいます。
もちろん,$6$や$-¥fracm{5}{3}$,$3+¥sqrt{2}$のような普通の数(実数)も含まれますし,
$-i$や$7i$,$¥fracm{¥sqrt{3}}{2}i$のように$i$の付いた虚部のみの数も複素数です。

例えば,
¥begin{align}
&i^2=-1,¥ (1+i)(1+i)=1+2i+i^2=1+i^2-1=2i
¥nonumber¥¥
&2+3i¥ +¥ 4-5i=2+4¥ +(3-5)i=6-2i
¥nonumber¥¥
&¥fracm{2+3i}{4-5i}
=¥fracm{(2+3i)¥raise0.1¥zw¥hbox{¥text{¥footnotesize$¥times(4+5i)$}}}{(4-5i){¥text{¥footnotesize$¥times(4+5i)$}}}
=¥fracm{¥overset{8-15}{-7}+¥overset{10+12}{22i}}{¥underset{16+25}{41}}
¥nonumber¥end{align}
%
のように普通に計算ができます。

そして何より,複素数は平面の点に自然に対応します。
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(4mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-8;msy=-8;mx=8;my=8;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
¥mpPenSize(0.2)¥mpParrow(-8.2,0)(8.6,0)¥mpParrow(0,-8.2)(0,8.6)
label(textext("¥footnotesize 実数"),(8.6,-0.6) scaled w);
label(textext("¥footnotesize 虚数($i$)"),(1.6,8.6) scaled w);
¥mpPenSize(0.6)
¥mpPpoint(0,1)label(textext("$i$"),(0.5,1) scaled w);
¥mpPpoint(2,0)label(textext("$2$"),(2,-0.6) scaled w);
¥mpPpoint(4,3)label(textext("$4+3i$"),(4,3.6) scaled w);
¥mpPpoint(-3,7)¥mpPpoint(-5,0)¥mpPpoint(0,-5)¥mpPpoint(-6,-5)¥mpPpoint(7,-7)
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
複素数が書かれていない点に複素数を描いてみましょう。

これは算数の頃から慣れ親しんできた¥textgt{数直線}の¥textgt{複素数版}ともいえます。
また,座標で$(4,¥ 3)$と書いていたのを$4+3i$と書くだけ,ともいえます。
それだけなら特にここで紹介する意味がないわけです。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
ではここで少し複素数の計算を確認しておきましょう。
$4$に$1+i$を何度も掛ける。$4$を$1+i$で何度も割る。そんな練習です。
%
¥begin{align}
4¥times (1+i)&=
¥nonumber¥¥
4¥times (1+i)^2&=
¥nonumber¥¥
~¥nonumber¥¥
4¥times (1+i)^3&=
¥nonumber¥¥
~¥nonumber¥¥
4¥div (1+i)&=¥fracm{4}{1+i}=
¥nonumber¥end{align}
%
¥begin{align}
4¥div (1+i)^2&=¥fracm{4}{(1+i)^2}=
¥nonumber¥¥
~¥nonumber¥¥
4¥div (1+i)^3&=¥fracm{4}{(1+i)^3}=
¥nonumber¥¥
~¥nonumber¥¥
4¥div (1+i)^4&=¥fracm{4}{(1+i)^4}=
~¥nonumber¥¥
¥nonumber¥end{align}
%
計算できただろうか。
例えばこんな感じだ。
%
¥begin{align}
4¥times (1+i)&=4+4i
¥nonumber¥¥
4¥times (1+i)^2&=4¥times 2i=8i
¥nonumber¥¥
4¥times (1+i)^3&=8i(1+i)=-8+8i
¥nonumber¥¥
4¥div (1+i)&=¥fracm{4}{1+i}=¥fracm{4(1-i)}{2}=2-2i
¥nonumber¥¥
4¥div (1+i)^2&=¥fracm{4}{(1+i)^2}=¥fracm{2-2i}{1+i}=¥fracm{-4i}{2}=-2i
¥nonumber¥¥
4¥div (1+i)^3&=¥cdots=-1-i
¥nonumber¥¥
4¥div (1+i)^4&=¥cdots=-1
¥nonumber¥end{align}
%
で,それがどうしたのかって話なんだけど,計算だけして放っておくと判らないのだ。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
そこで,今の結果を,平面に点で描き込んでいこう。
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(4mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-9;msy=-9;mx=9;my=9;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
¥mpPenSize(0.2)¥mpParrow(-9.2,0)(9.6,0)¥mpParrow(0,-9.2)(0,9.6)
label(textext("¥footnotesize 実数"),(9.6,-0.6) scaled w);
label(textext("¥footnotesize 虚数($i$)"),(1.6,9.6) scaled w);
¥mpPenSize(0.6)
¥mpPpoint(4,0)label(textext("$4$"),(4,-0.8) scaled w);
¥mpPpoint(4,4)label(textext("$4+4i$"),(4.6,4.6) scaled w);
¥mpPpoint(0,8)label(textext("$8i$"),(0.8,8) scaled w);
¥mpPpoint(-8,8)label(textext("$-8+8i$"),(-8,8.6) scaled w);
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
前半の$4$から始めて,$4$に$1+i$を3回掛けた点まで描き込んでおいた。

割った方はまだなので描き込んでみてほしい。

さて,何かに気が付いただろうか。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
$4$という数があってそれは原点から少し離れた実数軸上にある。
これに$1+i$を掛けると,少し離れた$4+i$に移り,
更に$1+i$を掛けると,虚数軸上の$8i$に移り,
更に$1+i$を掛けると,虚数軸の左側の$-8+8i$に移る。

こうやって順に点を追っていくと,
どんどん離れながら,原点の周りを左に回っていっている事に気がつく。

どう回っているだろうか。

$1+i$で割ったときにはどうなってるだろう。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
これらの点を並べてみたときに,¥ruby{螺旋}{らせん}じゃないかって思った人は素敵だ。
よく知っている。
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(4mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-9;msy=-9;mx=9;my=9;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
¥mpPenSize(0.2)¥mpParrow(-9.2,0)(9.6,0)¥mpParrow(0,-9.2)(0,9.6)
label(textext("¥footnotesize 実数"),(9.6,-0.6) scaled w);
label(textext("¥footnotesize 虚数($i$)"),(1.6,9.6) scaled w);
¥mpPenSize(0.6)
pair pP;pP[1]=(-1,0);
for i=2 upto 9:pP[i]=pP[i-1] zscaled(1,1);endfor;
path tmpP;tmpP=pP[1] for i=2 upto 9:..pP[i] endfor;
¥mpPenSize(2)
draw tmpP scaled w withcolor red+0.5green;
¥mpPenSize(0.6)
¥mpPointDef P(-1,0)
for i=1 upto 8:
¥mpGpoint P
gpP:=gpP zscaled(1,1);
endfor;
¥mpPlaneClip(20,20)(-9.2,-9.2)
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
もう少し縮小した図で描いてみると,
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(1mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-36;msy=-36;mx=36;my=36;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
¥mpPenSize(0.2)¥mpParrow(-37,0)(39,0)¥mpParrow(0,-37)(0,39)
label(textext("¥footnotesize 実数"),(39,-2) scaled w);
label(textext("¥footnotesize 虚数($i$)"),(6,39) scaled w);
¥mpPenSize(0.6)
pair pP
;pP[1]=(-1,0);
for i=2 upto 17:pP[i]=pP[i-1] zscaled(1,1);endfor;
path tmpP;tmpP=pP[1] for i=2 upto 17:..pP[i] endfor;
¥mpPenSize(2)
draw tmpP scaled w withcolor red+0.5green;
¥mpPenSize(0.1)
¥mpPointDef P(-1,0)
for i=1 upto 17:
¥mpGpoint P
gpP:=gpP zscaled(1,1);
endfor;
¥mpPlaneClip(80,80)(-38,-38)
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
あんまり拡がらなかったね。

とまぁこんな感じなわけだ。
点としての複素数に複素数を掛けると回転するわけだね。

$1+i$を何度も掛けたり割ったりした今の例だと何度回転しているだろう。
その角度って何だろう。

あとはそれが分かればこの話はおしまいだ。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
気が付いたかもしれないが,$1+i$を掛けると丁度$¥kaku{45}$だけ点の位置が原点を中心に回る。
例えば,$2+i$に$1+i$を掛けると
¥begin{align}
(2+i)(1+i)=2+3i+i^2=1+3i
¥nonumber¥end{align}
だ。
やはりこの計算だけではよく判らないと思うが,
$2+i$と$1+i$,$1+3i$を平面上で確認してみると一目瞭然だ。
%
¥vspace{0.6¥zw}¥par¥noindent¥hfill
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(4.6mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-1;msy=-1;mx=4;my=4;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
¥mpPenSize(0.2)¥mpParrow(-1.2,0)(4.4,0)¥mpParrow(0,-1.2)(0,4.4)
label(textext("¥footnotesize 実数"),(4.2,-0.6) scaled w);
label(textext("¥footnotesize 虚数($i$)"),(1.6,4.2) scaled w);
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(4.6mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-1;msy=-1;mx=4;my=4;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
¥mpPenSize(0.2)¥mpParrow(-1.2,0)(4.4,0)¥mpParrow(0,-1.2)(0,4.4)
label(textext("¥footnotesize 実数"),(4.2,-0.6) scaled w);
label(textext("¥footnotesize 虚数($i$)"),(1.6,4.2) scaled w);
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~
¥begin{mplibcode}% ===================================================== ¥begin{mplibcode}
¥mpBaseSize(4.6mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg%
¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-1;msy=-1;mx=4;my=4;
for i=msx upto mx:draw (((0,msy)--(0,my)) shifted (i,0)) scaled w withcolor blue+0.8white;endfor;
for j=msy upto my:draw (((msx,0)--(mx,0)) shifted (0,j)) scaled w withcolor blue+0.8white;endfor;
¥mpPenSize(0.2)¥mpParrow(-1.2,0)(4.4,0)¥mpParrow(0,-1.2)(0,4.4)
label(textext("¥footnotesize 実数"),(4.2,-0.6) scaled w);
label(textext("¥footnotesize 虚数($i$)"),(1.6,4.2) scaled w);
¥end{mplibcode}% ========================================================= ¥end{mplibcode}
¥hfill~¥par¥vspace{0.01¥zw}
%
なぜそうなるのか。

この文書ではそこまでは説明しない。
気になる人は各自で調べてみるとよい。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
それでは,もう一度,冒頭で紹介した
¥begin{align}
¥arctan¥fracm{1}{2}+¥arctan¥fracm{1}{3}=¥kaku{45}
¥nonumber¥end{align}
を考えてみよう。
¥begin{align}
(2+i)(3+i)=6+5i+i^2=5(1+i)
¥nonumber¥end{align}
の計算でどのように明らかだと確認できるのだろう。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
$2+i$は平面上で,$横2:縦1$の直角三角形の角,つまり
$¥arctan¥fracm{1}{2}$の角の方向にある。

そして,これに$3+i$を掛けるということは,この$2+i$の点を,$3+i$の点の角,
つまり$横3:縦1$の直角三角形の角,つまり$¥arctan¥fracm{1}{3}$の角だけ回転させることになる。

その結果,$5(1+i)$になるわけだが,この$5(1+i)$は$1+i$と同じ角$¥kaku{45}$の点だ。

つまりそういうことだ。

$i$が付いてるとどうもって人には,
¥begin{align}
&(2+i)(3+i)(1-i)=(6+5i+i^2)(1-i)
¥nonumber¥¥
=&5(1+i)(1-i)=10
¥nonumber¥end{align}
と$1-i$を掛ければ$i$が消えて$10$だけ残るという見せ方もどうぞ。

つまり,ぴったり$¥kaku{45}$になったところで,$¥kaku{-45}$回せば,実軸上に移る。
つまり実数になる。

だから何だと云われるかもしれないが,
最初の方で紹介した,¥reAns
¥begin{align}
¥arctan¥fracm{5}{4}-¥arctan¥fracm{¥MAns}{¥MAns}=¥fracm{¥pi}{4}=¥kaku{45}
¥nonumber¥end{align}
の空欄を埋める問題なら,$(4+5i)(x+yi)(1-i)$が実数になるような$x,¥ y$を求めるという話になる。
¥begin{align}
(4+5i)(x+yi)(1-i)&=(4+5i)(1-i)(x+yi)
¥nonumber¥¥
&=(¥overset{4+5}{9}+¥overset{-4+5}{1}i)(x+yi)
¥nonumber¥¥
&=(9+i)(x+yi)
¥nonumber¥¥
&=9x-y+(x+9y)i
¥nonumber¥end{align}
これが実数になるということは,$(x+9y)i$のところがなくなる,つまり$x+9y=0$となれば良いので,
例えば$x=9,¥ y=-1$とすればよい。

だから,$9-i$を掛けることになる。
つまり,$9-i$の分の角を足すことになるのだけど,
$9-i$の位置を考えれば,$9+i$の角を引くことと同じだ。
だから,
¥begin{align}
¥arctan¥fracm{5}{4}-¥arctan¥fracm{1}{9}=¥fracm{¥pi}{4}=¥kaku{45}
¥nonumber¥end{align}
%
だと分かる。計算だからとても機械的に処理ができるね。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
数ページ前で触れた
¥begin{align}
2¥arctan¥fracm{b}{a}=¥arctan¥fracm{¥kbs{16mm}}{¥kbs{16mm}}
¥nonumber¥end{align}
はきっちり決まるのだろうかって話も,
複素数使えば考えるまでもなく,
¥begin{align}
(a+bi)^2=a^2-b^2+2abi
¥nonumber¥end{align}
だから,
¥begin{align}
2¥arctan¥fracm{b}{a}=¥arctan¥fracm{2ab}{a^2-b^2}
¥nonumber¥end{align}
と分かるし,
¥begin{align}
(a+bi)^3=a^3-3ab^2+(3a^2b-b^3)i
¥nonumber¥end{align}
だから,
¥begin{align}
3¥arctan¥fracm{b}{a}=¥arctan¥fracm{3a^2b-b^3}{a^3-3ab^2}
¥nonumber¥end{align}
など,必要に応じて楽々簡単な道具を¥ruby{拵える}{こしらえる}ことができる。
%
¥par¥noindent¥hfill$¥infty$¥hfill~¥par
%
この事が分かれば,
直角三角形の組み合わせで苦心して説明した等式達は,
どれも複素数の簡単な計算で解決できることになる。

マチンやオイラーの時代に,
¥begin{align}
m¥arctan¥fracm{1}{x}+n¥arctan{1}{y}=k¥fracm{¥pi}{4}
¥nonumber¥end{align}
となるような,$m,¥ n,¥ x,¥ y, k$の組み合わせを探るという数学の問題を Grav¥'eという人が問うたみたいで,
1897年にはSt¥o rmerという人が解決して1899年には証明も発表したらしい。
今からもう100年以上前の話だ。
%

¥end{multicols}%-----------------------------------------------------------------------|||
%
%
%¥newpage
%
%
%=========================================================================================
¥end{document}%-------------------------------------------------------------¥end{document}
%=========================================================================================


/_/_/_/_/_/_/_/_/ Otokuni High School, Kyoto /_/_/_/
Tatsuru Murai Mathematics, Wind Ensemble Club ???

*1:subpp[1] shifted -clpP[1]) scaled 4) shifted drwP[1] withcolor white; draw ((subp[1] shifted -clpP[1]) scaled 4) shifted drwP[1]; drwP[2]=(200,30) scaled w; fill ((subpp[2] shifted -clpP[2]) scaled 4) shifted drwP[2] withcolor white; draw ((subp[2] shifted -clpP[2]) scaled 4) shifted drwP[2]; ¥end{mplibcode}% ========================================================= ¥end{mplibcode} ¥hfill~¥par¥vspace{0.01¥zw} % 微妙そうなところはあるのやけど$¥cdots$これ以上細かい図を描くのは, 機械任せならともかく無理がある。 そうなると計算の出番だ。 % ¥par¥noindent¥hfill$¥infty$¥hfill~¥par % でもどうやって計算しよう。 上の図の微妙な2つの例で確認してみよう。 拡大した左の円の4点の場合,それぞれ座標はどうなるだろう。 図の左下の$3¥arctan¥fracm{1}{4}$の角を描いた点を原点$(0,¥ 0)$にとって考えてみよう。 % ¥par¥noindent¥hfill$¥infty$¥hfill~¥par % 右下の点の座標は, $横:縦=15:8$な直角三角形, つまり$(15,¥ 8)$という点が基本で,それを$13$倍したところにあるから, $(15¥times 13,¥ 8¥times 13)=(195,¥ 104)$だ。 左上に3つ並んだ点は, $横:縦=5:3$な直角三角形, つまり$(5,¥ 3)$という点が基本で,それを順に,$37,38,39$倍したところにある。 このうち直角三角形になりそうな点は真ん中の$38$倍した点だ。 座標は$(5¥times 38,¥ 3¥times 38)=(190,¥ 114)$となる。 そうすると,その2点を結ぶ線は,$横:縦=5:10=1:2$な直角三角形の斜辺だ。 $横:縦=15:8$な直角三角形の斜辺や$横:縦=5:3$な直角三角形の斜辺と比べた時に上手く直角にはならない。 図で確認するとこんな感じだ。 % ¥vspace{0.6¥zw}¥par¥noindent¥hfill ¥begin{mplibcode}% ===================================================== ¥begin{mplibcode} ¥mpBaseSize(3.6mm)¥mpHandWriteSet¥mpHandWriteOn¥mpPenSize(0.3)¥mpGarrowChg% ¥mpPointsDef A(4,1)B(0,0)C(4,0). ¥mpPenSize(0.4)numeric msx,msy,mx,my;msx=-6;msy=-2;mx=18;my=11; for i=msx upto mx:draw (((0,msy)--(0,my

Turing Pattern やら Python やら Julia やら

今日は一日お休みだ。仕事に行かないというか職場に行かないというか...
出かけようかとか,歩き回ろうかとかいろいろ思ったけど,
気になってる事で遊んでみよう。其の記録。

JuliaでTuring Patternをって思ったけど,
結局視覚化する段でmatplotlibなんかを使うので
じゃぁPythonでって...いつもこんな風に中途半端にブレて時間切れになるので
今日はもう少し

そう思って「ググる」とこんなええもんが...

qiita.com

早速Anacondaを立ち上げてJupyter帳面を開いてPythonなノートを開けて
コピペすると素敵♬

JuliaBox上手く通った模様

今日思い出して再度JuliaBoxを試してみたら
f:id:satie:20180110190041j:plain
とあっさり通った。ホッとするなど。
これで上手くいけば職場でも使えるかも。

矢張り俄かJulia使いが殺到してたのか
年末年始だし新しいJulia出たりだから調整してたのか。
まぁ兎も角使えそうで安心。
早速試してみよう。

では

とJupyterNotebookな訳だからいつものように...何と!

何と0.6.0だ。インストールしたのは確か0.6.2

ふーむ。そして当然だけど微妙に反応が遅いのでこうしてはてな打って待ってる。
ぼちぼちいけるやろか。

In[2]:  big(2)^1000
Out[2]: 1071508607186267320948425049060001810561404811705
        5336074437503883703510511249361224931983788156958581275
        9467291755314682518714528569231404359845775746985748039
        3456777482423098542107460506237114187795418215304647498
        3581941267398767559165543946077062914571196477686542167
        660429831652624386837205668069376

微妙に違うけどこんな感じで動いてる。よしよし。

ではと,Primesもって思ってたら,サーバが...
気を取り直してJuliaBoxを再読み込みして...

in[3]:  import Primes
In[4]:  isprime(2017)

としたらば,undefinedのエラー。
ふーむそうかと、

in[5]:  using Primes
In[6]:  isprime(2017)
Out[5]: true

よしよし。
それにしてもimportusingの違いって何?ちょっと調べてみよう。

Julia にどんなPackageを取り込んだ?か備忘録

  • 先ずは組み合わせと順列関連
    • Pkg.add("Combinatorics")

でも何だか貧弱になってる。

  • 素数関連も要るよな
    • Pkg.add("Primes")
  • 微分方程式は必要なんやろか
    • DifferentialEquations・・・未だ入れてない
      • Julia suite for high-performance solvers of differential equations
  • 何だろうこのお絵かきってやつ
    • Drawing・・・未だ入れてない
      • A library for easy, extensible drawing (diagrams, lines, shapes)
  • そしてこれまた
    • Escher・・・未だ入れてない
        • Composable Web UIs in Julia

なんか山ほどあって見切れない。
一つ一つは良いから一般的なものを紹介してるところはないんかなぁ。

JuliaBox は相変わらず Sorry, an unexpected error occured. Please try after some time. なので仕方なくANACONDA で Jupiter Notebook で Julia 0.6.2 を試してみるなど

JuliaBoxは相変わらず使えない。
色々気になっている事

があるけどまぁどうでも良いので使ってみよう。

  • Rのように中身がぐちゃぐちゃでなく
  • Rubyのように遅くなく
  • Lispのように原始的またはエレファントでなく
  • Prologのように変態的なところはなく
  • ScalaClojureについては Javaのように硬すぎることはなく
  • Haskellのように抽象的すぎない

らしい。分かるような判らないような。
ただruby より高速とかLispPrologが引き合いに出されるところが唆られる。

環境はMacBookProRatina13inch2015で未だSiera。
昨年ANACONDAやらJupyterやらjuliaやら諸々を整備済み。
昨日juliaの0.6.2をdmgでダウンロードして解凍してアプリケーションに入れる。
も,Jupyter Notebookでは0.6.2が選べずググった挙句 ターミナルで

Pkg.add("IJulia")

を施すと選べるようになった。(魔法の呪文)

  • IJulia, IPython,... とは結局のところ何か。(使ってないけどIRもあるのか。)
  • 名称での大文字と小文字の使い分けの意味合いは
  • Package ってTeXでもパッケージという言い方が主流だけどどんな意味合い?
  • それより何より,何がIJuliaというパッケージをどこに加えてるの?
  • そもそも「加える」ってどんな意味合い?

などと再びモクモクと沸き起こる謎は傍に置いておこう。

  1. ANACONDAをLaunchpadから立ち上げる
  2. ターミナルの窓が勝手に開き何やらもごもごした挙句SafariがHomeというページを開く
    • このHomeはlocalhost。つまりFinderみたいなもの(か)。
    • Folderやらファイル名が列挙されてる。
  3. |Files / Running / Clusters / Nbextensions| という選択肢のうちのFilesが選ばれている状態。
  4. その状態で,右の方の |New▼| というメニュを開けると,僕の環境だと| Julia 0.5.2 / Julia 0.6.2 / Python 3 | が選べる。もちろん今回は | Julia 0.6.2 | を選ぶわけだ。
  5. するとSafariが別窓というかタブを開けて| untitled |というjuliaのインタプリタ的なnoteが開く。

さてさてでは実際に動かしてみよう。

In[  ] :

と書いた小窓があるのでここに何かを打つ。

In[  ] :2^100

とか打ってみる。
そして shift+return する。
すると,0と表示される。あれ?と思うがこれを

In[  ] :2^60

に変えてshift+returnすれば,ちゃんと

In[ 2 ] : 2^60
Out[ 2 ] : 1152921504606846976

と正しそうな(なんせ確かめてないし覚えてもいない)値が返ってくる。

早速気になっている組み合わせや順列を試してみよう。

昨日はcombinations( lst , n )が通らなかった。

juliaとcombinationでググると出てくるArrays — Julia Language 0.4.8-pre documentation
を見たら,素っ気なく

combinations(array, n)
Generate all combinations of n elements from an indexable object. Because the number of combinations can be very large, this function returns an iterator object. Use collect(combinations(array,n)) to get an array of all combinations.

と書いてあるのだけどエラーが出る。

そこで,

Pkg.add("Combinatorics")

をしておいた。これで組み合わせ関連のパッケージが付加されるらしい。

でも今日も矢張りエラーだ。

using Combinatorics

を先に実行しないとダメなようだ。

そこで,またもやググるIntroducing Julia/Arrays and tuples - Wikibooks, open books for an open world が出てきた。ふむふむ。

There are functions in the Combinatorics.jl package that let you find combinations and permutations of arrays. combinations() finds all the possible combinations of elements in an array: you can specify how many elements in each combination:

julia> Pkg.add("Combinatorics") # (do this just once)
julia> using Combinatorics
https://en.wikibooks.org/wiki/Introducing_Julia/Arrays_and_tuples

そっか,どうもusing Combinatoricsを毎度施さないと駄目らしい。
ライブラリ感覚だなぁ。
そんなわけで,

In[ 3 ] : using Combinatorics

として shift+return すれば,

          INFO: Precompiling module Combinatorics.

と INFO が表示され多分これで使えそうな雰囲気が醸し出される。

ではいよいよ。

In[ 4 ] : lst=[1,2,3,4]
          collect(combinations(lst, 3))

そうそう。一度に複数行入力できるよ。
そして shift+return する。

Out[ 4 ] : 4-element Array{Array{Int64,1},1}:
            [1, 2, 3]
            [1, 2, 4]
            [1, 3, 4]
            [2, 3, 4]

となる。なるほど。

こんな事もできる。所謂分割数の列挙だ。

In[ 5 ] : collect(partitions(6))
Out[ 5 ] : 11-element Array{Any,1}:
            [6]               
            [5, 1]            
            [4, 2]            
            [4, 1, 1]         
            [3, 3]            
            [3, 2, 1]         
            [3, 1, 1, 1]      
            [2, 2, 2]         
            [2, 2, 1, 1]      
            [2, 1, 1, 1, 1]   
            [1, 1, 1, 1, 1, 1]

上のは6の分割の列挙だけど,次のようにArrayを直接複数のArrayに分割する事も楽々できるらしい。

In[ 6 ] : collect(partitions([1,2,4,7]))
Out[ 6 ] : 15-element Array{Any,1}:
            Array{Int64,1}[[1, 2, 4, 7]]      
            Array{Int64,1}[[1, 2, 4], [7]]    
            Array{Int64,1}[[1, 2, 7], [4]]    
            Array{Int64,1}[[1, 2], [4, 7]]    
            Array{Int64,1}[[1, 2], [4], [7]]  
            Array{Int64,1}[[1, 4, 7], [2]]    
            Array{Int64,1}[[1, 4], [2, 7]]    
            Array{Int64,1}[[1, 4], [2], [7]]  
            Array{Int64,1}[[1, 7], [2, 4]]    
            Array{Int64,1}[[1], [2, 4, 7]]    
            Array{Int64,1}[[1], [2, 4], [7]]  
            Array{Int64,1}[[1, 7], [2], [4]]  
            Array{Int64,1}[[1], [2, 7], [4]]  
            Array{Int64,1}[[1], [2], [4, 7]]  
            Array{Int64,1}[[1], [2], [4], [7]]

そうなると同じ数を含んだArrayだとどうなるかきになるのだけど

In[ 7 ] : collect(partitions([1,4,4]))
Out[ 7 ] : 5-element Array{Any,1}:
            Array{Int64,1}[[1, 4, 4]]    
            Array{Int64,1}[[1, 4], [4]]  
            Array{Int64,1}[[1, 4], [4]]  
            Array{Int64,1}[[1], [4, 4]]  
            Array{Int64,1}[[1], [4], [4]]

という感じで何というか期待したようにはならなかった。
まぁ分割の作法からは言えば当然かとは思う。

取り敢えずここまでにしておこう。

改めてJuliaBoxを試してみる(実況というか時系列で)

さて,Juliaを使う環境の選択肢としてJuliaBoxを試してみるだけど
f:id:satie:20180107190312j:plain
な画面が出てクルクル回り続けた挙句に
f:id:satie:20180107190548j:plain
となって積んでいる。
まぁそういうこともあるだろう。
実は2度目のトライをしたのだが。
もそっと時間を空けて試してみよう。

JuliaBoxを試してみる(実況というか時系列で)

これも黒木さん(genkuroki.github.io)の呟きで「!」と思ってたら,

Juliabox: インストール不要, 無料で Julia をすぐ使える · julia についてというこれまた素敵な記事が今日投稿した記事超入門 · julia についてのメニューにあったので早速今から試してみようと思う。

(18:44)
先ずはリンクにあるhttps://www.juliabox.com/にアクセスする。

Googleで登録しようとしたら,1度目は何故か弾かれた。
まぁそんなこともあるかと,再度試すと何とか登録あできたようだが今度は

Sorry, an unexpected error occured. Please try after some time.

と表示されてどうも使えない。
残念だがまた時間をおいて試してみよう。