Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I would like to know how to answer this question, it has to be done all in MATLAB and I'm new to it so I

I would like to know how to answer this question, it has to be done all in MATLAB and I'm new to it so I am having a hard time figuring out how it's done.

The natural logarithm function loge(1 + x) can be approximated by the following formula image text in transcribed for -1

(a) Write a function using for or while loop that computes an approximation to natural logarithm function loge(1 + x) using the above formula. Your function must take x and n as function input arguments. n is the number of terms you want to keep in your approximation. The approximation will get more accurate if you keep more terms.

(b) Re-write your function using vectorization techniques.

(c) Determine the minimum number of terms you need to approximate loge(0.5) = -0.69314718 to eight decimal digits? Print out your result on the screen as follows: "It takes n=1000 terms to approximate log(0.5) = -0.69314718 to six digits, the approximation is -0.693147179453401."

(d) Compute the error in the approximation to log(0.5) = -0.69314718 using n = 1, 5, 10, 25, 50, 100, 1000 terms in the above formula. Print a nice table of the results as follows:

n Approximation Error
1 -0.500000000000000 1.931471800000000e-01
5 ...
10 ...
25 ...
50 ...
100 ...
1000 ...

In g2z3 14 T" n+1 I--+-+-+... n

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions

Question

3. What strategies might you use?

Answered: 1 week ago

Question

3. Write a policy statement to address these issues.

Answered: 1 week ago