MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply TodayGiven that 0 < x and x < 2*pi where x is in radians, write a function

[c,s] = infinite_series(x);

that returns with the sums of the two infinite series

c = cos(2*x)/1/2 + cos(3*x)/2/3 + cos(4*x)/3/4 + ... + cos((n+1)*x)/n/(n+1) + ... s = sin(2*x)/1/2 + sin(3*x)/2/3 + sin(4*x)/3/4 + ... + sin((n+1)*x)/n/(n+1) + ...

21 correct solutions
59 incorrect solutions

Last solution submitted on Dec 04, 2014

2 Comments

Roger Stafford
on 26 Feb 2012

Yes, you are right S L, a direct brute force summation is surely not the most efficient method of determining the sums of these series. You are the only one so far with a valid solution that met the 50*eps tests. In fact your answers are very much closer than that to mine, within a few eps. However, there is another single analytic function that can be used which is much simpler and would undoubtedly give you a lower "size" than 92 if you or others can find it. R. Stafford

@bmtran
on 28 Feb 2012

thanks for the hint

1 Comment