How do you find the maximum error in series?

2 views (last 30 days)
Yianni
Yianni on 10 Oct 2014
Edited: the cyclist on 10 Oct 2014
clear all, close all
%Case 1: Find FN for N (being a value based on a user's input)
FN = 0; x=.75;
prompt = 'What is the value of N? ';
N = input(prompt);
for n = 1:N
FN = FN + (((-1)^(n+1))*(x^n))/(n);
end
fprintf(' Case 1: Value of FN for N = %4i is %6i \n\n',N,FN)
% Case 2: Find maximum value of N such that FN <= ln(1.75)
LN = log(1+x); FN = 0; n = 2;
while FN > LN
n = n+1;
FN = FN + (((-1)^(n+1))*(x^n))/(n);
end
N = n;
fprintf(' Case 2: Value of FN = %6i for N = %4i \n\n',FN,N)
%
% end of program
THE FIRST CASE OF THE PROGRAM WORKS HOWEVER I CANNOT FIGURE OUT HOW TO FIND THE MAXIMUM VALUES THAT "N" CAN BE.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!