Graphical primitive for symbolic sums

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


plot::Sum(ex, i = m .. n, <a = amin .. amax>, options)
plot::Sum(sum(ex, i = m .. n), <a = amin .. amax>, options)


plot::Sum(ex, i = m..n) creates a plot of summing ex over the range m..n.

plot::Sum creates a visual display of partial sums over a finite interval. Mathematically, plot::Sum(ex, i = m..n) plots the function .

To ease the use of plot::Sum in programs, symbolic sums are accepted in the input and plot::Sum takes care not to evaluate these. It is highly recommended, though, not to use this syntax in interactive applications, to avoid premature evaluation.


AttributePurposeDefault Value
AffectViewingBoxinfluence of objects on the ViewingBox of a sceneTRUE
AntiAliasedantialiased lines and points?FALSE
Colorthe main colorRGB::Blue
Filledfilled or transparent areas and surfacesFALSE
FillColorcolor of areas and surfacesRGB::Red
FillPatterntype of area fillingSolid
Framesthe number of frames in an animation50
Functionfunction expression or procedure 
Legendmakes a legend entry 
LegendTextshort explanatory text for legend 
LegendEntryadd this object to the legend?FALSE
LineColorcolor of linesRGB::Blue
LineWidthwidth of lines0.35
LineColor2color of linesRGB::DeepPink
LineStylesolid, dashed or dotted lines?Solid
LinesVisiblevisibility of linesTRUE
LineColorTypeline coloring typesFlat
LineColorFunctionfunctional line coloring 
LineColorDirectionthe direction of color transitions on lines[0, 1]
LineColorDirectionXx-component of the direction of color transitions on lines0
LineColorDirectionYy-component of the direction of color transitions on lines1
Namethe name of a plot object (for browser and legend) 
ParameterEndend value of the animation parameter 
ParameterNamename of the animation parameter 
ParameterBegininitial value of the animation parameter 
ParameterRangerange of the animation parameter 
PointColorthe color of pointsRGB::MidnightBlue
PointsVisiblevisibility of mesh pointsFALSE
TimeEndend time of the animation10.0
TimeBeginstart time of the animation0.0
TimeRangethe real time span of an animation0.0 .. 10.0
Titleobject title 
TitleFontfont of object titles[" sans-serif ", 11]
TitlePositionposition of object titles 
TitleAlignmenthorizontal alignment of titles w.r.t. their coordinatesCenter
TitlePositionXposition of object titles, x component 
TitlePositionYposition of object titles, y component 
VisibleAfterobject visible after this time value 
VisibleBeforeobject visible until this time value 
VisibleFromToobject visible during this time range 
VisibleAfterEndobject visible after its animation time ended?TRUE
VisibleBeforeBeginobject visible before its animation time starts?TRUE
XMaxfinal value of parameter “x” 
XMininitial value of parameter “x” 
XNamename of parameter “x” 
XRangerange of parameter “x” 


Example 1

It is well known that . We use plot::Sum to display the first 100 partial sums:

plot(plot::Sum(1/j^2, j = 1..100),
     plot::Function2d(PI^2/6, x=1..101, LineStyle = Dashed))

With more partial sums, the steps approximate points:

plot(plot::Sum(sin(j^2)/j, j=1..500))

Example 2

To show some of the formatting options of plot::Sum, we use the following sum:

s := plot::Sum(1/j, j = 1..20)

By default, this object is displayed as follows:


To change parameters, we can select them in the inspector and change the values, we can give other values directly in the plot command or we can set the new values in our object s:

s::PointsVisible := TRUE:
s::LinesVisible := FALSE:
s::PointColor := RGB::Green:

Example 3

plot::Sum allows animation in the usual way, for example, in the term to sum:

plot(plot::Sum(sin(a*i^2)/i, i = 1..50, a = 0..PI))

Another interesting parameter to animate is the summation range:

plot(plot::Sum((-1)^j/j, j = 1..jmax, jmax = 1..50))



Arithmetical expression in i and the animation parameter a, if that is used.

ex is equivalent to the attribute Function.


An identifier or indexed identifier.

i is equivalent to the attribute XName.

m .. n

The range of i. m and n may be expressions in the animation parameter a. Summation goes over m + integer. If n - m is not an integer, n will not be reached.

m .. n is equivalent to the attributes XRange, XMin, XMax.


Animation parameter, specified as a = amin..amax, where amin is the initial parameter value, and amax is the final parameter value.

See Also

MuPAD Functions

MuPAD Graphical Primitives