ElemSymPoly

From QETLAB
Jump to navigation Jump to search
ElemSymPoly
Computes the elementary symmetric polynomial of a given set of numbers.

Other toolboxes required none
Function category Miscellaneous

ElemSymPoly is a function that computes the kth elementary symmetric polynomial of a given set of numbers.

Syntax

  • RES = ElemSymPoly(X, K)

Argument descriptions

  • X: A vector of length n.
  • K: An integer denoting the degree of the terms in the elementary symmetric polynomial. Must be between 0 and n, inclusive.

Example

This function computes the sum of products of k distinct elements of a vector x. For example, the 3rd elementary symmetric polynomial of the vector [1, 2, 3, 4] is computed by summing the distinct products of 3 elements, these products being 1 x 2 x 3, 1 x 2 x 4, 1 x 3 x 4, and 2 x 3 x 4.

>> ElemSymPoly([1, 2, 3, 4], 3)

ans =

    50

Notes

The 0th elementary symmetric polynomial is defined as S0(x) = 1.

Source code

Click here to view this function's source code on github.