-->dir ans = Thumbs.db oracle.pdf plotquad.in trans.fun Windows Media Player.lnk plot.in problems.sce trans.sci arrowdemo.in plot1.png sep16.txt vat.in iterate2d.in plot2.eps sphereplot.in vati.in iterate3d.in plot2.png su09.sci zz.sce -->A=[1 1;1 -1] A = 1. 1. 1. - 1. -->inv(A) ans = 0.5 0.5 0.5 - 0.5 -->eye(3,3) ans = 1. 0. 0. 0. 1. 0. 0. 0. 1. -->B=[A eye(2,2)] B = 1. 1. 1. 0. 1. - 1. 0. 1. -->rref(B) ans = 1. 0. 0.5 0.5 0. 1. 0.5 - 0.5 -->B B = 1. 1. 1. 0. 1. - 1. 0. 1. -->B(2,:)=B(2,:)-B(1,:) B = 1. 1. 1. 0. 0. - 2. - 1. 1. -->B(2,:)=B(2,:)/(-2) B = 1. 1. 1. 0. 0. 1. 0.5 - 0.5 -->B(1,:)=B(1,:) - B(2,:) B = 1. 0. 0.5 0.5 0. 1. 0.5 - 0.5 -->Ainverse = B(:,3:4) Ainverse = 0.5 0.5 0.5 - 0.5 -->A^(-1) ans = 0.5 0.5 0.5 - 0.5 -->1/A ans = 0.5 0.5 0.5 - 0.5 -->A=[2 1; 4 2] A = 2. 1. 4. 2. -->A^(-1) !--error 19 Problem is singular. -->rref([A eye(2,2)]) ans = 1. 0.5 0. 0.25 0. 0. 1. - 0.5 -->A=[1 2 0 1 3; 3 4 2 3 3; 1 3 -1 0 1] A = 1. 2. 0. 1. 3. 3. 4. 2. 3. 3. 1. 3. - 1. 0. 1. -->A(2,:)=A(2,:)-3*A(1,:) A = 1. 2. 0. 1. 3. 0. - 2. 2. 0. - 6. 1. 3. - 1. 0. 1. -->A(3,:) = A(3,:)-A(1,:) A = 1. 2. 0. 1. 3. 0. - 2. 2. 0. - 6. 0. 1. - 1. - 1. - 2. -->A(2,:) = A(2,:)/(-2) A = 1. 2. 0. 1. 3. 0. 1. - 1. 0. 3. 0. 1. - 1. - 1. - 2. -->A(1,:) = A(1,:) -2*A(2,:) A = 1. 0. 2. 1. - 3. 0. 1. - 1. 0. 3. 0. 1. - 1. - 1. - 2. -->A(3,:) = A(3,:) -1*A(2,:) A = 1. 0. 2. 1. - 3. 0. 1. - 1. 0. 3. 0. 0. 0. - 1. - 5. -->A(3,:)=A(3,:)/(-1) A = 1. 0. 2. 1. - 3. 0. 1. - 1. 0. 3. 0. 0. 0. 1. 5. -->A(1,:)=A(1,:)-A(3,:) A = 1. 0. 2. 0. - 8. 0. 1. - 1. 0. 3. 0. 0. 0. 1. 5. -->for i=1:5, 2^i, end ans = 2. ans = 4. ans = 8. ans = 16. ans = 32. -->for i=1:5, 2^i, end ans = 2. ans = 4. ans = 8. ans = 16. ans = 32. -->lines(0) -->for i=1:5, 2^i, end ans = 2. ans = 4. ans = 8. ans = 16. ans = 32. -->for i=1:5 -->2^i -->end ans = 2. ans = 4. ans = 8. ans = 16. ans = 32. -->for i=1:5 -->2^i -->for i=1:5, 2^i, end -->for i=1:5, 2^i, end -->for i=1:5, 2^i, end -->A -->end ans = 2. ans = 2. ans = 4. ans = 8. ans = 16. ans = 32. ans = 2. ans = 4. ans = 8. ans = 16. ans = 32. ans = 2. ans = 4. ans = 8. ans = 16. ans = 32. A = 1. 0. 2. 0. - 8. 0. 1. - 1. 0. 3. 0. 0. 0. 1. 5. ans = 4. ans = 2. ans = 4. ans = 8. ans = 16. ans = 32. ans = 2. ans = 4. ans = 8. ans = 16. ans = 32. ans = 2. ans = 4. ans = 8. ans = 16. ans = 32. A = 1. 0. 2. 0. - 8. 0. 1. - 1. 0. 3. 0. 0. 0. 1. 5. ans = 8. ans = 2. ans = 4. ans = 8. ans = 16. ans = 32. ans = 2. ans = 4. ans = 8. ans = 16. ans = 32. ans = 2. ans = 4. ans = 8. ans = 16. ans = 32. A = 1. 0. 2. 0. - 8. 0. 1. - 1. 0. 3. 0. 0. 0. 1. 5. ans = 16. ans = 2. ans = 4. ans = 8. ans = 16. ans = 32. ans = 2. ans = 4. ans = 8. ans = 16. ans = 32. ans = 2. ans = 4. ans = 8. ans = 16. ans = 32. A = 1. 0. 2. 0. - 8. 0. 1. - 1. 0. 3. 0. 0. 0. 1. 5. ans = 32. ans = 2. ans = 4. ans = 8. ans = 16. ans = 32. ans = 2. ans = 4. ans = 8. ans = 16. ans = 32. ans = 2. ans = 4. ans = 8. ans = 16. ans = 32. A = 1. 0. 2. 0. - 8. 0. 1. - 1. 0. 3. 0. 0. 0. 1. 5. -->A=[2 1; 1 3] A = 2. 1. 1. 3. -->X=[1;0] X = 1. 0. -->exec('interate2d.in') !--error 241 File "interate2d.in" does not exist or read access denied. -->exec('iterate2d.in') -->for i = 1:10, --> X = A*X; --> N = norm(X); --> X = X/N; --> printf("N = %f, X = [%f; %f], i = %d\n", N, X(1,1), X(2,1), i); -->end; N = 2.236068, X = [0.894427; 0.447214], i = 1 N = 3.162278, X = [0.707107; 0.707107], i = 2 N = 3.535534, X = [0.600000; 0.800000], i = 3 N = 3.605551, X = [0.554700; 0.832050], i = 4 N = 3.616203, X = [0.536875; 0.843661], i = 5 N = 3.617767, X = [0.529999; 0.847998], i = 6 N = 3.617995, X = [0.527363; 0.849640], i = 7 N = 3.618028, X = [0.526355; 0.850265], i = 8 N = 3.618033, X = [0.525969; 0.850504], i = 9 N = 3.618034, X = [0.525822; 0.850595], i = 10 -->exec('iterate2d.in'); N = 3.618034, X = [0.525766; 0.850629], i = 1 N = 3.618034, X = [0.525744; 0.850643], i = 2 N = 3.618034, X = [0.525736; 0.850648], i = 3 N = 3.618034, X = [0.525733; 0.850650], i = 4 N = 3.618034, X = [0.525732; 0.850650], i = 5 N = 3.618034, X = [0.525731; 0.850651], i = 6 N = 3.618034, X = [0.525731; 0.850651], i = 7 N = 3.618034, X = [0.525731; 0.850651], i = 8 N = 3.618034, X = [0.525731; 0.850651], i = 9 N = 3.618034, X = [0.525731; 0.850651], i = 10 -->A*X ./ X ans = 3.618034 3.618034 -->exec('plotquad.in') -->// Plot Quad plots the conic section for a given 2x2 symmetric matrix -->// It assumes that the matrix is A and it is already defined. -->// It plots black curves -->theta = 0:%pi/50:2*%pi; // %pi is scilab for the constant pi -->n = size(theta,2); // theta is a 1 x n row vector -->x = zeros(theta); // x and y start as zero vectors -->y = zeros(theta); -->for i = 1:n, --> angle = theta(i); // this angle --> c = cos(angle); --> s = sin(angle); --> X = [ c, s ]; --> r = sqrt(1/abs(X*A*X')); // formula from section 4 --> x(i) = r*c; // r cos(theta) --> y(i) = r*s; -->end; -->plot(x,y,'k-'); -->a = gca(); a.isoview="on"; -->title="Conic for A = ["+string(A(1,1))+" "+string(A(1,2)) +"; "+string(A(2,1))+" "+string(A(2,2))+"]"; Warning : redefining function: title . Use funcprot(0) to avoid this message -->xtitle(title,"x","y"); -->diary(0)