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.96107442233265321982129918627Assume 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)