[R] Need help with function that includes 2 summation

Henrique Dallazuanna
2007-10-17T12:54:44Z

Perhaps:


r <- function(n, k, theta){

return(sqrt((sum(cos(k*theta))^2 + sum(sin(k*theta))^2)/n))

}



On 17/10/2007, Zack Darnell <mzd2@duke.edu> wrote:
>
> I am relatively new to R, so this may be a much simpler question than it
> seems to me. I am trying to create a function that includes two
> summations, and can't figure out how. I am attaching the equation as a
> pdf file. This function will then be optimized over a chosen range of
> values, but right now I just need help with the function. Thank you.
> Zack Darnell
> Duke University
>
> --
> Zack Darnell
> Duke University Marine Lab
> 135 Duke Marine Lab Rd.
> Beaufort, NC 28516
>
> Tel: (252) 732-5727
> Email: mzd2@duke.edu
>
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
>


--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]