user7148318 - 8 months ago 57

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 Source

```
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))
```