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
Asked
Active
Viewed 41 times
-1
-
For the equation `2x^2 -x - 4 = 0` , a=2, b=-1, and c=-4. Just plug these values into the formula they provide. – user20650 Jul 01 '22 at 23:25
-
1I'm voting to close this question because it doesn't seem to be about programming – user20650 Jul 01 '22 at 23:26
1 Answers
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