Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# sqrt.py import stdio import sys # Accept float c as a command-line argument. Write to standard # output the square root of c to

image text in transcribed

# sqrt.py import stdio import sys # Accept float c as a command-line argument. Write to standard # output the square root of c to 15 decimal places of accuracy # Use Newton's method. EPSILON = 1e-15 c float(sys.argv[1]) while abs(t c/t) >(EPSILON t) # Replace t by the average of t and c/t. t -(c/tt) 2.e stdio.writeln(t) Problem 3. (Newton's Method) Using Program 1.3.6 (sqrt.py) from the IPP text as a model, develop a program root.py that takes a float c and an integer k as command-line arguments and writes Vc (kth root of c) to 5 decimal places of accuracy, ie, use e = 0.00001. Hint: at each iteration replace the estimate t by t f(t)/f(t), where f(z-ak c and f,(x) = ka k-1. and use the condition |1 c/t>eto continue the loop. s Python root.py 3 2 1.73205081001 python root.py 64 3 4.00000050864

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

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions

Question

Understand why empowerment is so important in many frontline jobs.

Answered: 1 week ago