Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

) 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

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_2

Step: 3

blur-text-image_3

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

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

Students also viewed these Databases questions

Question

Discuss global cultural differences in GLOBE dimensions.

Answered: 1 week ago