I want to find the value of `u` that minimizes my equation (least squares) `sum(w*(x-u)^2)` 

Is is possible to plot this equation in R? This would probably let me visually pick the value `u` that minimizes the equation.

Is is also possible to solve for `u` value that minimizes the equations? 

```
x <- c(0.18, -1.54, 0.42, 0.95)
w <- c(2, 1, 3, 1)
sum(w*(x-u)^2)

```