ElemSymPoly

From QETLAB
Revision as of 22:07, 23 August 2024 by Benjamin Talbot (talk | contribs) (Create page ElemSymPoly)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.
  • k: An integer denoting the degree of the terms in the elementary symmetric polynomial.

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 1x2x3, 1x2x4, 1x3x4, and 2x3x4.

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

ans =

    50

Source code

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