function [s,term] = expX(x,n); t = 1; s = t; term = zeros(n,1); for j = 1:n, t = t*(x/j); s = s + t; term(j) = t; end