To find unknown constants similar to polynomial division
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Rakesh Jain
el 26 de Sept. de 2017
Editada: John D'Errico
el 26 de Sept. de 2017
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
0 comentarios
Respuesta aceptada
John D'Errico
el 26 de Sept. de 2017
Editada: John D'Errico
el 26 de Sept. de 2017
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.
0 comentarios
Más respuestas (1)
Star Strider
el 26 de Sept. de 2017
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 comentarios
Star Strider
el 26 de Sept. de 2017
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])
Ver también
Categorías
Más información sobre Polynomials en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!