Difference between revisions of "Sum Command"

From GeoGebra Manual
Jump to: navigation, search
(don't use i (gives sqrt(-1) in new CAS))
 
(29 intermediate revisions by 11 users not shown)
Line 1: Line 1:
<noinclude>{{Manual Page|version=4.0}}[[Category:Manual (official)|{{PAGENAME}}]]</noinclude>
+
<noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|cas=true|statistics}}
{{command|statistics}}
+
;Sum( <List> )
; Sum[List]: Calculates the sum of all list elements.
+
:Calculates the sum of all list elements.
: {{Note| This command works for numbers, points, vectors, text, and functions.}}
+
:{{examples|1=<div>
: {{Example|1=&nbsp;
+
:* <code><nowiki>Sum({1, 2, 3})</nowiki></code> yields the number ''a = 6''.
:* <code>Sum[{1, 2, 3}]</code> gives you the number ''a = 6''.
+
:* <code><nowiki>Sum({x^2, x^3})</nowiki></code> yields ''f(x) = x<sup>2</sup> + x<sup>3</sup>''.
:* <code>Sum[{x^2, x^3}]</code> gives you ''f(x) = x<sup>2</sup> + x<sup>3</sup>''.
+
:* <code><nowiki>Sum(Sequence(i, i, 1, 100))</nowiki></code> yields the number ''a = 5050''.
:* <code>Sum[Sequence[i,i,1,100]]</code> gives you the number ''a = 5050''.
+
:* <code><nowiki>Sum({(1, 2), (2, 3)})</nowiki></code> yields the point ''A = (3, 5)''.
:* <code>Sum[{(1, 2), (2, 3)}]</code> gives you the point ''A = (3, 5)''.
+
:* <code><nowiki>Sum({(1, 2), 3})</nowiki></code> yields the point ''B = (4, 5)''.
:* <code>Sum[{(1, 2), 3}]</code> gives you the point ''B = (4, 2)''.
+
:* <code><nowiki>Sum({"a", "b", "c"})</nowiki></code> yields the text ''"abc"''.</div>}}
:* <code>Sum[{"a","b","c"}]</code> gives you the text ''"abc"''.}}
+
;Sum( <List>, <Number of Elements> )
 +
:Calculates the sum of the first ''n'' list elements.
 +
:{{example| 1=<div><code>Sum({1, 2, 3, 4, 5, 6}, 4)</code> yields the number ''a = 10''.</div>}}
 +
;Sum( <List>, &lt;List of Frequencies> )
 +
:Returns the sum of given list of numbers considering the frequencies.
 +
:{{example|1=<div><code><nowiki>Sum({1, 2, 3, 4, 5}, {3, 2, 4, 4, 1})</nowiki></code> yields ''a = 40''.</div>}}
 +
{{note| 1=This command works for numbers, points, vectors, text, and functions.}}
 +
==CAS Syntax==
 +
The following command only works in the [[File:Menu view cas.svg|link=|16px]] [[CAS View]].
  
; Sum[List, Number n of Elements]: Calculates the sum of the first ''n'' list elements.
+
;Sum( <Expression>, <Variable>, <Start Value>, <End Value> )
: {{Note| This command works for numbers, points, vectors, text, and functions.}}
+
:Computes sum <math>\sum_{t=Start Value}^{End Value}f(t)</math>. End value might be infinity.
: {{Example| 1=<code>Sum[{1, 2, 3, 4, 5, 6}, 4]</code> gives you the number ''a = 10''.}}
+
:{{examples|1=<div>
==CAS specific syntax==
+
:* <code><nowiki>Sum(n^2, n, 1, 3)</nowiki></code>  yields ''14''.
Following syntax works only in CAS view
+
:* <code><nowiki>Sum(r^k, k, 0, n)</nowiki></code>  yields ''<math>\frac{r^{n+1} }{r - 1} - \frac{1}{r - 1}</math>''.
;Sum[<Expression f(t)>,<Variable t>,<Start Value s>,<End Value e>]
+
:* <code><nowiki>Sum((1/3)^n, n, 0, Infinity)</nowiki></code>  yields ''<math>\frac{3}{2}</math>''.</div>}}
:Computes sum <math>\sum_{t=s}^{e}f(t)</math>. End value might be infinity.
 
:{{Example|1=&nbsp;
 
:*<code><nowiki>Sum[i^2, i, 1, 3]</nowiki></code>  returns 14.
 
:*<code><nowiki>Sum[r^i, i,0,n]</nowiki></code>  returns (1-r^(n+1))/(1-r).
 
:*<code><nowiki>Sum[(1/3)^i, i,0,Infinity]</nowiki></code>  returns 3/2.}}
 

Latest revision as of 22:19, 2 August 2019


Sum( <List> )
Calculates the sum of all list elements.
Examples:
  • Sum({1, 2, 3}) yields the number a = 6.
  • Sum({x^2, x^3}) yields f(x) = x2 + x3.
  • Sum(Sequence(i, i, 1, 100)) yields the number a = 5050.
  • Sum({(1, 2), (2, 3)}) yields the point A = (3, 5).
  • Sum({(1, 2), 3}) yields the point B = (4, 5).
  • Sum({"a", "b", "c"}) yields the text "abc".
Sum( <List>, <Number of Elements> )
Calculates the sum of the first n list elements.
Example:
Sum({1, 2, 3, 4, 5, 6}, 4) yields the number a = 10.
Sum( <List>, <List of Frequencies> )
Returns the sum of given list of numbers considering the frequencies.
Example:
Sum({1, 2, 3, 4, 5}, {3, 2, 4, 4, 1}) yields a = 40.
Note: This command works for numbers, points, vectors, text, and functions.

CAS Syntax

The following command only works in the Menu view cas.svg CAS View.

Sum( <Expression>, <Variable>, <Start Value>, <End Value> )
Computes sum \sum_{t=Start Value}^{End Value}f(t). End value might be infinity.
Examples:
  • Sum(n^2, n, 1, 3) yields 14.
  • Sum(r^k, k, 0, n) yields \frac{r^{n+1} }{r - 1} - \frac{1}{r - 1}.
  • Sum((1/3)^n, n, 0, Infinity) yields \frac{3}{2}.
© 2021 International GeoGebra Institute