% This uses the integration formula to calculate the remainder. This was not % demonstrated in the class. quad function is used for Numerical % Integration. You can put a loop on line 7 from say 1:999 and then break % when the value in line 7 becomes less than 10^(-3). n = 3 ; x = 0.5 ; fun = @(t)(((x-t).^n)*((t.^(n+1))*((-1).^n)/((n+1)*((1+t).^(n+1))))) ; (1/factorial(n)) * quad (fun, 0, x)