Matlab cannot find solution
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi everyone,
I'm trying to use matlab to solve this inequality. My goal is to express r in terms of m and n. When I run my scrip there is no error but S is empty. I wonder if it means that there is no solution or it is too complicated for matlab to solve?
syms r m n
eqn = ((2*r^4-8*r^3+24*r^2-8*r+1)/(12*r^2)) > (3/(m^2*(n-1)));
S = vpasolve(eqn,r);
0 commentaires
Réponses (2)
Sam Chak
le 7 Oct 2023
Hi @Xinjie Qian
If the solve() function is used, then it says "Unable to find explicit soluion."
syms r m n
eqn = ((2*r^4-8*r^3+24*r^2-8*r+1)/(12*r^2)) > (3/(m^2*(n-1)));
S = solve(eqn, r);
0 commentaires
Walter Roberson
le 7 Oct 2023
vpasolve() can only be productively used when the number of equations is the same as the number of variables, and all of the equations are equalities.
MATLAB is weak solving inequalities, so convert them to equalities
sympref('abbreviateoutput', 0)
syms r m n
syms Delta positive
eqn = ((2*r^4-8*r^3+24*r^2-8*r+1)/(12*r^2)) == (3/(m^2*(n-1))) + Delta;
S = solve(eqn, r, 'returnconditions', true)
S.r
S.conditions
The solutions are quartics in the "excess" -- the amount by which the left hand side is greater than the original right hand side, here expressed as the variable Delta.
The roots of a quartic can be expressed exactly as algebraic numbers. You can add the option 'maxdegree', 4 to the solve() to get the detailed solution. However, for nearly all practical purposes, the details are unreadable by humans -- if you were to flip a random sign of a term in the output, very very few people would notice or understand the implications.
The bit about S.conditions is saying that those solutions are invalid if m == 0 or n == 1 or if the root() is exactly 0. Recall that the original equation involves a division, so it is not surprising that there might be values that correspond to division by 0 and that such values would mess up the equations.
0 commentaires
Voir également
Catégories
En savoir plus sur Conversion Between Symbolic and Numeric dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!