Message Boards Message Boards

0
|
6046 Views
|
8 Replies
|
3 Total Likes
View groups...
Share
Share this post:

I need to plot this function please!!

Posted 4 years ago

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,

POSTED BY: Lina Lili
8 Replies

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.

POSTED BY: Henrik Schachner

You are welcome so much, Lina! :-D

POSTED BY: Lori Johnson

You can easily estimate the error that you make by truncating the series at n=100:

In[7]:= NSum[1/n^2, {n, 101, Infinity}]

Out[7]= 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 BY: Gianluca Gorni
Posted 4 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 BY: Bill Nelson

It's the same for me, thank you so much Lori

POSTED BY: Lina Lili

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 BY: Lori Johnson

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 BY: Lina Lili

Hello Lina,

Try this:

Plot[Sum[1/2^n Cos[4^n x], {n, 1, 100}], {x, -10, 10}]

Hope this helps! :D

enter image description here

POSTED BY: Lori Johnson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract