Solve for y in function z = f(x, y)

Hi All,
I have a polynomial which is a function of x (2nd order) and y (fifth order) and I wish to solve for y. My equation is:
p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 + p21*x^2*y + p12*x*y^2 + p03*y^3 + p22*x^2*y^2 + p13*x*y^3 + p04*y^4 + p23*x^2*y^3 + p14*x*y^4 + p05*y^5
I have tried:
syms x y z p00 p10 p01 p20 p11 p02 p21 p12 p03 p22 p13 p04 p23 p14 p05
eqn = p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 + p21*x^2*y + p12*x*y^2 + p03*y^3 + p22*x^2*y^2 + p13*x*y^3 + p04*y^4 + p23*x^2*y^3 + p14*x*y^4 + p05*y^5 == z
soly = solve(eqn,y)
and this has returned:
soly = root(p05*z1^5 + p14*x*z1^4 + p04*z1^4 + p23*x^2*z1^3 + p13*x*z1^3 + p03*z1^3 + p22*x^2*z1^2 + p12*x*z1^2 + p02*z1^2 + p11*x*z1 + p21*x^2*z1 + p01*z1 - z + p20*x^2 + p10*x + p00, z1, 1)
I'm afraid i don't recognize this format. Where did z1 come from and I assume the the 1 (before the closing parenthisis) implies that it is the first and only solution? Nor am I sure about the root.
I have tried something similar in the past:
syms x y z p00 p10 p01 p20 p11 p02 p30 p21 p12
eqn = p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 + p30*x^3 + p21*x^2*y + p12*x*y^2 == z
soly = solve(eqn,y)
and this yielded a more familiar format:
-(p01 + p11*x + p21*x^2 + (p11^2*x^2 + p21^2*x^4 - 4*p00*p02 + 4*p02*z + p01^2 + 2*p01*p21*x^2 - 4*p02*p20*x^2 - 4*p10*p12*x^2 - 4*p02*p30*x^3 + 2*p11*p21*x^3 - 4*p12*p20*x^3 - 4*p12*p30*x^4 - 4*p00*p12*x + 2*p01*p11*x - 4*p02*p10*x + 4*p12*x*z)^(1/2))/(2*(p02 + p12*x))
-(p01 + p11*x + p21*x^2 - (p11^2*x^2 + p21^2*x^4 - 4*p00*p02 + 4*p02*z + p01^2 + 2*p01*p21*x^2 - 4*p02*p20*x^2 - 4*p10*p12*x^2 - 4*p02*p30*x^3 + 2*p11*p21*x^3 - 4*p12*p20*x^3 - 4*p12*p30*x^4 - 4*p00*p12*x + 2*p01*p11*x - 4*p02*p10*x + 4*p12*x*z)^(1/2))/(2*(p02 + p12*x))
Regards and thanks in advance.
Tim

1 Comment

syms x y z p00 p10 p01 p20 p11 p02 p30 p21 p12
eqn = p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 + p30*x^3 + p21*x^2*y + p12*x*y^2 == z
soly = solve(eqn,y)
In eqn, the maximum power that y apears is y^2 so that eqn can be rephrased as a quadratic,
(p02 + p12*x)*y^2 + (p01 + p11*x + p21*x^2)*y + (p00 + p10*x + p20*x^2 + p30*x^3 - z) == 0
which can easily be solved.
But your original equation has y^5 and that gives you problems.

Sign in to comment.

 Accepted Answer

If the values for x and z are known, then you can numerically solve for y.
syms y
x = 1;
z = 0;
p00 = 1;
p10 = 1;
p01 = 1;
p20 = 1;
p11 = 1;
p02 = 1;
p21 = 1;
p12 = 1;
p03 = 1;
p22 = 1;
p13 = 1;
p04 = 1;
p23 = 1;
p14 = 1;
p05 = 1;
eqn = p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 + p21*x^2*y + p12*x*y^2 + p03*y^3 + p22*x^2*y^2 + p13*x*y^3 + p04*y^4 + p23*x^2*y^3 + p14*x*y^4 + p05*y^5 == z
eqn = 
soly = vpasolve(eqn, y)
soly = 

8 Comments

