Here is matlab that should work
% cos(x) = 1 - (x^2)/2! + (x^4)/4! -(x^6)/6!+(x^8)/8!...
% let y= x*x
% cos(x) = sum( (-y)^n/(2n)! )
format short
x= 0.3*pi;
y= x*x;
for N= 1:6
n= 0:N;
s1= [(-y).^n./factorial(2*n) ]
mac= sum(s1);
cx= cos(x);
str= sprintf('%d terms. series: %12.10f cos(x): %12.10f\n %12.10f',...
N, mac,cx, (cx-mac));
disp(str);
end;