This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: accuracy N = input('Your input N is beyond machine accuracy.Enter lesser N : '); Tol = 10^(N); % new required error break; else % if req. error is more eps, break the loop break; end end approx_old = x; %first term of sine series is set as initial value %add the remaining additional terms for n=2:1000 approx_new = approx_old + ((1)^(n+1))*(x^(2*n1))/factorial(2*n1); RE = abs((approx_newapprox_old)/approx_old) ;% relative error if(RE <= Tol) % if the required tolerance is met, break break; end approx_old = approx_new; end %number of terms & final approximation terms = n; approximation = approx_new; disp(['Number of terms added : ' num2str(terms)]); disp(['Final approximation is : ' num2str(approximation,15)]); disp(['Relative error is : ' num2str(RE,15)]);...
View
Full Document
 Spring '07
 Milstein
 maximum sum total, sine value Tol, required error break

Click to edit the document details