If you wish to obtain the analytical solution for y in terms of the symbolic variables x and z, as well as the symbolic parameters p00, p10, p01, p20, p11, p02, p21, p12, p03, p22, p13, p04, p23, p14, and p05, then it is mathematically impossible. This impossibility is a consequence of the Abel–Ruffini impossibility theorem, which states that "there is no solution in radicals to general polynomial equations of degree five or higher with arbitrary coefficients".
By the way, the Impossibility Theorem does not say that the roots of polynomials of degree 5 or higher do not generally exist: the Impossibility Theory says that you cannot generally construct those roots as being a certain kind of constructed numbers -- numbers involving addition, subtraction, multiplication, division, raising to an integer power, or taking square roots. The theorem shows that the number of polynomials of degree 5 or higher is "larger" (in some meaningful way) then the number of polynomials that can be back-constructed from numbers that are of that form, and therefor there must be polynomials of degree 5 that have roots that are not expressible as such numbers.
The situation is sort of similar to demonstrating that there are polynomials of degree 2 with real roots whose roots are not rational numbers -- that for example, x^2 - 2 has roots that cannot be rational.
And in the meantime, no-one has come up with a way to construct the roots of the polynomials of degree 5 or higher in terms of other kinds of numbers (that are not radicals.) But they have come up with some amazing results in the investigations.
Thanks @Walter Roberson for the explanation.
@Tim Fulcher, could you please provide more information about the nature of the bivariate function ?
syms x y z p00 p10 p01 p20 p11 p02 p30 p21 p12
eqn = p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 + p30*x^3 + p21*x^2*y + p12*x*y^2 == z
eqn = 
soly = solve(eqn, y)
soly = 
Tim Fulcher
Tim Fulcher on 7 Oct 2023
Moved: Dyuman Joshi on 7 Oct 2023
many thanks for your answer. I'll give it a try shortly.
Oh, the coefficients are known.
Regards and thanks again.
Tim
Tim Fulcher
Tim Fulcher on 7 Oct 2023
Moved: Dyuman Joshi on 7 Oct 2023
@Sam Chak, sure. The coefficients are:
p00 = 0.4719;
p10 = 0.00337;
p01 = -1.395;
p20 = 5.469e-05;
p11 = 0.00673;
p02 = 0.9839;
p21 = 3.936e-05;
p12 = 0.005815;
p03 = -0.4381;
p22 = 9.88e-06;
p13 = -0.001212;
p04 = 0.07777;
p23 = -6.416e-07;
p14 = 8.003e-05;
p05 = -0.004704;
Again, thanks to you and @Walter Roberson.
Regards
Tim
Thanks to @Dyuman Joshi for organizing the posts.
With the values for the parameters provided, the results for both equations are shown below:
syms x y z
% Parameters
p00 = 0.4719;
p10 = 0.00337;
p01 = -1.395;
p20 = 5.469e-05;
p11 = 0.00673;
p02 = 0.9839;
p21 = 3.936e-05;
p12 = 0.005815;
p03 = -0.4381;
p22 = 9.88e-06;
p13 = -0.001212;
p04 = 0.07777;
p23 = -6.416e-07;
p14 = 8.003e-05;
p05 = -0.004704;
% Case A: Solving Equation 1
eqn1 = p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 + p21*x^2*y + p12*x*y^2 + p03*y^3 + p22*x^2*y^2 + p13*x*y^3 + p04*y^4 + p23*x^2*y^3 + p14*x*y^4 + p05*y^5 == z
eqn1 = 
sol1 = solve(eqn1, y)
sol1 = 
% Case B: Solving Equation 2
eqn2 = p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 + p03*x^3 + p21*x^2*y + p12*x*y^2 == z
eqn2 = 
sol2 = solve(eqn2, y)
sol2 = 
Tim Fulcher
Tim Fulcher on 9 Oct 2023
Moved: Sam Chak on 9 Oct 2023
Many thanks guys. That worked really well.
Regards
Tim
Good to hear that, @Tim Fulcher. If you find the guidance helpful, please consider clicking 'Accept' ✔ on the answer to close the issue when the problem is solved.

Sign in to comment.

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Products

Release

R2019b

Asked:

on 7 Oct 2023

Commented:

on 9 Oct 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!