answer.
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
patriot [66]
2 years ago
7

Convert Newton’s method for approximating square roots in Project 1 to a recursive function named newton. (Hint: The estimate of

the square root should be passed as a second argument to the function.) An example of the program
Computers and Technology
1 answer:
PIT_PIT [208]2 years ago
3 0

Answer:

import math

tolerance=0.00001

approximation=1.0

x = float(input("Enter a positive number: "))

def newton(number,approximation):

   approximation=(approximation+number/approximation)/2

   difference_value =abs(number-approximation**2)

   if difference_value<= tolerance:

       return approximation

   else:

       return newton(number,approximation)

print("The approximation of program = ", newton(x, approximation))

print("The approximation of Python = ", math.sqrt(x))

Explanation:    

  • Create a recursive function called newton that calls itself again and again to approximate square root for the newton technique.
  • Apply the formulas to find the estimate value  and the difference value .
  • Check whether the difference_value is less than the tolerance value  and then return the value of approximation  else make a recursive call to the newton function by passing the  user input and the new approximation value .
  • Finally display all the results using the print statement.
You might be interested in
"So far this month you have achieved $100.00 in sales, which is 50% of your total monthly goal. With only 5 more workdays this m
Rus_ich [418]

Answer:

$20 per day for next 5 working days.

Explanation:

if 50% is $100.00 another $100 need to achieve in 5 days.

100/5=20

3 0
2 years ago
Read 2 more answers
A file concordance tracks the unique words in a file and their frequencies. Write a program that displays a concordance for a fi
neonofarm [45]

Answer:

Python file with appropriate comments given below

Explanation:

#Take the input file name

filename=input('Enter the input file name: ')

#Open the input file

inputFile = open(filename,"r+")

#Define the dictionary.

list={}

#Read and split the file using for loop

for word in inputFile.read().split():

  #Check the word to be or not in file.

  if word not in list:

     list[word] = 1

  #increment by 1

  else:

     list[word] += 1

#Close the file.

inputFile.close();

#print a line

print();

#The word are sorted as per their ASCII value.

fori in sorted(list):

  #print the unique words and their

  #frequencies in alphabetical order.

  print("{0} {1} ".format(i, list[i]));

3 0
2 years ago
3. Megan and her brother Marco have a side business where they shop at flea markets, garage sales, and estate
Neko [114]

Answer:

a

Explanation:

Megan doesn't have a registered business. She can't claim insurance

4 0
2 years ago
Megan has written the following rough draft for her assignment. Choose the correct way to complete each sentence. Sarah is creat
atroni [7]

Answer:

I. hatching

II. filter

Explanation:

Sarah is creating an image. She wants to achieve tonal effects with parallel lines by varying their densities and distribution patterns. She will use <u>hatching</u> to do this. She also wants to add special effects on the image. Therefore, she will use <u>filters</u>.

Hatching refers to an art technique in which parallel lines are used to shade by drawing them closely together.

Stippling is an art technique used in the making of patterns by using small dots.

Filters is a technique of changing image characteristics. It is used to change the picture characteristics & to add special effects to an image such as the shade, contrast, tone, brightness etc.

We therefore see that, <u>hatching</u> and <u>filter</u> are the correct answers respectively

3 0
2 years ago
Check your tire pressure every _____. A. month B. two months C. six months D. year
ohaa [14]

Answer: I'd say (B) Two months

Explanation: Hope its correct and helps, Good luck :)

6 0
2 years ago
Read 2 more answers
Other questions:
  • your monthly living expenses are $1500 on an income of $1,650 per month. your goal is to have an emergency fund of 4 times your
    5·1 answer
  • Represent decimal number 8620 in (a) BCD, (b) excess-3 code, (c)2421 code, and (d) as a binary number
    7·1 answer
  • An online game is played with two dice. In this context, explain what is meant by decomposition in a simple way.
    15·1 answer
  • Jenny has to include the image of a sun on one of her slides. She needs to write relevant text about it on a dark background on
    6·1 answer
  • Software code is tested, debugged, fixed, verified, and then:
    11·1 answer
  • Which key retains its uniqueness even after you remove some of the fields?
    14·1 answer
  • Write a program in c or c++ to perform different arithmeticoperation using switch statement .the program will take two inputinte
    10·1 answer
  • Consider the following relationship involving two entities, students and classes:A student can take many classes. A class can be
    9·1 answer
  • Write a program that takes a single integer input from the user and stores it in a variable. Your program should increase the va
    15·1 answer
  • Write a function named shout. The function should accept a string argument and display it in uppercase with an exclamation mark
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!