A = [2 1; 1 2]; 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,'r*-'); xtitle('Plot of 2x^2 + 2xy + 2y^2 = +/- 1','x','y');