I want to minimize this function by using lm function in R, but Im not sure it is the right way to do it, can someone help me out? 
I have tried out this code:
set.seed(12)
fx <- lm(log(St)~t+I(t^2))
fx
fy <- lm(log(Nt)~t+I(t^2))
fy
t <- 1:50
fx <- 0.32369+0.33647t-0.00531t^2
