I don't know how to solve this equation.

1 view (last 30 days)
Jiwhan Lee
Jiwhan Lee on 9 Oct 2016
Answered: Walter Roberson on 9 Oct 2016
syms x a b T T = [50:1:100]; A12 = 1.6022 A21 = 0.7947 Pt = 101.325
Ae = 8.04494 Be = 1554.3 Ce = 222.65 Aw = 8.07131 Bw = 1730.6 Cw = 233.426
a = (10.^(Ae-(Be./(T+Ce)))).*0.1333 b = (10.^(Aw-(Bw./(T+Cw)))).*0.1333
G1 = exp(((1-x).^2).*((A12+2.*(A21-A12)).*x)) G2 = exp(x.^2.*((A21+2.*(A12-A21).*(1-x)))) eqn = Pt ==(G1.*x.*a) + (G2.*(1-x).*b) ; solx = solve(eqn, x)
-------------------------------------- It was my code , but the matlab said
Cannot find explicit solution. > In solve (line 316)
solx =
Empty sym: 0-by-1
I need to get x somebody help me
  1 Comment
Massimo Zanetti
Massimo Zanetti on 9 Oct 2016
Do you know about "code" formatting option, when you submit a question? It helps people understandin your question. Try format your piece of code to put it in readable form, please.

Sign in to comment.

Answers (2)

Marc Jakobi
Marc Jakobi on 9 Oct 2016
Edited: Marc Jakobi on 9 Oct 2016
"Cannot find an explicit solution" means that there may only be an implicit solution, i.e. the variable x you are solving for cannot be isolated. You may have to try to solve it numerically.
Take a look at the equation
pt == (g1.*x.*a) + (g2.*(1-x).*b);
and try to solve it for x by hand.
pt ./ (g2.*b) == g1.*a ./ (g2.*b) .*x + (1-x);
pt ./ (g2.*b) .* (g2.*b) ./ (g1.*a) == x + (1-x) .* (g2.*b) ./ (g1.*a)
pt ./ (g1.*a) == x + (1-x) .* (g2.*b) ./ (g1.*a)
As you can see, x cannot be isolated, thus there is no explicit solution and the equation cannot be solved using solve()

Walter Roberson
Walter Roberson on 9 Oct 2016
You are asking for closed form solutions to equations involving exponents that are floating point values. It is uncommon that there are closed form solutions for expressions involving floating point and using a floating point as an exponent rarely has a solution.
Remember that binary floating point cannot exactly represent 0.1, so what does, 0.1333 mean, exactly? If it is intended to mean the ratio 4/30 then code that, sym(4)/sym(30). Is 1554.3 intended to represent 1554+(3/10) or is it 1554+(1/3) or is it something else? You have no hope of getting a correct closed form solution unless your input is your exact values in rational form or rational powers of rationals or uses one of the irrational constants that the symbolic engine knows like sym('pi')
Once you have converted those floating point numbers to algebraic numbers to exactly represent them, then you at least have a chance of getting a closed form solution. But in practice using a constant to a power which is a ratio whose denominator is more than about 50 (estimating) turns the equation into one where it is not feasible to find the solutions unless you add constraints (and those are often not enough). For example if you had 10 to (18/57) then the symbolic engine needs to perform the calculation with respect to all 57 complex roots of 10 to the 18.
If you have nonlinear equations and floating point coefficients the first thing that you should ask is whether you really need to find the exact theoretical solutions, and also whether you need to find all of the theoretical solutions. If you do not need one of those two then you should be looking for numeric solutions instead of algebraic closed form solutions. For example you might consider vpasolve()...
After, that is, you decide what those floating point numbers really designate, because if you don't know what they designate then it is Garbage In, Garbage Out . Like is that 1554.3 a measured approximation for a number that is between 1554.25 and 1554.35? Knowing that could be important because with nonlinear systems it might turn out that there are only real valued solutions if the true value is between approximately 1554.3018 and 1554.7936 so you need to know if that value was 1554+(3/10) exactly and so not in the range where there is a real valued solution.
Nonlinear equations together with floating point numbers are pretty much a guarantee that any value you get out does not represent the reality of your situation.

Tags

Community Treasure Hunt

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

Start Hunting!