I have to solve an inequality but it is too hard to do it by hand. Therefore, I would like to use Matlab. Let a = [(k-3)*sqrt(v)]/s
and b = 1.08148*a^2-epsilon
, where epsilon = 10^(-6)
. The inequality that needs to be solved is:
q(a,b) < s*sqrt(v)
where s
and v
are known. More precisely I want to solve the above inequality for k
(which occurs in a
and b
). Now, the problem is that q(a,b)
is the greatest real root of the quartic polynomial:
(48*a^2+16*b)*x^4 - (40*a^3+168*a*b)*x^3+(-45*a^4+225*a^2*b+72*b)*x^3+(27*a^2*b-162*a*b^2)*x+27*b^3
I tried to run this:
syms x z
av = ((x-3)*sqrt(v))/s;
Q = max(roots([48*z^2+16*(1.08148*z-eps), -40*z^3-168*z*(1.08148*z-eps), -45*z^4+225*z^2*(1.08148*z-eps)+72*(1.08148*z-eps)^2, 27*z^3*(1.08148*z-eps)-162*z*(1.08148*z-eps)^2, 27*(1.08148*z-eps)^3]));
F = compose(Q,av);
solve(F-skew*sqrt(var)<0, x)
but Matlab keeps giving the following error:
Error using sym/max (line 97) Input arguments must be convertible to floating-point numbers.
Error in Testt (line 13) R = max(roots([2048, -6912*((x-3)sqrt(var)/skew)^2, 8088((x-3)sqrt(var)/skew)^4, -3600((x-3)sqrt(var)/skew)^6, 375((x-3)*sqrt(var)/skew)^8]));
Perhaps someone has a better idea to solve it? The best way would be if I had an explicit expression for the greatest real root q of the quartic in function of a and b. However, this explicit expression is too lengthy to use.
The error information seemed to say the max() function do not support sym x z.
Because the returned result of roots() includes x and z.But Matlab doesn't know the value of x and z,so it can't calculate the value of the roots and then can't compare them.
Maybe you should improve your algorithm.