Re: sum

Alan Corey <[email protected]> Tue, 1 Nov 2022 17:43:20 -0400
Newsgroups gmane.comp.graphics.gnuplot.user
Message-ID <CAOh3dDbBs1KE8EZMDPkYy4qMHVgzC805YvZfQCfN6UXrw4dRcQ@mail.gmail.com>
As summation like for calculus?

On 11/1/22, theozh <[email protected]> wrote:
> maybe something like this...?
>
> mySum(xmin,xmax,N) = sum[i=0:N-1] (x0=xmin+real(xmax-xmin)/(N-1)*i,f(x0))
>
> f(x) = x
> print mySum(1,100,100)
>
> f(x) = x**2
> print mySum(-10,10,2001)
>
> Results: 5050.0 and 66766.7
>
> You need real() to avoid gnuplot's integer division.
> Alternatively, you have to ensure that xmin or xmax are floating point
> numbers.
>
> Am 01.11.2022 um 20:55 schrieb Patrick Dupre:
>> set samples 2001
>>
>> f(x)= ..
>>
>> I wish to get the sum of f(x) from [-10:10]
>>
>
>
> _______________________________________________
> gnuplot-info mailing list
> [email protected]
> Membership management via:
> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
>


-- 
-------------
Education is contagious.


_______________________________________________
gnuplot-info mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info