Prove that the natural logarithm of (1 + x) for |x| < 1 is: x3 In(1 + x) = x - 3 n! Show that the accuracy of your series solution is higher ifn is larger. So repeat the solution for 2 different values of n, one of which is larger than 4 and the other smaller than 4. You must use a recursive loop within a function to evaluate the right hand side of the equation above.
Prove that the natural logarithm of (1 + x) for |x| < 1 is: x3 In(1 + x) = x - 3 n! Show that the accuracy of your series solution is higher ifn is larger. So repeat the solution for 2 different values of n, one of which is larger than 4 and the other smaller than 4. You must use a recursive loop within a function to evaluate the right hand side of the equation above.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
100%
I am doing some practice in basic Python and a bit hung up on this piece. Could someone review the question and my progress thus far?

Transcribed Image Text:Prove that the natural logarithm of (1 + x) for |x| < 1 is:
x²
In(1 + x) = x -
3
4
n!
Show that the accuracy of your series solution is higher ifn is larger. So repeat the solution for 2 different values of n, one of which is larger than 4 and the
other smaller than 4.
You must use a recursive loop within a function to evaluate the right hand side of the equation above.
![In [37]:
H import math
x = 0.75
n1 = 5
n2 = 3
In [38]: M LHS = (np.log(1 + x))
In [40]:
N Sum_RHS_n1 = 1
Factorial_i = 1
In [42]: for i in range (1, n1 + 1):
x = (math.fabs (x))
Sum_RHS_n1 = Sum_RHS_n1 - (x**i) * ((1)**i)
print((x**i) * ((-1)**i))
-0.75
8.5625
-0.421875
0.31640625
-0.2373046875
In [43]: H print('The value of the expression on the RHS is', Sum_RHS_n1)
print('The value of the expression on the LHS is', LHS)
The value of the expression on the RHS is -3.576171875
The value of the expression on the LHS is 0.5596157879354227
In [44]: Sum_RHS_n2 = 1
In [35]: N for i in range (1, n2 + 1):
Sum_RHS_n2 = Sum_RHS_n2 + (x**i) * ((-1)**i)](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F20ef5b89-bdf5-4ebf-bc1c-34f412b810c9%2F6bcda1cc-7dec-4782-a56a-bd06ed04a4e9%2Fwfe4o9_processed.jpeg&w=3840&q=75)
Transcribed Image Text:In [37]:
H import math
x = 0.75
n1 = 5
n2 = 3
In [38]: M LHS = (np.log(1 + x))
In [40]:
N Sum_RHS_n1 = 1
Factorial_i = 1
In [42]: for i in range (1, n1 + 1):
x = (math.fabs (x))
Sum_RHS_n1 = Sum_RHS_n1 - (x**i) * ((1)**i)
print((x**i) * ((-1)**i))
-0.75
8.5625
-0.421875
0.31640625
-0.2373046875
In [43]: H print('The value of the expression on the RHS is', Sum_RHS_n1)
print('The value of the expression on the LHS is', LHS)
The value of the expression on the RHS is -3.576171875
The value of the expression on the LHS is 0.5596157879354227
In [44]: Sum_RHS_n2 = 1
In [35]: N for i in range (1, n2 + 1):
Sum_RHS_n2 = Sum_RHS_n2 + (x**i) * ((-1)**i)
Expert Solution

Step 1
Term Xn / n! in RHS seems irrelevant as Taylor or Maclaurin series for ln(1+x) does not have that term.
As question description ask to use recursive approach, solution uses recursive method.
recursive function take following parameters,
x - value of x
n - value of n
current_n - value of n in current recursive call. Increase by 1 for every recursive call and starts with 1
result - total result up to current recursion call. Act as the accumulator for RHS and it starts with 0.
Step by step
Solved in 3 steps with 1 images

Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education