Question: ( a ) Write a Python function which has the single argument n and returns the sum of the natural logarithms of the first n

(a) Write a Python function which has the single argument n and returns
the sum of the natural logarithms of the first n natural numbers.
(b) Use the function you wrote in part (a) to calculate the sum of the
natural logarithms of the first 100 natural numbers.
(c) Write a Python function which returns the minimum value of n such
that
i=1nln(i)T
for some given number T.
(d) Use the function you wrote in part (c) to find the minimum number of
terms needed such that the sum of the logarithms is greater than 100.
(e) A student has written the following code to calculate the real roots of
the quadratic equation ax2+bx+c=0, where a,b and c are real, or
return a message if there are none.
def solve_quadratic (a,b,c):
disc = b^2-4c
if disc 0 then:
return There are no real solutions to your equation
else
solsmall =(-b-sqrt(disc))/(2/a)
sollarge =(-b+sqrt(disc))/(2/a)
return solsmall, solarge
Explain the errors in this code, and correct them to produce a working
function. Use your corrected code to find the real roots, if any, of
4x2+19x-5=0 and 4x2+19x+100=0
( a ) Write a Python function which has the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!