# `groebner`::`spoly`

The S-polynomial of two polynomials

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.

## Syntax

```groebner::spoly(`p1`, `p2`, <`order`>)
```

## Description

`groebner::spoly(p1, p2)` computes the S-polynomial of the polynomials `p1` and `p2`.

The rules laid down in the introduction to groebner concerning the polynomial types and the ordering apply.

The polynomials must be of the same type. In particular, do not mix polynomials created via `poly` and polynomial expressions!

## Examples

### Example 1

The polynomials

```p1 := poly(x^2 - x + 2*y^2, [x, y]): p2 := poly(x + 2*y - 1, [x, y]):```

generate the following S-polynomial with respect to lexicographical ordering:

`groebner::spoly(p1, p2, LexOrder)`
` `
`delete p1, p2:`

## Parameters

 `p1`, `p2` A list or set of polynomials or polynomial expressions of the same type. The coefficients in these polynomials and polynomial expressions can be arbitrary arithmetical expressions. `order` One of the identifiers `DegInvLexOrder`, `DegreeOrder`, and `LexOrder`, or a user-defined term ordering of type `Dom::MonomOrdering`. The default ordering is `DegInvLexOrder`.

## Return Values

Polynomial of the same type as the input polynomials. If polynomial expressions are used as input, then a polynomial expression is returned.

## Algorithms

The S-polynomial of two polynomials p1, p2 is defined to be ,

where `lterm` and `lmonomial` are used in the same sense as the MuPAD® functions of the same name. This formula is constructed such that the leading terms of the two summands cancel.