Given 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) + ...
So what would the Cody size of a brute-force algorithm be for this problem?
I got the correct answers within 50*eps for all answers except x=0.001 for c. Is c_correct value correct for x=0.001? I put in a small correction factor 1.5e-14 to get your c_correct value.
this one is truely a wonderfun code! make my eyes open.
Mr Castanon is a true god. I preferred asking wolfram solver.
Wish I studied infinite series properly at school
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
thanks for the hint
14356 Solvers
162 Solvers
Back to basics 21 - Matrix replicating
905 Solvers
83 Solvers
Create a Multiplication table matrix...
226 Solvers