How do I simplify the solution in z1?
2 次查看(过去 30 天)
显示 更早的评论
Hello,
Trying to solve this (s is the variable and g zeta eta z ksi h ff fk ff fe and l are parameters) I get z1 in my solution whicn is in the form of RootOf. Any idea what that is or any better wway of solving this equation?
syms s g zeta eta z ksi h ff fk ff fe l
eqn_1=(1-g)*s*(((1./(4*ksi))*((zeta-eta*((s./(2*ksi+eta*s))*(zeta-(g*(1./h)+(1-g)*(1./l))))-(1./l)).^2)-ff)+((1./(4*ksi))*((zeta-eta*((1./eta)*(zeta-(1./z)-(2*ksi+eta)*((2*ksi*(zeta-(1./z))+eta*(1-g)*s*((1./l)-(1./z)))./(2*ksi*(2*ksi+eta*s+eta)+(eta.^2)*(1-g)*s))))-(1./l)).^2)-ff))+g*s*(((1./(4*ksi))*((zeta-eta*((s./(2*ksi+eta*s))*(zeta-(g*(1./h)+(1-g)*(1./l))))-(1./h)).^2)-ff)+((ksi+eta)*(((2*ksi*(zeta-(1./z))+eta*(1-g)*s*((1./l)-(1./z)))./(2*ksi*(2*ksi+eta*s+eta)+(eta.^2)*(1-g)*s)).^2)-ff-fk))-s*fe;
[sols]= solve(eqn_1 == 0, s)
Thanks in advance for your help.
Best,
Cara
0 个评论
采纳的回答
Walter Roberson
2016-1-15
There is a solution at 0, and there is a set of 4 solutions which are together designated by the expression involving RootOf(). In the symbolic toolbox, RootOf(f(z),z) for some variable z, represents the set of z such that f(z) = 0 - the roots of the expression. In the case, the expression is a quartic, a polynomial of order 4.
Quartics do have exact solutions. You can use MaxDegree to get the explicit solution. I do not recommend that, however, as the explicit solution will be rather large.
It is common that two or all four roots of a quartic are complex valued, and it is common that only real-valued solutions are desired. However, in the general symbolic form, you do not know which of them is going to be real, not unless you have restrictions on the realness and range of the component terms. Typically if all of the coefficients are real-valued then the first two of the four solutions will be real if any of them are.
For practical purposes, what you usually do with a RootOf() of a quartic is use matlabFunction to turn it into something you do not need to worry about. But that can be slow, both in the conversion and the execution. More certain is to use op() to pick apart the RootOf and then coeffs() to pick out the various terms, and write them into a vector that you will later turn into parameters of a roots() call.
3 个评论
Walter Roberson
2016-1-16
You have not been clear as to which form you are looking for.
One solution is 0. The other 4 are eta/ksi * z1 where z1 is the root of a 4th order polynomial. The calculation of any one exact solution of the 4th order polynomial requires more than 8 gigabytes of memory
If you have numeric values for the parameters, then
L = l; %for clarity, hard to distinguish l from 1
z_0 = ((((256 * fk * g + 256 * fe + 512 * ff) * ksi^3 + ((256 * fk * g + 256 * fe + 512 * ff) * eta - 128 * Zeta^2) * ksi^2 + 64 * eta * ((fk * g + fe + 2 * ff) * eta - 2 * Zeta^2) * ksi + 16 * Zeta^2 * eta^2 * (g-2)) * L^2 - 64 * Zeta * (eta + 2*ksi)^2 * (g-1) * L + 32 * (eta + 2*ksi)^2 * (g-1)) * h^2 + 32 * g * Zeta * L^2 * (eta + 2*ksi)^2 * h - 16 * g * L^2 * (eta + 2*ksi)^2) * z^2 + 128 * g * Zeta * h^2 * L^2 * ksi * (eta + ksi) * z - 64 * g * h^2 * L^2 * ksi * (eta + ksi);
z_1 = ((((512 * fk * g + 512 * fe + 1024 * ff) * ksi^3 + (-128 * g^2 * fk * eta - 128 * eta * (fe + 2 * ff - 4 * fk) * g + (512 * fe + 1024 * ff) * eta - 128 * Zeta^2) * ksi^2 - 64 * eta * (g^2 * fk * eta + ((fe + 2 * ff - 2 * fk) * eta - (1 / 2) * Zeta^2) * g + (-2 * fe - 4 * ff) * eta + 2 * Zeta^2) * ksi + 32 * Zeta^2 * eta^2 * (g - 1)) * L^2 + 32 * Zeta * (g - 1) * (-8 * ksi^2 + (3 * eta * g - 8 * eta) * ksi + eta^2 * (g - 2)) * L + (64 * (g - 1)) * ((g + 1) * ksi + (1 / 2) * eta) * (eta + 2 * ksi)) * h^2 - (32 * ((-2 * ksi + (g - 1) * eta) * Zeta * L + (eta + 2 * ksi) * (g - 1))) * L * g * (eta + 2 * ksi) * h + (32 * ((g - 2) * ksi + (g - 1) * eta)) * L^2 * g * (eta + 2 * ksi)) * z^2 - 32 * L * g * ((-4 * ksi + eta * (g - 5)) * Zeta * L + (3 * (g - 1)) * (eta + (4 / 3) * ksi)) * h^2 * ksi * z + 64 * g * h^2 * L^2 * ksi * (eta + ksi) * (g - 2)
z_2 = (((16 * g^3 * fk * eta^2 * ksi - 4 * eta * (((-4 * fe - 8 * ff + 24 * fk) * ksi + Zeta^2) * eta + 48 * fk * ksi^2) * g^2 + (((-96 * fe - 192 * ff + 96 * fk) * ksi + 12 * Zeta^2) * eta^2 + (16 * ((-12 * fe - 24 * ff + 24 * fk) * ksi + Zeta^2)) * ksi * eta + 384 * fk * ksi^3) * g - (8 * ((-12 * fe - 24 * ff) * ksi + Zeta^2)) * (eta + 2 * ksi)^2) * L^2 - 8 * Zeta * (g - 1) * (g^2 * eta^2 - 2 * eta * (eta + 4 * ksi) * g + 2 * (eta + 2 * ksi)^2) * L - (12 * (eta * (eta + 4 * ksi) * g^2 + ( - eta^2 - (28 / 3) * eta * ksi - (40 / 3) * ksi^2) * g - (2 / 3) * (eta + 2 * ksi)^2)) * (g - 1)) * h^2 + (8 * (Zeta * (eta * g - eta - 2 * ksi)^2 * L + (4 * (g - 1)) * (eta * g - (5 / 4) * eta - (5 / 2) * ksi) * (eta + 2 * ksi))) * L * g * h - 20 * L^2 * g * (eta * (eta + (8 / 5) * ksi) * g^2 - (11 / 5 * (eta + (10 / 11) * ksi)) * (eta + 2 * ksi) * g + (6 / 5) * (eta + 2 * ksi)^2)) * z^2 + (32 * ( - Zeta * (eta * g - 2 * eta - ksi) * L + (g - 1) * (eta * g - 4 * eta - 5 * ksi))) * L * g * h^2 * ksi * z - 16 * L^2 * g * (g^2 * eta + (-6 * eta - 5 * ksi) * g + 6 * eta + 6 * ksi) * h^2 * ksi;
z_3 = (4 * eta^2 * (h - L)^2 * g^4 + (16 * ((L^2 * fk * eta * ksi - eta - (5 / 2) * ksi) * h^2 + (2 * (eta + (3 / 2) * ksi)) * L * h - (eta + (3 / 2) * ksi) * L^2)) * eta * g^3 + ((16 * eta * (-6 * fk * ksi + eta * (fe + 2 * ff - 3 * fk)) * ksi * L^2 + 8 * Zeta * L * eta * ksi + (20 * (eta + 4 * ksi)) * (eta + (4 / 5) * ksi)) * h^2 - 40 * L * (eta + 2 * ksi) * (eta + (4 / 5) * ksi) * h + 20 * L^2 * (eta + 2 * ksi) * (eta + (4 / 5) * ksi)) * g^2 + (( - (48 * ( - (4 / 3) * fk * ksi + eta * (fe + 2 * ff - (2 / 3) * fk))) * (eta + 2 * ksi) * ksi * L^2 - 8 * Zeta * L * eta * ksi - 8 * eta^2 - 56 * eta * ksi - 64 * ksi^2) * h^2 + 16 * L * (eta + 2 * ksi)^2 * h - 8 * L^2 * (eta + 2 * ksi)^2) * g + 32 * h^2 * L^2 * ksi * (eta + 2 * ksi)^2 * (fe + 2 * ff)) * z^2 + 32 * L * (g - 1) * g * h^2 * ksi * ( - (1 / 4) * Zeta * L * eta + eta * g - (7 / 4) * eta - 2 * ksi) * z - 16 * g * h^2 * L^2 * ksi * (g - 1) * (eta * g - 2 * eta - 2 * ksi);
z_4 = (eta^2 * (h - L)^2 * g^4 + 4 * eta * ((L^2 * fk * eta * ksi - (3 / 4) * eta - 2 * ksi) * h^2 + (3 / 2 * (eta + (4 / 3) * ksi)) * L * h - (3 / 4 * (eta + (4 / 3) * ksi)) * L^2) * g^3 + ((4 * eta * (-4 * fk * ksi + (fe + 2 * ff - 2 * fk) * eta) * ksi * L^2 + 3 * eta^2 + 16 * eta * ksi + 8 * ksi^2) * h^2 - 6 * L * (eta + 2 * ksi) * (eta + (2 / 3) * ksi) * h + 3 * L^2 * (eta + 2 * ksi) * (eta + (2 / 3) * ksi)) * g^2 + (( - (8 * ( - fk * ksi + eta * (fe + 2 * ff - (1 / 2) * fk))) * (eta + 2 * ksi) * ksi * L^2 - eta^2 - 8 * eta * ksi - 8 * ksi^2) * h^2 + 2 * L * (eta + 2 * ksi)^2 * h - L^2 * (eta + 2 * ksi)^2) * g + 4 * h^2 * L^2 * ksi * (eta + 2 * ksi)^2 * (fe + 2 * ff)) * z^2 + 8 * g * h^2 * L * ksi * (g - 1) * (eta * g - eta - ksi) * z - 4 * g * h^2 * L^2 * ksi * (g - 1) * (eta * g - eta - ksi);
z = [z_4, z_3, z_2, z_1, z_0];
z1 = roots(z);
sols = [0; ksi / eta * z1(:)];
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!