Answered step by step
Verified Expert Solution
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
- ) 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 Point) 36
- (1 Points) -16
- (1 Point) 6i
- (1 Point) 110
- (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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started