% solve problems 1-2 on practice quiz 4
v=1./[1:10];
A=toeplitz(v);
det(A)
x=(1,0,0,0,0,0,0,0,0,0)';
y=A\x;

%----------------------------
% script to solve problems 4-6 on practice quiz 4
function out=detf(x)
A=eye(10);
N=toeplitz([0,1,0,0,0,0,0,0,0,0]);
B=A+x*N;
out=det(B);
%v=ones(10,1)
%y=B\v
return 
%----------------------------
% problem 6
% first plot the function to see there are 3 zeros 
ezplot(@detf,[0,1])

% plot shows last is between .75 and .8 so find it with 
fzero(@detf,[.75,.8])

% problem 7 on practice quiz 4

Q=zeros(8);
Q(1,2)=1;
Q(1,4)=1;
Q(2,3)=1;
Q(2,5)=1;
Q(3,6)=1;
Q(4,5)=1;
Q(4,7)=1;
Q(5,6)=1;
Q(5,7)=1;
Q(5,8)=1;
Q(6,8)=1;
Q(7,8)=1;
% important step
Q = Q+Q';
P=Q^20
P(1,8)