Hi,

I tried to see the plot for such an equation (summation):

sum n from 1 to infinity: (13/18) ** (n - 1)

I did it with a recursive function:

sum(n)=0.7222222 ** (n-1) + (n>1 ? sum(n-1) : 0)

But why is there such a great difference between these two plots:

gnuplot> set yrange [0:5]

gnuplot> plot [-10:90] sum(x)

gnuplot> plot [-10:91] sum(x)

The first is very smooth, while the second is very bumpy for the very same

values of x.

And, is there an easier or better way for plotting a summation than

defining a recursive function?

It is limited to like x=100 maximally, after that I get a stack overflow!

Thanks for your hints!

Andi

Because x is a floating-point number, whereas your function expects

only integer arguments, but doesn't enforce that fact.

Alternatively it would also would help if you modified 'set samples'

along with the xrange such that all sampling points are integers. Try

set samples 101

plot [-10:91] sum(x)

some time.

In the case at hand: yes, because there's a closed-form solution for

the finite geometrical series. Find it in your Mittelstufe maths

textbook (ca. Klasse 8 oder 9) ;-)

But not generally. gnuplot is not a heavy-duty mathematical analysis

tool. If you want that, get MuPAD, Octave or SciLab instead.

--

Hans-Bernhard Broeker ( XXXX@XXXXX.COM )

Even if all the snow were burnt, ashes would remain.

There seems to be a problem with the sampling. If you use "set samples"

to set the sampling rate to >>100 (100 is the default), e.g. 10000 which

could take a while to plot, the two graphs are very similar and not

smooth at all!

No idea for the rest of your questions...

--

Gruesse von

Peter.

1. [ANN] New posting on Codeaholic: [VB6] MAXDOUBLE, MINDOUBLE, +INFINITY, -INFINITY and NaN

2. maple bug -> int(exp(-abs(a-z)), z=-infinity..infinity);

3. What we from 1^Infinity, Infinity^0, and similar stuff

4. New posting on Codeaholic: [VB6] MAXDOUBLE, MINDOUBLE, +INFINITY, -INFINITY and NaN

6. VBA code to perform summation and product summation

7. Showing Infinity value in table

11. windows service and cpu infinity

12. How to get excel to recognise "infinity" for asymptotes in charts

13. infinity?

14. Displaying the infinity symbol in an excel spreadsheet

3 post • Page:**1** of **1**