user7148318 - 1 year ago 79

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

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

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

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**