user7148318 - 1 month ago 9

R Question

I'm trying to write an equation in R (see code below). I was wondering how I can correctly use **+-** before **sqrt()** in my code?

`x <- seq(0,1,by=0.01)`

y <- %+-%sqrt((.5^2)-(x-.5)^2)+.5

Answer

```
x <- seq(0,1,by=0.01)
y1 <- sqrt((.5^2)-(x-.5)^2)+.5
y2 <- -sqrt((.5^2)-(x-.5)^2)+.5
plot(c(x,x), c(y1,y2))
```