Prev: rotating an image
Next: Advanced Stop ODEs
From: Charlie Vlieland-Boddy on 22 Jul 2010 10:46 I am trying to solve a 5-th order polynomial, but get the following error after roots([t y u i o p]) ??? Undefined function or method 'isfinite' for input arguments of type 'sym'. Error in ==> roots at 27 if ~all(isfinite(c)) I calculated the coefficients t,y,u,i,o,p by using collect(X,L) where i want to collect all the 'L' terms from the function X. I then copy the coefficients i.e. (a+b+c)*L^5 +.... t=a+b+c Then run the roots command, why am i getting this error?
From: Steven_Lord on 22 Jul 2010 11:11 "Charlie Vlieland-Boddy" <moredrunkmale(a)gmail.com> wrote in message news:i29ljr$dtj$1(a)fred.mathworks.com... > I am trying to solve a 5-th order polynomial, but get the following error > after > roots([t y u i o p]) > > ??? Undefined function or method 'isfinite' for input arguments of type > 'sym'. > > Error in ==> roots at 27 > if ~all(isfinite(c)) The ROOTS function is intended for computing the roots of a polynomial whose coefficients are NUMBERS, not symbolic expressions. To find the roots of a polynomial with symbolic coefficients, create the symbolic polynomial and use SOLVE. Note, though, that depending on your problem it may not be possible to obtain "nice" expressions for the roots. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: Charlie Vlieland-Boddy on 22 Jul 2010 11:29 Ok thanks for that. When i do this i get a new parameter 'X' in the output. For example >> solve(Z,L) ans = RootOf(4*X2^5*a_2*b_1*b_2^3*c - 2*X2^5*b_1*b_2^3*c^2 - 2*X2^5*a_2^2*b_1*b_2^3................... I have not specified any 'X' variable.
From: Steven_Lord on 22 Jul 2010 11:39 "Charlie Vlieland-Boddy" <moredrunkmale(a)gmail.com> wrote in message news:i29o40$q32$1(a)fred.mathworks.com... > Ok thanks for that. > When i do this i get a new parameter 'X' in the output. > > For example > > >>> solve(Z,L) > > ans = > > RootOf(4*X2^5*a_2*b_1*b_2^3*c - 2*X2^5*b_1*b_2^3*c^2 - > 2*X2^5*a_2^2*b_1*b_2^3................... > > I have not specified any 'X' variable. Remember how I said "Note, though, that depending on your problem it may not be possible to obtain "nice" expressions for the roots."? In this case, it isn't. SOLVE says that the solutions to Z in terms of L are the roots of the expression the beginning of which you posted, and X2 is a "dummy variable" used as the variable to solve for in that RootOf expression. If you want to give it some help in trying to solve this, specify numeric values for some or all of the symbolic variables present in the coefficients of Z. As an example, which of these expressions do you think is easier to solve? x^N + x^M + 1 % for arbitrary N and M x^2 + x^1 + 1 The more information you give SOLVE, the happier it'll be. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: Walter Roberson on 22 Jul 2010 11:46
Charlie Vlieland-Boddy wrote: > Ok thanks for that. > When i do this i get a new parameter 'X' in the output. > > For example > > >>> solve(Z,L) > > ans = > > RootOf(4*X2^5*a_2*b_1*b_2^3*c - 2*X2^5*b_1*b_2^3*c^2 - > 2*X2^5*a_2^2*b_1*b_2^3................... > > I have not specified any 'X' variable. Each X* is a dummy variable. RootOf() evaluates to the values of the dummy variable that would satisfy the condition that the given expression becomes 0. There are mechanisms to control the work that solve() will go to in pursuing a symbolic solution to the root; in particular solve() will automatically resolve quadradic forms and cubic forms, but will usually leave quartics in symbolic form as the explicit solutions to quartics are so long and messy that they usually obscure far more than they make clear. You can force solve() to resolve quartics, though [or at least you can if you are using the Maple based symbolic toolbox; I do not know for certain that the MuPad based symbolic toolbox retained that feature.] The Maple call to force a RootOf() placeholder to be symbolically resolved (where known) is allvalues(); there is likely a similar MuPad call. When you see a RootOf() in a solution and it is not a simple quartic that has been left unresolved, then the symbolic engine does not know any means to find a symbolic solution, but it may be possible to find a numeric solution to it. The Maple call to force numeric evaluation of a RootOf() placeholder is evalf(); if I recall correctly the equivalent MuPad call is named something different than that. |