42 12345
發新話題
打印

用Maxima解題


數學圖形素描教室:用旋轉曲面、多面體、拓樸形狀來創作!結合數學與美學的全新領域
数学デッサン教室 描いて楽しむ数学のかたち
作者: 瑞慶山 香佳
譯者: 陳朕疆
出版社:台灣東販
出版日期:2019/10/28

節錄書中蘋果曲面參數式

◎蘋果曲面的製作方法
  該怎麼建構出蘋果曲面呢?讓我們來看看製作方法吧。
①建構出一個環面。
\(\cases{x=(4+cos u)cos v \cr y=(4+cos u)sin v \cr z=5 sin u},-\pi \le u \le \pi,0 \le v \le 2 \pi\)
②調整成接近角狀環面的形狀。
\(\cases{x=(4+3.8cos u)cos v \cr y=(4+3.8 cos u)sin v \cr z=5sin u},-\pi \le u \le \pi,0\le v \le 2 \pi\)
③調整成上方較胖,下方較瘦的形狀。
\(\cases{x=(4+3.8 cos u)cos v \cr y=(4+3.8 cos u)sin v \cr z=5sin u+2 cos u},-\pi \le u \le \pi,0\le v \le 2\pi\)
④建構出蘋果的芯。
\(\cases{x=(4+3.8 cos u)cos v \cr y=(4+3.8 cos u)sin v \cr z=-5log_{10}(1-0.315u)+5sin u+2 cos u},-\pi \le u \le \pi,0\le v \le 2\pi\)



以前要先載入draw.lisp才能使用draw3d指令
但現在draw3d已經是maxima內建指令不再需要先載入draw.lisp

(%i1) load("draw");
(%o1) C:/maxima-5.43.0/share/maxima/5.43.0/share/draw/draw.lisp

以vtk當作渲染器
(%i2) draw_renderer: 'vtk;
(%o2) vtk

①建構出一個環面
(%i6)
x: (4+cos(u))*cos(v);
y: (4+cos(u))*sin(v);
z:5*sin(u);
draw3d(enhanced3d=true,
              parametric_surface(x,y,z,u,-%pi,%pi,v,0,2*%pi));

(x) \((cos(u)+4)cos(v)\)
(y) \((cos(u)+4)sin(v)\)
(z) \(5sin(u)\)
(%o6) done


②調整成接近角狀環面的形狀
(%i10)
x: (4+3.8*cos(u))*cos(v);
y: (4+3.8*cos(u))*sin(v);
z:5*sin(u);
draw3d(enhanced3d=true,
              parametric_surface(x,y,z,u,-%pi,%pi,v,0,2*%pi));

(x) \((3.8cos(u)+4)cos(v)\)
(y) \((3.8cos(u)+4)sin(v)\)
(z) \(5sin(u)\)
(%o10) done


③調整成上方較胖,下方較瘦的形狀
(%i14)
x: (4+3.8*cos(u))*cos(v);
y: (4+3.8*cos(u))*sin(v);
z:5*sin(u)+2*cos(u);
draw3d(enhanced3d=true,
              parametric_surface(x,y,z,u,-%pi,%pi,v,0,2*%pi));

(x) \((3.8cos(u)+4)cos(v)\)
(y) \((3.8cos(u)+4)sin(v)\)
(z) \(5sin(u)+2cos(u)\)
(%o14) done


④建構出蘋果的芯
(%i18)
x: (4+3.8*cos(u))*cos(v);
y: (4+3.8*cos(u))*sin(v);
z:-5*log(1-0.315*u)/log(10)+5*sin(u)+2*cos(u);
draw3d(enhanced3d=true,
              parametric_surface(x,y,z,u,-%pi,%pi,v,0,2*%pi));

(x) \((3.8cos(u)+4)cos(v)\)
(y) \((3.8cos(u)+4)sin(v)\)
(z) \(\displaystyle 5sin(u)+2cos(u)-\frac{5log(1-0.315u)}{log(10)}\)
(%o18) done

TOP

要先載入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]\)

TOP

 42 12345
發新話題