function [Q3,V] = syndivf(X3,c) % [Q3,V] = syndivf(X3,c) % X3 is matrix coefficients of % a polynomial P(x). % c is a number. % Result V is P(c) % Q3 is coefficients of quotient % Here is the way it was done in octave since % 3 dimensional arrays were preserved test=size(X3); shape=test([1,2]); Q3=zeros([shape,0]); % Q3 initially empty n=test(3); V=X3(:,:,1); % V starts with leading term for k=2:n Q3=cat(3,Q3,V); V=V*c+X3(:,:,k); % V added to quotient, then updated % so remainder kept separate end%for end%function % Rutgers teaching code by R. T. Bumby