Zack Darnell 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 Hi,
I'm a bit unsure of what you call double summation, I only see the i index in here, you can almost translate the latex code into R: R> sqrt( sum(cos(k*theta))^2 + sum(sin(k*theta))^2 ) / n theta being a vector containing all your theta_i, for i in 1 to n. Cheers, Romain -- Mango Solutions data analysis that delivers Tel: +44(0) 1249 467 467 Fax: +44(0) 1249 467 468 Mob: +44(0) 7813 526 123 ______________________________________________ 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.