Search code examples
matlabsymbolic-math

Unable to solve nonlinear equations in Matlab


I am using Matlab Symbolic Toolbox with its solve function and attempting to solve a nonlinear system of 4 equations,

with 4 variables:

x1 y1 x2 y2

and 4 parameters

 delta1 delta2 alpha beta

The equations are described in the following image: Nonlinear equations

Here is the Matlab code:

syms x1 x2 y1 y2 alpha beta delta1 delta2

[x1,y1,x2,y2] = solve('delta1 * x1^alpha * y1^(1 - alpha) = (1 - x2)^alpha * (1 - y2)^(1-alpha)',...
    'delta2 * x2^alpha * y2^(1 - alpha) = (1 - x1)^beta* (1 - y1)^(1-beta)',...
    'alpha / (1-alpha) * (1 - y2) / (1 - x2) = beta / (1 - beta) * y2/x2',...
    'alpha / (1-alpha) * y1 / x1 = beta / (1 - beta) * (1 - y1) / (1 - x1)','x1','y1','x2','y2')

Matlab returns:

Warning: Explicit solution could not be found.

> In solve at 81

However, if I try to substitute both alpha and beta to 0.5.

[x1,y1,x2,y2] = solve('delta1 * x1^0.5 * y1^ 0.5 = (1 - x2)^0.5* (1 - y2)^0.5',...
    'delta2 * x2^0.5 * y2^0.5 = (1 - x1)^0.5* (1 - y1)^0.5',...
    '(1 - y2) / (1 - x2) = y2/x2',...
    'y1 / x1 = (1 - y1) / (1 - x1)','x1','y1','x2','y2')

then Matlab will give result.

So I wonder:

  1. Are the equations really unsolvable?

  2. If it can solved, am I using Matlab Symbolic Toolbox in the wrong way? Matlab can actually solve it.

  3. If Matlab is not capable enough to solve it, are there other tools that can solve nonlinear equation system?


Solution

  • Almost certainly, no, these are not analytically solvable. Unless alpha and beta are 1 or zero (or apparently 1/2), the equations will be equivalent to something that is too high of an order for analytical solution, though I cannot be certain of that without looking more carefully. But for general real alpha, this is too much to do.

    Yes, I know that computers are big, fast, powerful. They can do anything, right? But look at what happens when you try to solve simultaneous polynomial equations like this.

    For example, two quadratic equations in two unknowns will reduce to a 4th order equation when you eliminate one of the unknowns. A 4th order polynomial equation, with non-constant coefficients is solvable. But you have FOUR equations, each of which is essentially quadratic in nature. (There are products of variables in each equation.) So 4 of them will be equivalent to an eighth order polynomial, if you will try to solve it symbolically. It will have general non-constant coefficients. And we know that a 5th order polynomial or higher generally won't have an analytical solution. So while you MIGHT get lucky, perhaps for some special values of alpha & beta, almost certainly, there is no such analytical solution.

    And for general real alpha, things are worse. There is no expectation at all that a solution exists. The fact that when you tried, it failed backs that up. But, hey, a bigger computer might find an answer. Sorry, but not true.