On the message "Equations may not give solutions for 'all' variables"

I tried to solve a simultaneous equation consists of numeric coefficients and a paramater (say, ‘xi’). I got the message shown in the title when the matrix size of the coefficient exceeds 6. Up to 5, the “Solve” gave the answers including ‘xi’ well. If any numeric value was assigned to the ‘xi’, the “Solve” gave the answers regardless of the coefficient matrix size (I tested up to 300X300). I used "Assumptions → xi > 0 as well, but failed to get the answers. How can I sort it out?

The message usually comes when the equations are underdetermined, as in

Solve[x + y == 0, {x, y}]

If I need a value for x, for example, I can ask this way:

Solve[x + y == 0, x]

so that y will be treated as a parameter.

Thanks a lot for your advise.

I am afraid it may be necessary to show the equation a bit more detail for better understanding.

In Solve[{equations}, {variabls}],

{equations} are, for instance

a1 x1 + a2 x2 + … + aN xN == xi, b1 x1 + b2 x2 + … + bN xN == alpha, …, p1 x1 + p2 x2 + … + pN xN == beta xi

where “a1, a2, … pN” and “alpha, beta, …” are numeric values, and “xi” is a variable (only one variable exists in my problem). Of course, “x1, x2, …, xN” are the variables to be evaluated. “a1 ~ pN” constitue a NXN matrix of coefficients, and some of elements (i.e., a1 ~ pN) are null, which means that not all the equations have N terms in its left hand side (on the right hand side, only numeric values or “xi”).

The finding was, as I said, if “xi” was set as a numeric value (say, 1), the “Solve” gave all solutions of xN regardless of the matrix size (i.e., number of equations). However, the solutions that include “xi” could not be obtained when the matrix size exceeded 5X5 if “xi” remained in the equations. That is, the message of the title appeared without giving proper solutions if the number of equations were 6 or more.

Actually, the number of variables are the number of integration points in the numerical integration, while the number of equations are the number of collocation points, whose number is set as the same as that of the integration points in my case.

I want to get the number of the solutions including “xi” as large as possible (say, around 300) as they are used in the next step calculations where the “xi” is necessary and, eventually, influence the convergence of the final solution (the larger, the better convergence).

Thanks a priori for your time and concern.

Apology! A typographic error in the above.

In the above, “xi” is a parameter, not a variable.

Sorry for confusing and any inconvenience.

Here is my attempt at reproducing your problem:

n = 10;
mat = RandomInteger[5, {n, n}];
vars = Array[x, n];
rhs = Join[{xi}, Range[n - 2], {beta*xi}];
eqs = mat . vars == rhs
Solve[eqs, vars]

I don’t get any message. What is different in your situation?

Thanks indeed for your help.

I did not sort it out though, thus, I am attaching the part herewith. The test case is shown with n (nn in the program) = 6.

As you can easily recognize, i and k are the integration and collocation points, respectively.

If nn <= 5, no problem with the “xi”. Or, if “xi” is set as a numeric value, no problem regardless of the “nn” size.

Your advise will be highly appreciated. I will try to re-compile the program with using your suggestions before.

I tried to isolate the problem, and simplified it to the following 15 by 15 linear system:

