要先載入trigtools.mac才能使用atan_contract指令
(%i1) load(trigtools);
; file: C:/maxima-5.48.1/share/maxima/5.48.1/share/contrib/Grobner/grobner.lisp
; in: DEFUN POLY-ADD-VARIABLES
; (DEFUN MAXIMA:: POLY-ADD-VARIABLES (MAXIMA:: P MAXIMA::K)
; (DECLARE (VALUES MAXIMA:: POLY &OPTIONAL))
; (SETF (MAXIMA:: POLY-TERMLIST MAXIMA:: P)
; (MAXIMA::TERMLIST-ADD-VARIABLES (MAXIMA:: POLY-TERMLIST MAXIMA:: P)
; MAXIMA::K))
; MAXIMA:: P)
;
; caught WARNING:
; Derived type of (MAXIMA:: P) is
; (VALUES MAXIMA:: POLY &OPTIONAL),
; conflicting with the declared function return type
; (VALUES &OPTIONAL LIST &REST T).
; See also:
; The SBCL Manual, Node "Handling of Types"
;
; compilation unit finished
; caught 1 WARNING condition
(%o1) C:/maxima-5.48.1/share/maxima/5.48.1/share/contrib/trigtools/trigtools.mac
以atan_contract指令直接計算
求\(\displaystyle tan^{-1}\frac{1}{3}+tan^{-1}\frac{1}{5}+tan^{-1}\frac{1}{7}+tan^{-1}\frac{1}{8}\)之值為何?
(99大安高工,https://math.pro/db/viewthread.php?tid=960&page=1#pid2178)
(%i2) atan_contract(atan(1/3)+atan(1/5)+atan(1/7)+atan(1/8));
(%o2) \(\displaystyle \frac{\pi}{4}\)
以atan_contract指令直接計算
Find the value of \( 10 cot(cot^{-1}3+cot^{-1}7+cot^{-1}13+cot^{-1}21) \).
(1984AIME,https://artofproblemsolving.com/ ... Problems/Problem_13)
(%i3) atan_contract(acot(3)+acot(7)+acot(13)+acot(21));
(%o3) \(\displaystyle atan\left(\frac{2}{3}\right)\)
相加的結果再求10cot()得到答案
(%i4) 10*cot(%);
(%o4) \(15\)
以atan_contract指令直接計算
試求正整數n使得下式成立\( \displaystyle tan^{-1} \frac{1}{3}+tan^{-1} \frac{1}{4}+tan^{-1} \frac{1}{5}+tan^{-1} \frac{1}{n}=\frac{\pi}{4} \)。
(2008AIME,https://artofproblemsolving.com/ ... 008_AIME_I_Problems)
(99東山高中,https://math.pro/db/thread-941-1-1.html)
(%i5) atan(1/n)=atan_contract(%pi/4-(atan(1/3)+atan(1/4)+atan(1/5)));
(%o5) \(\displaystyle atan\left(\frac{1}{n}\right)=atan\left(\frac{1}{47}\right)\)
解出答案\(n\)
(%i6) solve(%,n);
(%o6) \([n=47]\)
atan_add副程式顯示\(\displaystyle atan(x)+atan(y)=atan\left(\frac{x+y}{1-xy}\right)\)計算過程
(%i7)
atan_add(atan1,atan2):=block([x:tan(atan1),y:tan(atan2)],
print(atan1,"+",atan2,"=atan(",sconcat(x,"+",y)/sconcat(1,"-",x,"*",y),")=",atan_contract(atan1+atan2)))$
\(\displaystyle tan^{-1}\frac{1}{3}+tan^{-1}\frac{1}{5}+tan^{-1}\frac{1}{7}+tan^{-1}\frac{1}{8}\)的計算過程
(%i8) lreduce(atan_add,[atan(1/3), atan(1/5), atan(1/7), atan(1/8)]);
\(\displaystyle atan\left(\frac{1}{3}\right)+atan\left(\frac{1}{5}\right)=atan\left(\frac{1/3+1/5}{1-1/3*1/5}\right)=atan\left(\frac{4}{7}\right)\)
\(\displaystyle atan\left(\frac{4}{7}\right)+atan\left(\frac{1}{7}\right)=atan\left(\frac{4/7+1/7}{1-4/7*1/7}\right)=atan\left(\frac{7}{9}\right)\)
\(\displaystyle atan\left(\frac{7}{9}\right)+atan\left(\frac{1}{8}\right)=atan\left(\frac{7/9+1/8}{1-7/9*1/8}\right)=\frac{\pi}{4}\)
(%o8) \(\displaystyle \frac{\pi}{4}\)
\( 10 cot(cot^{-1}3+cot^{-1}7+cot^{-1}13+cot^{-1}21) \)的計算過程
(%i9) lreduce(atan_add,[acot(3),acot(7),acot(13),acot(21)]);
\(\displaystyle acot(3)+acot(7)=atan(\frac{1/3+1/7}{1-1/3*1/7})=atan\left(\frac{1}{2}\right)\)
\(\displaystyle atan\left(\frac{1}{2}\right)+acot(13)=atan\left(\frac{1/2+1/13}{1-1/2*1/13}\right)=atan\left(\frac{3}{5}\right)\)
\(\displaystyle atan\left(\frac{3}{5}\right)+acot(21)=atan\left(\frac{3/5+1/21}{1-3/5*1/21}\right)=atan\left(\frac{2}{3}\right)\)
(%o9) \(\displaystyle atan\left(\frac{2}{3}\right)\)
相加的結果再求10cot()得到答案
(%i10) 10*cot(%);
(%o10) \(15\)
\( \displaystyle tan^{-1} \frac{1}{3}+tan^{-1} \frac{1}{4}+tan^{-1} \frac{1}{5}+tan^{-1} \frac{1}{n}=\frac{\pi}{4} \)的計算過程
(%i11) sum:lreduce(atan_add,[atan(1/3), atan(1/4), atan(1/5), atan(1/n)]);
\(\displaystyle atan\left(\frac{1}{3}\right)+atan\left(\frac{1}{4}\right)=atan\left(\frac{1/3+1/4}{1-1/3*1/4}\right)=atan\left(\frac{7}{11}\right)\)
\(\displaystyle atan\left(\frac{7}{11}\right)+atan\left(\frac{1}{5}\right)=atan\left(\frac{7/11+1/5}{1-7/11*1/5}\right)=atan\left(\frac{23}{24}\right)\)
\(\displaystyle atan\left(\frac{23}{24}\right)+atan\left(\frac{1}{n}\right)=atan\left(\frac{23/24+1/n}{1-23/24*1/n}\right)=atan\left(\frac{1}{n}\right)+atan\left(\frac{23}{24}\right)\)
(%o11) \(\displaystyle atan\left(\frac{1}{n}\right)+atan\left(\frac{23}{24}\right)\)
解出答案\(n\)
(%i12) solve(sum=%pi/4, n);
(%o12) \( \left[n=-\left(\frac{1}{tan\left(atan\left(\displaystyle \frac{23}{24}\right)\displaystyle-\frac{\pi}{4}\right)}\right)\right]\)
用trigexpand化簡答案\(n\)
(%i13) trigexpand(%);
(%o13) \([n=47]\)
\( \displaystyle tan^{-1} \frac{1}{3}+tan^{-1} \frac{1}{4}+tan^{-1} \frac{1}{5}+tan^{-1} \frac{1}{n}=\frac{\pi}{4} \)的計算過程
(%i14) sum=%pi/4;
(%o14) \(\displaystyle atan\left(\frac{1}{n}\right)+atan\left(\frac{23}{24}\right)=\frac{\pi}{4}\)
移項
(%i15) %-part(%,1,2);
(%o15) \(\displaystyle atan\left(\frac{1}{n}\right)=\frac{\pi}{4}-atan\left(\frac{23}{24}\right)\)
\(\displaystyle \frac{\pi}{4}-atan\left(\frac{23}{24}\right)\)的計算過程
(%i16) lhs(%)=atan_add(%pi/4,-atan(23/24));
\(\displaystyle \frac{\pi}{4}+-atan\left(\frac{23}{24}\right)=atan\left(\frac{1+-(23/24)}{1-1*-(23/24)}\right)=atan\left(\frac{1}{47}\right)\)
(%o16) \(\displaystyle atan\left(\frac{1}{n}\right)=atan\left(\frac{1}{47}\right)\)
解出答案\(n\)
(%i17) solve(%,n);
(%o17) \([n=47]\)