Solver added a variable?
4 views (last 30 days)
Show older comments
syms x y z;
solve(z==14.78+6.26*x+(-2.175)*y+(-0.9272)*x^2+(-1.357)*x*y+1.316*y^2+1.504*x^3+0.08749*x^2*y+0.3966*x*y^2+(-0.4403)*y^3,x)
This give me a answer of:
ans =
root(z1^3 + (125*z1^2*((8749*y)/100000 - 1159/1250))/188 + (125*z1*(- (1357*y)/1000 + (1983*y^2)/5000 + 313/50))/188 - (125*z)/188 - (2175*y)/1504 - (4403*y^3)/15040 + (7*y^2)/8 + 3695/376, z1, 1)
root(z1^3 + (125*z1^2*((8749*y)/100000 - 1159/1250))/188 + (125*z1*(- (1357*y)/1000 + (1983*y^2)/5000 + 313/50))/188 - (125*z)/188 - (2175*y)/1504 - (4403*y^3)/15040 + (7*y^2)/8 + 3695/376, z1, 2)
root(z1^3 + (125*z1^2*((8749*y)/100000 - 1159/1250))/188 + (125*z1*(- (1357*y)/1000 + (1983*y^2)/5000 + 313/50))/188 - (125*z)/188 - (2175*y)/1504 - (4403*y^3)/15040 + (7*y^2)/8 + 3695/376, z1, 3)
What is the 'z1' in the answer? Where did it come from, and what do I do with it?
Thanks in advance for the help!
0 Comments
Answers (1)
Walter Roberson
on 19 Jan 2018
Edited: Walter Roberson
on 19 Jan 2018
The general form is
root(expression_in_variable, variable, number)
root(expression_in_variable, variable) is a place holder for the complete set of values of the named variable such that the expression in the variable becomes 0 -- that is, root() stands in for the roots of the given expression.
When a number is specified, then one particular root is to be selected. You are dealing with a cubic polynomial, so there are three roots (that are possibly complex) and the selectors 1, 2, and 3 designate which of the roots are being referred to.
The numbering of the roots is not documented. For any given expression, the numbering is consistent, but it might be difficult to work out the rules about how it decides which of the roots is associated with which index.
MATLAB introduces a new variable for this purpose because in general the variable you were trying to solve() for is an expression on one of these root() values, rather than being one of the root values directly.
0 Comments
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!