Question: ) Make my.sqrt and my.sqrt2 functions in your global environment (created in Script 3.3 below) . Use my.sqrt to calculate the following (show the returned

  1. ) Make my.sqrt and my.sqrt2 functions in your global environment (created in Script 3.3 below). Use my.sqrt to calculate the following (show the returned values or statements): USE R-STUDIO

  1. (1 Point) 36
  2. (1 Points) -16
  3. (1 Point) 6i
  4. (1 Point) 110
  5. (1 Point) 0

# Script 3.3 Finding the Square Root # with Guess-Divide-Average

my.sqrt <- function (x) { # Find the square root of a number using the # guess-divide-average method. if(is.numeric(x)& x>=0) { guess=2 my.sqrt2(x,guess) } else print("Invalid parameter!") } # end my.sqrt2

my.sqrt2 <- function(x,guess) { while(abs(guess- x/guess) > 0.001) {guess <-(guess + x/guess) / 2 } return(guess) } # end my.sqrt2

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 Databases Questions!