Relationship between variables from a number of equations

2 次查看(过去 30 天)
I have 500 variables and 100 equations. Could I get a result with the relationships between the variables?
So the equations I have:
f1(x1,x2,...,x500)≈0
f2(x1,x2,...,x500)≈0
...
f100(x1,x2,...,x500)≈0
for fn=An*(sin(Bn+x1)+sin(Bn+x2)...+sin(Bn+x500))
An, Bn known values
  7 个评论
Walter Roberson
Walter Roberson 2017-7-10
What are the permitted relationship operators? x1=5*x2+8*x3+... would tend to imply linear relationships but An*sin(Bn+xn) would tend to imply nonlinear relationships.
If you are looking for linear relationships then you could consider taking a rref (Row Reduced Echelon Form) to express xn in terms of the remaining variables x(n+1) to x(end)
Spyros Polychronopoulos
@Torsten I corrected it I am sorry it's: fn=An*(sin(Bn+x1)+sin(Bn+x2)...+sin(Bn+x500))
@Walter Roberson I am not after a linear relationship between the values. Could be any relationship that was just an example.

请先登录,再进行评论。

采纳的回答

John D'Errico
John D'Errico 2017-7-10
编辑:John D'Errico 2017-7-10
I've posted this as a different answer, because I'm taking a slightly different angle in how I look at things, and because this will be pretty long in itself...
You are missing something, in that these are not linear relationships that you have. But perhaps we can try this:
We have a set of 100 constants Bn. I'll pick some random numbers as an example.
B = randn(100,1);
Now, we wish to find some set of numbers X, where X is a vector of length 500, such that
sin(Bn+x1)+sin(Bn+x2)...+sin(Bn+x500) == 0
So 100 such equations, one for each value of B.
Let us use the sine identity for the sum of angles.
sin(u+v) = sin(u)*cos(v) + cos(u)*sin(v)
So we can expand each of the individual terms in our equations as
sin(Bn + x1) = sin(Bn)*cos(x1) + cos(Bn)*sin(x1)
But remember that Bn is the same for each term in an equation. So by expanding each sine term in one of your equations, then combining terms, each of your equations reduces to:
sin(Bn)*sum(cos(x_i)) + cos(Bn)*sum(sin(x_i)) = 0
where sum(sin(x_i)) indicates the sum of the sines of each of your variables. We can do this because each of your terms has a very similar form.
Let us now do another transformation. We don't know what the sum of the sines of our unknowns is. But it appears identically in EVERY equation.
S = sum(sin(x_i))
C = sum(cos(x_i))
We don't know what the values of S or C are. But we need to recognize that the x_i don't really matter, all that matters is the sum of their sines and cosines.
So now you will be left with a linear system of 100 HOMOGENEOUS equations in TWO unknowns, S and C. There will be no exact solution.
sin(B1)*C + cos(B1)*S = 0
sin(B2)*C + cos(B2)*S = 0
sin(B3)*C + cos(B3)*S = 0
...
sin(B100)*C + cos(B100)*S = 0
Essentially, this reduces to an overdetermined homogeneous linear system, with two unknowns and 100 equations. We can write it in the form
A*V == 0
where the matrix A has two columns,
A = [sin(B),cos(B)];
and V is the vector of our two unknowns, thus V=[S;C]. We are making SOME progress here.
How do you solve this homogeneous linear system? What value of V is best? That comes from the eigenvalues of A'*A. A'*A has two eigenvalues. In my example:
[V,D] = eig(A'*A)
V =
-0.92641 0.37653
0.37653 0.92641
D =
43.845 0
0 56.155
So the eigenvector that minimizes the sum of squares of the residuals to those 100 equations corresponds to the smaller of the two eigenvalues always. Only in the rare case that the matrix A is singular does an exact solution exist, because then one of the eigenvalues of A'*A will be zero.
The eigenvector that we need is the one corresponding to the smaller of the two eigenvalues. Here, it is
format long g
V(:,1)
ans =
-0.92640534467121
0.376527737842269
So we now have TWO relations among the 500 unknowns in the vector X, that
sum(sin(x_i)) = -0.92640534467121
sum(cos(x_i)) = 0.376527737842269
ANY vector of numbers such that these two relationships are true will suffice to minimize the residuals of the 100 equations. The problem is, we have a vector of 500 numbers. We can now pick from among an immense (actually infinite) set of possible vectors, although there are restrictions of course.
A simple trick would be to choose x5,...,x500 to be the numbers:
(0:495)*pi/2
As we can see, I've artfully chosen a set of values for 496 of the 500 unknowns such that the sum of their sines and cosines all reduce to ZERO!
sum(sin((0:495)*pi/2))
ans =
-1.73194791841524e-14
sum(cos((0:495)*pi/2))
ans =
4.76617824764949e-13
So both return zero (to within floating point trash.) The point is, an infinity of solutions exists. Then we are left with finding x1,x2,x3,x4 such that
sin(x1) + sin(x2) + sin(x3) + sin(x4) = -0.92640534467121
cos(x1) + cos(x2) + cos(x3) + cos(x4) = 0.376527737842269
This too is easily enough done, with an infinite number of solutions even there. I won't bother, because it is not that exciting to do, and because it really adds no value at this point.
Perhaps this helps. I'm not sure, but I don't think you can go much further to produce your desired "relation" between the unknowns.
  1 个评论
Spyros Polychronopoulos
编辑:Spyros Polychronopoulos 2017-7-11
Thank you so much for been so detailed! I agree and understand what you said.
If we have different An and Bn as in:
An1*sin(Bn1+x1)+An2*sin(Bn1+x2)...+An500*sin(Bn500+x500) == 0
do you think we could apply this simplification without much error:
(sum(Ani)/500)*(sum(sin(Bni))*sum(cos(x_i)) + sum(cos(Bni))*sum(sin(x_i))) = 0

请先登录,再进行评论。

更多回答(2 个)

Walter Roberson
Walter Roberson 2017-7-10
"I have 500 variables and 100 equations. Could I get a result with the relationships between the variables?"
"I am not after a linear relationship between the values. Could be any relationship that was just an example."
The answer is NO. There are an infinite number of non-linear relationships that can be constructed to exactly fit any finite number of points that are expressed to finite precision. It is not possible to tell which of them is "the" relationship.
If you just need a relationship, then you can construct the equivalent of Lagrange Interpolating Polynomials.
  2 个评论
Spyros Polychronopoulos
编辑:Spyros Polychronopoulos 2017-7-10
I do not think there are infinite number of relationships. You are right there could be more than 1 set of relationships that conform with the given 100 equations but not infinite.

请先登录,再进行评论。


John D'Errico
John D'Errico 2017-7-10
编辑:John D'Errico 2017-7-10
I'm sorry, but this makes no sense at all. Reading through what you have said, you have a system of equations:
fn=An*(sin(Bn+x1)+sin(Bn+x2)...+sin(Bn+x500)) == 0
So you have 100 such equations, in the 500 unknowns x1,...,x500.
Essentially since all of these equations are homogeneous, we can ignore An completely. So you are left with only a set of 100 equations of the form:
sin(Bn+x1)+sin(Bn+x2)...+sin(Bn+x500) == 0
where the Bn are known values.
Now you claim there are only a finite number of solutions to this system? WRONG. Wrong, period. Flat out wrong.
Next, you think that you can find some relationship between the unknowns? Wrong again. Even for only two variables (x1,x2) with one equation, there are infinitely many solutions. But for 500 unknowns and 100 equations, there simply is no way to uncover any simple relationship.
My suggestion is you consider how you might solve a simpler problem. Suppose you have only two equations, with perhaps 4 unknowns.
sin(B1+x1) + sin(B1+x2) + sin(B1+x3) + sin(B1+x4) == 0
sin(B2+x1) + sin(B2+x2) + sin(B2+x3) + sin(B2+x4) == 0
Are there a finite number of solutions? Of course not, since you can add any multiple of 2*pi to all of the unknowns and get as equally valid a solution.
So, perhaps you are thinking of principle solutions, with all the variables living in [0,2*pi). Even here, there is no easily obtained relationship, but you have 500 variables, with 100 equations.
  5 个评论
Spyros Polychronopoulos
Hi Walter and thanks your you answer was really helpful. But if I apply this constrain to the variables [0,2*pi) I think I will be able to get 100 relationships. I know that it is a lot more complicated now that the relationships are not linear but if I use Fourier as you suggested I would get 100 relationships between the variables. I am not looking for 500 variable relationships with only 100 equations!
Walter Roberson
Walter Roberson 2017-7-11
No, when you do a fourier transform of N real values, you get a result of length N, but half of the values are complex conjugates of the other half, so the total amount of usable information becomes "N/2 real components plus N/2 imaginary components" for a total of N pieces of information.
This is just basic information theory. The fourier transform preserves information content.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by