The difference is that the order of variable assignment is reversed. In Sum_first_n(), you are assigning x to n and x is intialized with the value 5 when you call the function.
If you change Positive_Root() as shown below it will work fine. But there's no need to create these extra variables as I explained in my previous post.
Positive_Root <- function(x, y, z) {
a <- x
b <- y
c <- z
-b + sqrt(b^2 - 4*a*c) / 2*a
}
Positive_Root(2, -1, -4)
#> [1] 6.744563
Created on 2020-03-23 by the reprex package (v0.3.0)