resultant
Resultant of two polynomials
Description
Examples
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
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
Polynomial, specified as a symbolic expression or function.
Polynomial, specified as a symbolic expression or function.
Variable, specified as a symbolic variable.
Version History
Introduced in R2018a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- 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)