1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Olegator [25]
3 years ago
7

Package Newton’s method for approximating square roots (Case Study 3.6) in a function named newton. This function expects the in

put number as an argument and returns the estimate of its square root. The script should also include a main function that allows the user to compute square roots of inputs until she presses the enter/return key.
Computers and Technology
1 answer:
notka56 [123]3 years ago
8 0

Answer:

import math

#Initialize tolerance

tolerance = 0.000001

def newton(x):

   """ Returns the square root of x """

   #Performs the successive approximations

   estimate = 1.0

   while True:

       estimate = (estimate + x / estimate) / 2

       difference = abs(x - estimate ** 2)

       if difference <= tolerance:     # Break out of loop if difference is less than tolerance

           break            

       return estimate     # While the difference value is > TOLERANCE, the process continues

def main():

   """Allows the user to obtain square roots."""

   while True:

       #Receive the input number from the user

       x = input("Enter a positive number or enter/return to quit: ")

       if x == "":     #if user presses "Enter" then exit the program

           break       # Otherwise, continue the process of allowing new numbers

       x = float(x)

       #Output the result

       print("The programs estimate of the square root of ", x, "is ", round(newton(x),2))

       print("Python's estimate: ", math.sqrt(x))

main()

You might be interested in
A desktop computer is not able to connect to a wireless network (WLAN). What are the step-by-step troubleshooting steps and proc
lara [203]

Answer:

  1. you should first check your hotspot connection and then if your pc is not connected so you can replace an aeroplane mode on your pc.
8 0
3 years ago
A blue compressor clutch indicates that it's been slipping due to too
SVETLANKA909090 [29]

Answer:

Hi,

This effect can be due to <u>dull/ unpolished clutch c</u>aused by incorrect amount of oil in the system

Explanation:

Clutch is the third highest failures observed in AC after hose leaks and compressors.Some of the clutch related failures are bearing failure, burnt coil, unbalanced motor to air hub gap, noisy bearing ,and unpolished clutch.Burnishing of a clutch is when the wearing  of the engagement surface if the clutch is allowed to increase the starting torque.The effect of dull clutch is that it produces low staring torque making it to slip and fail.When too much oil is applied, it will cause the compressor to slug and the clutch to slip.Low amounts of oil will cause the compressor to bind and the clutch to slip because of increased discharge pressures in the system.

Best of Luck!

6 0
3 years ago
____________________ sites are remote servers accessible with a browser that contain common collections of diagnostic tools such
Sergio [31]

Answer:

Looking glass

Explanation:

_____ sites are remote servers accessible with a browser that contain common collections of diagnostic tools such as ping and traceroute, plus some Border Gateway Protocol (BGP) query tools.

Looking glass

6 0
2 years ago
Newton's method has the advantage of having a faster quadratic convergence rate over the other methods such as Secant and bisect
zmey [24]

Answer:

a. True

Explanation:

The Newton's method (Newton-Raphson method) used in advanced statistical computing can be used for a continuous and differentiable function that can be approximated by a straight line tangent to it. It requires the derivative of the function to be known, Newton's method converges faster that is whenever it converges. Newton Raphson Method has quadratic convergence which is faster, and the quadratic convergence makes the error in the next iteration increase by the square of the value of the previous iteration.

3 0
3 years ago
The Internet may best be compared to a/an
Usimov [2.4K]
A volcano because its always erupting
3 0
3 years ago
Other questions:
  • For which is a chart legend used?
    7·1 answer
  • In two to four sentences describe how you would center text?
    14·2 answers
  • In each iteration, selection sort (small) places which element in the correct location?
    9·1 answer
  • Both k-means and k-medoids algorithms can perform effective clustering. (a)Explain the strength and weakness of k-means in compa
    5·1 answer
  • A company used computer auditing techniques to compare employees' telephone numbers with vendors' telephone numbers. This is an
    10·2 answers
  • Which statement best justifies the use of a high-speed cache in a CPU?
    11·1 answer
  • With which type of test question should you leave yourself extra time to answer?
    14·2 answers
  • Unlike when writing in a programming language, there are no set rules that must be followed when writing pseudocode. What do you
    13·1 answer
  • 236. A system such as a printer, smart TV, or HVAC controller, typically uses an operating system on what is called a:
    13·2 answers
  • What is used for risk response control?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!