-1

Just going to link the question; I have no other info to go off of; and I am very confused, Would love a solution; but also if you could explain the how and why, that would be extremely helpful TYIA PROBLEM FROM TEST

1 Answers1

0

You can make a function to solve the quadratic equation , which takes the coefficient of the equation a, b , c and return the roots

fn <- function(a , b , c){
    root1 <- (-b + sqrt(b^2 - 4*a*c)) / (2*a)
    root2 <- (-b - sqrt(b^2 - 4*a*c)) / (2*a)
    round(c(root1 , root2) , digits = 3)
}

then apply it to your question as follows

fn(2,-1,-4)

[1]  1.686 -1.186
Mohamed Desouky
  • 4,340
  • 2
  • 4
  • 19