Matlab math Cleve morler者 陈文斌(wbchen(@fudan.edu.cn) 复旦大学2002年
Matlab Math Cleve Morler著 陈文斌(wbchen@fudan.edu.cn) 复旦大学2002年
http://www.stanford.edw/class/cs138/mlmath.html
http://www.stanford.edu/class/cs138/mlmath.html
黄金分割
黄金分割 1 1 −1 =
c2--1=0 =1±√s MATLAB p=1-1-11(x)=x2-x-1 I=roots(p) 0.61803398874989 1.61803398874989 C(1)*X^N+….+C(N)*+C(N+1)=0
1 1 −1 = 1 0 2 − − = 2 1 5 = p = [1 –1 –1]; r = roots(p); ( ) 1 2 p x = x − x − r = -0.61803398874989 1.61803398874989 C(1)*X^N + ... + C(N)*X + C(N+1) = 0
符号工具箱 ATLAB Mapple r=solve(1/x=X-1) [1/2*5^(1/2)+1/2] phi =r(1) [1/2-1/2*5^(1/2) vpa(phi, 50) 1/2*5^(12)+1/2 1.6180339887498948482045868343656381177203091798058 phi= double(phi 1.61803398874989
r = solve(‘1/x = x-1’); r = [ 1/2*5^(1/2)+1/2] [ 1/2-1/2*5^(1/2)] 符号工具箱 Mapple phi = r(1) vpa (phi,50) 1/2*5^(1/2)+1/2 1.6180339887498948482045868343656381177203091798058 phi = double(phi) 1.61803398874989
图形的方法 ATLAB f=inline(1/x(X-1) ezplot(f,0, 4) phi= fzero(f,1) hold on plot(phi, 0, 0)
图形的方法 f = inline('1/x-(x-1)') ezplot(f,0,4) phi = fzero(f,1) hold on plot(phi,0,’o’)
结果图 x-(x-1) 6 2 0 2.5 3.5
0 0.5 1 1.5 2 2.5 3 3.5 4 -3 -2 -1 0 1 2 3 4 5 6 7 x 1/x-(x-1) 结果图
黄金分割图
- 1 1 1 黄金分割图
%GOLDRECT Golden rectangle GOLDRECt plots the golden rectangle phi=(1+sqrt(5)/2; x=[0 phi phil 0] y=[00110];u=[11];v=[01 plot(x,y, b, u,v, b--); text(phi/2, 1.05, phi) text(1+phi)/2,-05,phi-1); text(-.05,5,"1);text(5,-05,1) axis equa aXIs o f set(gcf, color, white,)
%GOLDRECT Golden Rectangle % GOLDRECT plots the golden rectangle phi = (1+sqrt(5))/2; x = [0 phi phi 0 0]; y = [0 0 1 1 0]; u = [1 1]; v = [0 1]; plot(x,y,'b',u,v,'b--'); text(phi/2,1.05,'\phi') text((1+phi)/2,-.05,'\phi - 1'); text(-.05,.5,'1'); text(.5,-.05,'1') axis equal axis off set(gcf,'color','white')
连分式 a H =1+ l
连分式 ... 1 1 1 3 2 1 0 + + + + a a a a 1 ... 1 1 1 1 1 1 + + + = +