Documentation/Calc Functions/SERIESSUM

From The Document Foundation Wiki
Jump to navigation Jump to search
Other languages:
English • ‎Nederlands • ‎dansk • ‎español



Function name:

SERIESSUM

Category:

Mathematical

Summary:

Calculates the sum of the first terms of an infinite power series of the form:

[math]\displaystyle{ \sum_{n=0}^{\infty }a_nx^n }[/math]

x is the variable and an is the coefficient of the nth term in the series.

Syntax:

SERIESSUM(X; N; M; Coefficients)

Returns:

Returns a real number that is the sum of the first terms of the given power series.

Arguments:

X is a real number, or a reference to a cell containing that number, that is the variable for the power series.

N is a real number, or a reference to a cell containing that number, that is the initial power.

M is a real number, or a reference to a cell containing that number, that is the increment to the power for each term.

Coefficients gives the set of real numbers to be used as coefficients for the terms of the power series. The number of coefficients provided defines the number of terms to be calculated (one term per coefficient). Coefficients should take one of the following forms:

  • A simple reference to a cell range containing real numbers (for example, A1:B9).
  • The name of a named range, comprising cells containing real numbers.
  • The name of a database range, comprising cells containing real numbers.
  • An inline array of real numbers (for example, {1.2, 3.4, 5.6, 7.8}).

The following error conditions may be encountered:

  • If any of X, N, or M are non-numeric, then SERIESSUM reports a #VALUE! error.
  • SERIESSUM will not necessarily generate an error when Coefficients is a real number or a reference to a single cell. However, if the Coefficients argument is a string in quotation marks or a reference to a single cell containing a string, then SERIESSUM reports a #VALUE! error.
  • Where Coefficients is specified as an inline array or a range of cells, entries that contain text strings or blanks are ignored.
  • If X is negative and either of N or M are non-integer, then SERIESSUM reports an invalid argument error (Err:502). Negative values cannot be raised to fractional powers.
  • If X and N are both equal to 0, then SERIESSUM reports a #VALUE! error. 0 to the power of 0 is undefined.

Additional details:

  • A power series may be represented as:

[math]\displaystyle{ \text{f}(x)=a_{0}x^{n}+a_{1}x^{n+m}+a_{2}x^{n+2m}+a_{3}x^{n+3m}+... }[/math]

where:
  • x is the variable.
  • an is the coefficient of the nth term in the series.
  • m is the increment applied to the power for each term.
  • For example, the series expansion of ex is a common power series, with the formula:

[math]\displaystyle{ \text {e}^{x}=\sum_{n=0}^{\infty }\frac{x^n}{n!}=1+\frac{x}{1!}+\frac{x^2}{2!}+\frac{x^3}{3!}+\frac{x^4}{4!}+... }[/math]

To find the (approximate) value of ex, we could use SERIESSUM and set the arguments as follows:
  • Set X to the power of e that you require.
  • Set N to 0 (the first term in the series is a constant).
  • Set M to 1 (the power of x is incremented by 1 at each term in the series).
  • Set Coefficients to the values 1, [math]\displaystyle{ \frac{1}{1!} }[/math], [math]\displaystyle{ \frac{1}{2!} }[/math], [math]\displaystyle{ \frac{1}{3!} }[/math], and [math]\displaystyle{ \frac{1}{4!} }[/math]. Using five coefficients will cause SERIESSUM to calculate the first five terms of the power series.
See the #Examples: section below for more examples of this power series.
  • Another example of a common power series is that for the trigonometric sine, with the formula:

[math]\displaystyle{ \text{sin}(x)=\sum_{n=0}^{\infty }(-1)^n \frac{x^{2n+1}}{(2n+1)!}=x-\frac{x^3}{3!}+\frac{x^5}{5!}-\frac{x^7}{7!}+... }[/math]

To find the (approximate) value of sin(x), we could use SERIESSUM and set the arguments as follows:
  • Set X to the angle in radians for which you wish to calculate the sine.
  • Set N to 1 (the first term in the series is an x1 term).
  • Set M to 2 (the power of x is incremented by 2 at each term in the series).
  • Set Coefficients to the values 1, [math]\displaystyle{ -\frac{1}{3!} }[/math], [math]\displaystyle{ \frac{1}{5!} }[/math], and [math]\displaystyle{ -\frac{1}{7!} }[/math]. Using four coefficients will cause SERIESSUM to calculate the first four terms of the power series.
See the #Examples: section below for more examples of this power series.

Examples:

Basic examples

Formula Description Returns
=SERIESSUM(2; 0; 1; {1; 2; 3}) Here the function calculates [math]\displaystyle{ 1+2x+3x^2 }[/math], where x=2. 17
=SERIESSUM(0.5; 1; 2; {1; 1; 1}) Here the function calculates [math]\displaystyle{ x+x^3+x^5 }[/math], where x=0.5. 0.65625

Calculate approximate value of ex

Using the description of the ex power series given above, set up data in your spreadsheet in accordance with the following table.

A B
1 X 1
2 N 0
3 M 1
4 Coefficient[0] 1
5 Coefficient[1] 1
6 Coefficient[2] 0.5
7 Coefficient[3] 0.166666666666667
8 Coefficient[4] 0.041666666666667
Formula Description Returns
=SERIESSUM(B1; B2; B3; B4:B8) where cells B1 to B8 contain the numbers listed above. Here the function calculates an approximate value for e. Using more terms of the power series would give a closer approximation to the actual value (2.7182818284…). 2.70833333333333
=SERIESSUM(0.5; B2; B3; B4:B8) where cells B2 to B8 contain the numbers listed above. Here the function calculates an approximate value for the square root of e. Using more terms of the power series would give a closer approximation to the actual value (1.6487212707…). 1.6484375

Calculate approximate value of sin(x)

Using the description of the sin(x) power series given above, set up data in your spreadsheet in accordance with the following table.

A B
1 X 1.0471975511966
2 N 1
3 M 2
4 Coefficient[0] 1
5 Coefficient[1] -0.166666666666667
6 Coefficient[2] 0.008333333333333
7 Coefficient[3] -0.000198412698413
Formula Description Returns
=SERIESSUM(B1; B2; B3; B4:B7) where cells B1 to B7 contain the numbers listed above. Here the function calculates an approximate value for sin(π/3). Using more terms of the power series would give a closer approximation to the actual value (0.866025403784439…). 0.866021271656373
=SERIESSUM(0.5; B2; B3; B4:B7) where cells B2 to B7 contain the numbers listed above. Here the function calculates an approximate value for sin(0.5). Using more terms of the power series would give a closer approximation to the actual value (0.479425538604203…). 0.479425533234127

Related LibreOffice functions:

None.

ODF standard:

Section 6.16.53, part 2

Equivalent Excel functions:

SERIESSUM