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
icon
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?

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.
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)
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
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education