0% found this document useful (0 votes)
59 views4 pages

Assignment-2 Natural Log

The document discusses computing the natural logarithm of 2 (ln(2)) using its power series representation. It evaluates the series using different methods: - Computing the first 10 and 15 terms by hand and comparing to ln(2), finding the 15 term approximation is more accurate. - Repeating the computation with more digits of precision, finding increased accuracy. - Computing the series backwards, finding it gives a different result than the forward direction. - Considering factors like using an even number of terms, more terms, and more digits of precision generally increase accuracy but require more computational resources.

Uploaded by

Deepanshu Goyal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views4 pages

Assignment-2 Natural Log

The document discusses computing the natural logarithm of 2 (ln(2)) using its power series representation. It evaluates the series using different methods: - Computing the first 10 and 15 terms by hand and comparing to ln(2), finding the 15 term approximation is more accurate. - Repeating the computation with more digits of precision, finding increased accuracy. - Computing the series backwards, finding it gives a different result than the forward direction. - Considering factors like using an even number of terms, more terms, and more digits of precision generally increase accuracy but require more computational resources.

Uploaded by

Deepanshu Goyal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

ASSIGNMENT- 2

NATURAL LOG
DEEPANSHU GOYAL
100407185

(a) By hand compute this series for the first 10 terms. What is your
answer? How much does it differ from ln(2)?

Computing the value of first 10 terms, I get 0.65 as the result.


Difference between ln(2) and 0.65 is 0.04

(b) By hand compute it again for the first 15 terms. Now how much
does it differ? Is it more “accurate”?
Computing the value of first 10 terms, I get 0.72 as the result.
Difference between ln(2) and 0.72 is 0.03

(c) Try computing the first 10 and 15 terms of this series again but this
time using 3-digit arithmetic throughout. Is it more “accurate”?
Yes, its more accurate.
(d) Now try it backwards using 2-digit arithmetic throughout. Sum up
the first 10 terms of the series, but starting with -1/10, and then 1/9,
etc. Do you get a more accurate answer? Or does the direction make
any difference?
The direction does make a difference, as the value is different from
the forward calculation. (0.64)

(e) So think about how you would get the best approximation of ln(2).
Should you use:-
a. an even number of terms or an odd number?
Using an even number of terms can result in cancellation of errors or
like-terms, especially when the terms have alternating signs. This can
lead to a more accurate approximation.
Trade-Off -> We cannot use odd number of terms if we want to get best
approximation of ln(2).

b. more terms or less terms in the series?


Using more terms generally leads to a more accurate approximation.
However, this comes at the cost of computational resources and time.
Trade-Off -> Using more terms would take more time to compute the
values and estimate the result.

c. more digits to the right of the decimal point or less digits?


Using more digits increases precision and can lead to a more
accurate result.
Trade-Off -> This requires more computational resources, time and may
not always be feasible or necessary depending on the application.

d. Summing forwards is the more standard approach. Summing


backwards can introduce additional numerical stability issues due to the
accumulation of small values.
Trade-Off -> Summing in the opposite direction (backwards) can lead to
larger rounding errors.

On comparing the outputs with original value of ln(2)


(0.6931471805599453) , the most approximate output is given by
sumSeriesForwardsTwoHalves (0.693147180062864) , with only a
difference of 0.0000000004970813 from ln(2).
The differences between value of ln(2) and outputs given by 6 methods
upon taking 1000000000 as number of terms are as follows:

sumSeriesForwardsDouble : 0.0000000004992983
sumSeriesBackwardsDouble : 0.0000000005000003
sumSeriesForwardsTwoHalves : 0.0000000004970813
sumSeriesBackwardsTwoHalves : 0.0000000005004053
sumSeriesForwardsFloat : 0.0000096540477993
sumSeriesBackwardsFloat : 0.0000000019046547
The results vary due to following reasons:-
• sumSeriesForwardsDouble and sumSeriesBackwardsDouble use
the double data type, which has higher precision than float. They
provide results that are very close, but not necessarily identical,
due to the way floating-point arithmetic works.
• sumSeriesForwardsTwoHalves and
sumSeriesBackwardsTwoHalves sum positive and negative terms
separately before combining them. This can introduce additional
rounding errors compared to summing all terms together.
• sumSeriesForwardsFloat and sumSeriesBackwardsFloat use the
float data type, which has lower precision than double. As a
result, they provide results that are further from the true value of
the series.

You might also like