# I need to plot this function please!!

Posted 2 years ago
4723 Views
|
8 Replies
|
3 Total Likes
|
 I need to plot this one please: f[x_] = Sum[1/2^n Cos[4^n x], {n, 1, \[Infinity]}]; Plot[f[x], {x, -10, 10}] because of \infinity it takes to much time without giving nothing !! If someone has an idea how to plot it numerically or whatever, I just need it when n goes to infinity. Best regards,
8 Replies
Sort By:
Posted 2 years ago
 Hello Lina,Try this: Plot[Sum[1/2^n Cos[4^n x], {n, 1, 100}], {x, -10, 10}] Hope this helps! :D Posted 2 years ago
 Hi Lori, if I put n goes until a finite number it's working, but I need that n goes until infinity, is it possible?Best regards,
Posted 2 years ago
 Hi Lina,I tried Infinity and Mathematica took too long but consider this: if x=1, and n max is 100, 150, or 250 the result is the same. So, Infinity won't change anything and all the plots are the same as the one above. Sum[1/2^n Cos[4^n], {n, 1, #}] & /@ {100, 150, 250} // N {-0.486492, -0.486492, -0.486492} 
Posted 2 years ago
 It's the same for me, thank you so much Lori
Posted 2 years ago

## You are welcome so much, Lina! :-D

Posted 2 years ago
 Unlike some simpler sums, there does not appear to be any to turn your infinite sum into a small finite expression. If we could do that then that would be the answer for you.So can we provide a convincing graphical argument that adding only a sufficient, but finite, number of terms will give a plot that cannot be distinguished from the plot of the infinite sum, if we only waited an infinite amount of time?Compare these three plots Plot[Sum[1/2^n Cos[4^n x], {n, 1, 10}], {x, -10, 10}] Plot[Sum[1/2^n Cos[4^n x], {n, 11, 100}], {x, -10, 10},PlotPoints->100] Plot[Sum[1/2^n Cos[4^n x], {n, 101, 1000}], {x, -10, 10},PlotPoints->1000] The second plot shows summing 90 additional terms is 1000 times smaller than the first ten terms.The third plot shows summing 900 additional terms is 10^28 times smaller than the first 100 terms.I inserted the PlotPoints option to tell Mathematica to use even more points than normal because the sums are so small that the default number of points is too rough.
Posted 2 years ago
 You can easily estimate the error that you make by truncating the series at n=100: In:= NSum[1/n^2, {n, 101, Infinity}] Out= 0.00995017 Whether this error is acceptable or not depends on the scale of your plot. On the other hand, you are evaluating Cos at very high integer numbers, which is a challenge in itself. I don't know if the Plot routines are up to the task. You may want to use arbitrary precision.
Posted 2 years ago
 I just want to make the remark that the function in question belongs to the class of "Weierstrass Function" or "Weierstrass Monster", which is everywhere continuous and nowhere differentiable. From this it seems obvious that there is no closed form, and any numerical operation can only be an approximation.