mat = {{-(4/139), 0, 1/2, 1/2, 3/7, 57/110, 7/
    10, -(1/140), -(5/96), -(1/10), -(7/148), -(1/86), -(1/1600), 0, 
    0}, {2/69, 0, 0, 0, 0, 0, 0, -(680/99), 99/119, 10/61, 3/80, 1/
    104, 1/566, 2641/237, -(469/76)}, {3/119, 0, 0, 0, 0, 0, 
    0, -(161/74), -(44/61), 22/123, 5/53, 4/137, 1/172, 227/96, 281/
    60}, {1/65, 0, 0, 0, 0, 0, 0, -(95/88), -(95/126), -(9/62), 5/114,
     3/101, 1/138, 177/158, 109/81}, {1/160, 0, 0, 0, 0, 0, 
    0, -(92/131), -(76/135), -(32/129), -(3/86), 1/104, 1/225, 120/
    167, 95/124}, {1/1000, 0, 0, 0, 0, 0, 
    0, -(43/79), -(144/317), -(107/427), -(8/111), -(1/139), 1/1000, 
    41/74, 35/62}, {-(1/1608), 0, 0, 0, 0, 0, 
    0, -(57/118), -(29/71), -(15/62), -(1/12), -(1/69), -(1/1538), 26/
    53, 29/59}, {0, 
    0, -(137/75), -(193/209), -(25/68), -(11/84), -(2/69), -(2797/
     251), 469/76, 37/30, 30/71, 24/167, 1/32, 1559/178, 266/79}, {0, 
    0, 21/50, -(31/116), -(12/49), -(5/47), -(3/119), -(227/96), -3, 
    365/119, 5/8, 0, 1/25, 175/79, 383/174}, {0, 0, 1/5, 1/
    10, -(1/10), -(12/227), -(1/50), -(10/9), -(108/81), -(193/69), 
    67/38, 47/155, 0, 90/83, 136/133}, {0, 0, 7/67, 11/93, 2/
    68, -(1/90), -(1/100), -(120/167), -(95/124), -(12/13), -(227/
     125), 89/91, 12/115, 121/172, 92/143}, {0, 0, 7/107, 11/119, 3/
    65, 1/100, 0, -(41/74), -(35/62), -(73/123), -(44/65), -(59/51), 
    19/47, 85/156, 34/69}, {0, 0, 1/20, 1/10, 7/148, 0, 
    0, -(26/53), -(29/59), -1, -(1/2), -(1/2), -(13/20), 1/2, 3/
    7}, {0, 1, -1, -(1/6), -(1/20), 0, -(1/5), 0, 0, 0, 0, 0, 0, 115/
    66, -(137/75)},
   {0, 0, 11/15, -(22/120), -(5/53), 0, 0, 0, 0, 0, 0, 0, 0, 0, 21/50}};
vars = Array[x, 15];
eqs = mat . vars == {1.* t, t, t, t, t, t, t, 0, 0, 0, 0, 0, 0, t, t};
sol = Solve[eqs, vars]

My guess is that there is something in the Solve algorithm that fails in this situation. I leave it to the developers to investigate.

Thanks a lot again for your time and concern. I also suspect there might be a specific condition in SOLVE command to generate correct solutions appropriately. Prompt reply would not be available this week due to a trip to conference.

I’d probably use LinearSolve[]:

In[165]:= ca=CoefficientArrays[bxcomponentsofSimulEq,PhiVariables];
LinearSolve[ca[[2]],-ca[[1]]]

In[162]:= ca=CoefficientArrays[bycomponentsofSimulEq,PhiVariables];
LinearSolve[ca[[2]],-ca[[1]]]

I tried Reduce now, and it gave a warning about a badly conditioned matrix. Solve should do the same, I think.

This worked! The “LinearSolve” resolved the problem clearly. Appreciate for it (although I still do not know why the “LinearSolve” gave the correct solutions in this case).

The result of the “LinearSolve” was {Phivariables}, i.e. {Phixx’s, Phixy’s, Phiyx’s, Phiyy’s} in order where the number of each Phi$$'s was ‘nn’. In turn, it is necessary to pick up the values to assign each consecutive Phi$$'s. So to speak, in the {Phixx’s, Phixy’s, Phiyx’s, Phiyy’s}, the 1st through the nn^th elements are the Phixx[i]'s, from the (nn+1)^th to the (2*nn)^th for the Phixy[i]'s, from the (2*nn+1)^th to the (3*nn)^th for the Phiyx[i]'s, and from the (3*nn+1)^th to the (4*nn)^th for the Phiyy[i]'s.

What is the best Mathematica statements suitable for this job? I am now trying to find it but it must be helpful to reduce the time if any advise is given. Thanks in advance for it.