resultant
Resultant of two polynomials
Description
Examples
Resultant of Two Polynomials
Find the resultant of two polynomials.
syms x y p = x^2+y; q = x-2*y; resultant(p,q)
ans = 4*y^2 + y
Find the resultant with respect to a specific variable by using the third argument.
resultant(p,q,y)
ans = 2*x^2 + x
Solve Polynomial Equations in Two Variables
If two polynomials have a common root, then the resultant must be 0 at that root. Solve polynomial equations in two variables by calculating the resultant with respect to one variable, and solving the resultant for the other variable.
First, calculate the resultant of two polynomials with respect to
x
to return a polynomial in
y
.
syms x y p = y^3 - 2*x^2 + 3*x*y; q = x^3 + 2*y^2 - 5*x^2*y; res = resultant(p,q,x)
res = y^9 - 35*y^8 + 44*y^6 + 126*y^5 - 32*y^4
Solve the resultant for y
values of the roots. Avoid
numerical roundoff errors by solving equations symbolically using the
solve
function. solve
represents the solutions symbolically by using
root
.
yRoots = solve(res)
yRoots = 0 0 0 0 root(z^5 - 35*z^4 + 44*z^2 + 126*z - 32, z, 1) root(z^5 - 35*z^4 + 44*z^2 + 126*z - 32, z, 2) root(z^5 - 35*z^4 + 44*z^2 + 126*z - 32, z, 3) root(z^5 - 35*z^4 + 44*z^2 + 126*z - 32, z, 4) root(z^5 - 35*z^4 + 44*z^2 + 126*z - 32, z, 5)
Calculate numeric values by using vpa
.
vpa(yRoots)
ans = 0 0 0 0 0.23545637976581197505601615070637 - 0.98628744767074109264070992415511 - 1.1027291033304653904984097788422i - 0.98628744767074109264070992415511 + 1.1027291033304653904984097788422i 1.7760440932430169904041045113342 34.96107442233265321982129918627
Assume that you want to investigate the fifth root. For the fifth root,
calculate the x
value by substituting the
y
value into p
and
q
. Then simultaneously solve the polynomials for
x
. Avoid numerical roundoff errors by solving
equations symbolically using solve
.
eqns = subs([p q], y, yRoots(5)); xRoot5 = solve(eqns,x);
Calculate the numeric value of the fifth root by using
vpa
.
root5 = vpa([xRoot5 yRoots(5)])
root5 = [ 0.37078716473998365045397220797284, 0.23545637976581197505601615070637]
Verify that the root is correct by substituting root5
into p
and q
. The result is
0
within roundoff error.
subs([p q],[x y],root5)
ans = [ -6.313690360861895794753956010471e-41, -9.1835496157991211560057541970488e-41]
Input Arguments
p
— Polynomial
symbolic expression | symbolic function
Polynomial, specified as a symbolic expression or function.
q
— Polynomial
symbolic expression | symbolic function
Polynomial, specified as a symbolic expression or function.
var
— Variable
symbolic variable
Variable, specified as a symbolic variable.
Version History
Introduced in R2018a
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)