Question
PROBLEM 2. WHILE LOOP Write a matlab script using a while loop structure to compute the natural log (2) using the harmonic series: Ln(2)= 1
PROBLEM 2. WHILE LOOP Write a matlab script using a while loop structure to compute the natural log (2) using the harmonic series: Ln(2)= 1 -1/2+ 1/3 1/4 + 1/5 - 1/6+ - (-1)^k/k + Notice that each term equals -(-1)^k/k, where k increases by 1 with each successive term (in other words, k =1 for the first term, k=2 for the second term, etc.). Keep adding successive terms until the series value changes by less than 0.001 (in other words when absolute value of -(-1)^k/k is less than 0.001). How many terms were added (what is the value of k)? Compare the output of the series to the output of the log command.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started