Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4 (17 Write an algorithm for computing square roots of positive numbers. One way is to use a guess and check approach G, e, guess

image text in transcribed
4 (17 Write an algorithm for computing square roots of positive numbers. One way is to use a guess and check approach G, e, guess the square root of 17 is 4.1, check by squaring 4. 4.1X4.1) 16.81J, so 4.1 is too small; try 4.12 1(4.124.12) - 169744] etc.) A programmable way of making guesses is to use Newton's method. Suppose x is the number we want the square root of and guess is the current guessed answer. The guess can b improved upon by using guessGuess + (x guess)) / 2 as the next guess Write the design specifications and the program that implements Newton's method Get the number to take the square root of (x) and the number of times to improve the guess from the user. Starting with an initial guess = x / 2, your program should loop the specified number of times applying Newton's method and report the final value of guess. You should also calculate the absolute value of difference (diference) between the square of your final gues gues2 and the value x to determine how dlose guess is to the square root of x Output both guess and difference rounded to two decimal places to the screen with appropriate messages such as: "The square root of"h approximately", round(guess,2) The difference between", x, "and the square of", guess, "is round diference 2) 5(#7, page l 18) Circle intersection. Write a program that computes the intersection ofa arde with a horizontal line and displays the information textually and graphically Input: Radius of the circle r and the y-intercept of the line Output. Draw a circle centered at (0,0) the given radius in a window with coordinates running from -10,-10 to 10,10. Draw a horizontal line across the window with the given intercept Draw the two points of intersection in red Print out the x values of the points of intersection Formula xy 4 (17 Write an algorithm for computing square roots of positive numbers. One way is to use a guess and check approach G, e, guess the square root of 17 is 4.1, check by squaring 4. 4.1X4.1) 16.81J, so 4.1 is too small; try 4.12 1(4.124.12) - 169744] etc.) A programmable way of making guesses is to use Newton's method. Suppose x is the number we want the square root of and guess is the current guessed answer. The guess can b improved upon by using guessGuess + (x guess)) / 2 as the next guess Write the design specifications and the program that implements Newton's method Get the number to take the square root of (x) and the number of times to improve the guess from the user. Starting with an initial guess = x / 2, your program should loop the specified number of times applying Newton's method and report the final value of guess. You should also calculate the absolute value of difference (diference) between the square of your final gues gues2 and the value x to determine how dlose guess is to the square root of x Output both guess and difference rounded to two decimal places to the screen with appropriate messages such as: "The square root of"h approximately", round(guess,2) The difference between", x, "and the square of", guess, "is round diference 2) 5(#7, page l 18) Circle intersection. Write a program that computes the intersection ofa arde with a horizontal line and displays the information textually and graphically Input: Radius of the circle r and the y-intercept of the line Output. Draw a circle centered at (0,0) the given radius in a window with coordinates running from -10,-10 to 10,10. Draw a horizontal line across the window with the given intercept Draw the two points of intersection in red Print out the x values of the points of intersection Formula xy

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

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions