To find unknown constants similar to polynomial division

조회 수: 9 (최근 30일)
Rakesh Jain
Rakesh Jain 2017년 9월 26일
편집: John D'Errico 2017년 9월 26일
I have a 4th degree polynomial like 2x^4 + (3+K)x^3 + (4K)x^2 + 5x +9 (K is a constant) and a second degree polynomial like x^2 + 3x + 2 like. I need to find b and c such that
x^4 + (3+K)x^3 + (4K)x^2 + 5x +9 = (x^2 + 3x + 2)*(x^2 + bx + c)
Is it possible to find b and c via matlab code? How to do it

채택된 답변

John D'Errico
John D'Errico 2017년 9월 26일
편집: John D'Errico 2017년 9월 26일
In general, it may or may not be possible. In practice, almost always impossible for a solution to exist.
syms b c K x
P1 = x^4 + (3+K)*x^3 + 4*K*x^2 + 5*x +9
P2 = expand((x^2 + 3*x + 2)*(x^2 + b*x + c))
P2 =
2*c + 2*b*x + 3*c*x + 3*b*x^2 + b*x^3 + c*x^2 + 2*x^2 + 3*x^3 + x^4
Now just use common sense.
The constant term in both polynomials MUST be identical for a solution to exist. Therefore we can get c from the constant term.
2*c = 9
Therefore c=9/2. Substitute.
subs(P2,c,9/2)
ans =
(27*x)/2 + 2*b*x + 3*b*x^2 + b*x^3 + (13*x^2)/2 + 3*x^3 + x^4 + 9
But now we can compare the first order coefficients. Now we get
27/2 + 2*b == 5
That gives us b=-17/4.
subs(P2,{c,b},[9/2,-17/4])
ans =
x^4 - (5*x^3)/4 - (25*x^2)/4 + 5*x + 9
P1
P1 =
x^4 + (K + 3)*x^3 + 4*K*x^2 + 5*x + 9
Now, compare the other coefficients. All MUST be identical for a solution to exist.
From the quadratic term:
4*K = -25/4
That implies K MUST be -25/16.
Yet, from the cubic term:
(K+3) = -5/4
This implies that K MUST be -17/4.
So, unless you use the new math (favored by politicians, political economists, and other crooks of all sorts) where K can be simultaneously -25/16 and -17/4, no solution can ever exist.
A nice thing about mathematics is you can prove no solution can ever exist, as I did just here. I even used MATLAB (mostly because I was too lazy to do the minor algebra on paper.) The general solution for this problem or more complicated ones is exactly as I did, achieved by equating coefficients.
An alternative approach could stem from finding the roots of each polynomial. The roots of the right hand side are known from the two quadratic polynomials. So two of the roots MUST be -2 and -1, simply from the first part of P2.
solve(x^2 + 3*x + 2)
ans =
-2
-1
You could now use synthetic division to find the remaining quadratic. Easier to do as I did above.
Why, by the way, did I say it would be uncommon for a solution to exist? Because if we ignore the first coefficient (or x^4, both of which are trivially 1) then we have 3 variables, thus K, b, c. But there are FOUR coefficients, all of which must be identical. So we have essentially 4 equations, but only 3 unknowns. So unless you have a lucky form for the coefficients, there will be no solution.

추가 답변 (1개)

Star Strider
Star Strider 2017년 9월 26일
Using the Symbolic Math Toolbox:
syms b c K x
Eqn = x^4 + (3+K)*x^3 + (4*K)*x^2 + 5*x +9 == (x^2 + 3*x + 2)*(x^2 + b*x + c);
[b c] = solve(Eqn, [b c])
b =
(5*x + 4*K*x^2 + K*x^3 - 2*x^2 + 9)/(x*(x^2 + 3*x + 2))
c =
0
  댓글 수: 4
Rakesh Jain
Rakesh Jain 2017년 9월 26일
I am getting an error here. Please can you tell why
Error in DomiPole (line 21)
Eqn = N == DomiPoles*(a*x^5 + b*x^4 + c*x^3 + d*x^2 + e*x + f)
Actual code
N = 20800000*kp + 12960000000*x + 57600000*kpc*x + 64000000*kpc*x^2 + 34960673144*x^2 + 46022400000*x^3 + 25574400000*x^4 + 7315200000*x^5 + 1036800000*x^6 + 57600000*x^7 + 1581385169
DomiPoles =x^2 - (9*x)/10 + 13/40
Eqn = N == DomiPoles*(a*x^5 + b*x^4 + c*x^3 + d*x^2 + e*x + f)
[a b c d e f] = solve(Eqn, [a b c d e f])
Star Strider
Star Strider 2017년 9월 26일
Using vpasolve, there is one solution for ‘a’. The other variables are all 0:
[a b c d e f] = vpasolve(Eqn, [a b c d e f])

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Polynomials에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by