# Continuous summation of a function [closed]

I have a simple function:

func =x Sin[π x]^2


This creates a curve that oscillates between 0 and values that increase linearly with x.

I want to create a continuous sum of func, so that incremental increases in x add to the running total. The result would be a continuously rising curve, with periods of rapid growth interspersed with periods of something closer to a plateau, based on the frequency of the Sin function.

How do I do this?

• f=Integrate[x Sin[Pi x]^2,x] ; Plot[f,{x,0,4Pi}] – Bill Sep 24 '18 at 0:18
• How does a "continous summation" differ from an integral? – Αλέξανδρος Ζεγγ Sep 24 '18 at 1:04
• I went to sleep last night realising what a dumb question it was! Many thanks for the answers. – Richard Burke-Ward Sep 24 '18 at 7:58

The "continuous sum" of a function is it's integral so

f[x_] := x Sin[Pi x]^2
sumf = Integrate[f[x], x];
Plot[{f[x], sumf}, {x, 0, 2 Pi}]


You can also use Accumulate

f[x_] := x Sin[Pi x]^2
n = 10000;
sumf = Accumulate@(2 Pi/n f@Subdivide[0., 2 Pi, n]);
Show[ListLinePlot[sumf, DataRange -> {0, 2 Pi},
PlotStyle -> ColorData[97, 2], PlotRange -> All],
Plot[f[x], {x, 0, 2 Pi}]]