Polynomial to the power of polynomial.
1 次查看(过去 30 天)
显示 更早的评论
So I wanted to check the roots of the eqn (x^2-7*x+11)^(x^2-13*x+42)=0.
I got one root as 2. How do i get the other values?
0 个评论
采纳的回答
Walter Roberson
2019-8-26
2 is not a root.
There are three ways that an expression A raised to another expression B can be 0.
One way is if A is 0 at a location that B is not also 0. You can solve this by finding the roots of A and cross checking whether they are also roots of B.
A second way is if the A has a value with absolute value strictly less than 1 while B is positive infinity. This cannot occur with pure polynomials: they always go to infinity only at +/- infinity so at any location where B is infinite, A would be as well.
A third way is if A is absolute value strictly greater than 1 and B is negative infinity. This cannot occur in this particular case as B cannot be negative infinity, but it could occur with other polynomial B.
We can see that only the first case applies for these expressions, so find the roots of A as usual. 2 is not one of them.
3 个评论
James Tursa
2019-8-26
编辑:James Tursa
2019-8-26
The hard part is verifying that the roots of A are not also roots of B. This can get sticky because of numeric effects. E.g.,
>> syms x
>> A = x^2 - 2
A =
x^2 - 2
>> B = A * (x - 1e5)
B =
(x^2 - 2)*(x - 100000)
>> roots(coeffs(A,'All'))
ans =
2^(1/2)
-2^(1/2)
>> roots(coeffs(B,'All'))
ans =
100000
2^(1/2)
-2^(1/2)
All well and good when using the Symbolic Toolbox ... you can see that both roots of A are indeed roots of B, which is expected given how we constructed B. But now look at the same computations in double precision arithmetic:
>> r2 = roots(double(coeffs(A,'All')))
r2 =
1.414213562373095
-1.414213562373095
>> r3 = roots(double(coeffs(B,'All')))
r3 =
1.0e+05 *
1.000000000000000
-0.000014142135624
0.000014142135624
>> r3(2:3)
ans =
-1.414213562373111
1.414213562373089
Now you've got a tricky situation to maneuver, since in double precision you don't get the same exact values for the roots of A and B, even though we set up the problem for them to have the same exact roots.
You will need to figure out how to handle this situation in your code. If your coefficients are integers, then maybe you can just use the Symbolic Toolbox for this. Otherwise you will need to somehow deal with these numeric effects.
更多回答(1 个)
Jon
2019-8-26
编辑:Jon
2019-8-26
You should be able to use the MATLAB function fzero for this purpose. You will have call it repeatedly (maybe in a loop) with a different initial starting points to find other roots. I would suggest plotting the function to get some idea of its behavior over the range of x's that you are interested in.
There is a lot of discussion about finding all of the roots (if that is what you need) already in MATLAB answers. I suggest searching through those for some ideas. For example https://www.mathworks.com/matlabcentral/answers/103169-how-do-i-find-all-the-zeros-of-a-function
Note, you should also be clear whether you are just looking for real roots, or complex roots.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polynomials 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!