Polynomial to the power of polynomial.

3 ビュー (過去 30 日間)
vaishakh c
vaishakh c 2019 年 8 月 26 日
編集済み: James Tursa 2019 年 8 月 26 日
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?

採用された回答

Walter Roberson
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
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
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.

Community Treasure Hunt

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

Start Hunting!

Translated by