Warning: Unable to find explicit solution for 1 unknown

조회 수: 2 (최근 30일)
Moaaz Zaki
Moaaz Zaki 2020년 5월 18일
편집: John D'Errico 2020년 5월 18일
Hey everyone,
I have a piece-wise function H(omega) that is a result from
norm(symsym(alpha^n *exp(-1i * omega * n),n,0,inf))
such that :
n omega H(omega) are syms
and is a variable = 0.9
H(omega) =
piecewise(exp(omega*1i) == 9/10, Inf, exp(omega*1i) ~= 9/10, ((100*abs(limit((9/10)^n*exp(-n*omega*1i), n, Inf) - 1)^2*exp(-2*imag(omega)))/abs(10*exp(omega*1i) - 9)^2)^(1/2))
I want to find omega such that H(omega) = 5
so I used solve in the following code:
eqn = H(omega) == 5;
solve(eqn,omega)
and I got this:
Warning: Unable to find explicit solution. For options, see help.
ans =
Empty sym: 0-by-1

채택된 답변

John D'Errico
John D'Errico 2020년 5월 18일
편집: John D'Errico 2020년 5월 18일
Not everything you write down has an analytical solution. In fact, most expressions that you can formulate will have no solution at all.
Here alpha is apparently set at 0.9, but n and omega are left as symbolic variables, so completely unknown. Then you used symsum to compute a result, however symsum was unable to give you something terribly useful. So it gave you a bit of a mess, in a form that still had a limit as n goes to infinity. Essentially, MATLAB was unable to eliminate n from the problem. So this really was not strictly a one variable problem in the eyes of MATLAB.
You wish, apparently, to solve for omega, as a function of n. Let me look at what you seem to have done, since you don't show us the code, only the result of the code. So next, I must guess what you did.
alpha = 0.9;
syms n omega
H = symsum(alpha^n *exp(-1i * omega * n),n,0,inf)
H =
piecewise(exp(omega*1i) == 9/10, Inf, exp(omega*1i) ~= 9/10, -(10*exp(omega*1i)*(limit((9/10)^n*exp(-n*omega*1i), n, Inf) - 1))/(10*exp(omega*1i) - 9))
I've temporarily dropped the norm from there in H, as not immediately relevant to anything.
First what does this mean?
This piecewise function in the solution tells us that under some conditions here, there was something "interesting" that happens. That is, when
exp(omega*1i) == 9/10
THEN we get an inf result.
Effectively, it allows us to solve for the case where you would have a problem. Remember that omega can be ANY number at all. ANYTHING. So if we ever have omega as the value
omega = log(9/10)/(1i)
THEN we would get an infinite result. And that sort of makes sense, if I look at the original expression that created this. If the above is true, then we might take the inverse as
exp(-omega*1i) = 10/9
And therefore, if I raise that to any power n, I would see that
exp(-omega*1i*n) = (10/9)^n
So, under that specific condition, for that specific value of omega, the original symsum reduces to the sum of alpha^n*alpha^(-n), from n=0 to inf. but alpha^n*alpha^(-n) is just 1 for all n. So the sum of 1 (a constant) from 0 to infinity must itself diverge to infinity as n gets arbitrarily large.
That is, when omega is specifically log(9/10)/1i, we get complete garbage. But you need to recognize that this condition imples that omega would then be an imaginary number. See that the second half of the piecewise result indicated what happens when omega is ANY other value. Anything at all.
We don't know if omega is a real or complex number. Apparently the symbolic toolbox was not told so. If omega is a real number, then that condition is meaningless, since the problem arises only when omega was a specific imaginary number.
Regardless, the OTHER half of the condition is when omega would have taken on ANY other value. And then, symsum gave up. It effectively told you that the sum was the limit of the sum, as n goes to infinity. As such, MATLAB never actually gave you something useful for the sum. It did not know the answer, if omega was some general value that may be real or complex.
Finally, you ask MATLAB to solve for an ANALYTICAL solution to something it was unable to deal with in the first place. MATLAB cannot solve for the solution of a problem it could not deal with in the first place!
Now, I have no clue what omega might be. Can it be complex? You tell me. But, IF I tell MATLAB that omega was real in the first place, then what happens?
syms n real
syms omega real
H = symsum(alpha^n *exp(-1i * omega * n),n,0,inf)
H =
(10*exp(omega*1i))/(10*exp(omega*1i) - 9)
norm(H)
ans =
(100/abs(10*exp(omega*1i) - 9)^2)^(1/2)
So now something moderately simple drops out. In fact, now I can go back in and put the norm back into the problem. When I wrap a norm around it, it does something, but nothing that exciting. We now have an abs in there now, which does confuse things just a bit. Is that useful? Only you know. I'm just playing around, since you never said what omega means to you.
solve(norm(H) == 0.5)
ans =
Empty sym: 0-by-1
vpasolve(norm(H) == 0.5)
ans =
-1.064710736992428343165281i
So while solve did not wish to solve for omega, such that norm(H) == 0.5, vpasolve was able to do so. At least, vpasolve thinks it has found something. However, what did it find? It found an imaginary result, for what should be the value of omega. And the only was we ever got something out of theis mess was if we effectively excluded complex results in the first place.
That suggests there IS NO REAL SOLUTION to the problem. Maybe we are done? Maybe not.
fplot(norm(H))
And that plot seems to suggest that norm(H) has two local minimizers, that look at least reasonably close to have a value of 0.5, in which case omega would be near 3. So next, we look at the minima of that function.
omfun = matlabFunction(norm(H))
omfun =
function_handle with value:
@(omega)sqrt(1.0./abs(exp(omega.*1i).*1.0e+1-9.0).^2.*1.0e+2)
[omsol,fval] = fminbnd(omfun,0,5)
omsol =
3.14159439201346
fval =
0.526315789473882
And that is also interesting.
fplot(norm(H),[2,4])
grid on
xlabel omega
And that tells us that your problem does in fact appear to have no real solution. The norm(H) never gets quite that small, never actually reaches 0.5. For omega roughly near pi, we found a solution that was close to 0.5, at norm(H)=0.526...
So I guess that leaves MATLAB in the form of an omphaloskeptic, contemplating where to go next. That choice is now up to you.
When you get something strange for a result, look at what it tells you. Think about what you see. There might be useful information content in that answer after all.

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by