Getting as close as possible to a solution (system of equations)?

In summary, the conversation discusses a set of equations with known positive constants and a goal to minimize the sum of the absolute values of the resulting y values. A possible procedure is suggested for finding the values of x that will achieve this goal, but it may require multiple calculations and the conversation ends with consideration of using a formula similar to least squares.
  • #1
tjosan
33
2
Hi,

I have a set of equations that look like this:

y1 = k1*x1 + k2*x2 - A1 = 0
y2 = k3*x1 + k4*x3 - A2 = 0
y3 = k5*x2 + k6*x4 - A3 = 0
y4 = k7*x3 - A4 = 0
y5 = k8*x4 - A5 = 0

k1 to k8 are known positive constants. A1 to A5 are known positive constants (I will use different values for A1 to A5 depending on the cirumstances).

Assuming this system does not have any solution, how do I calculate the values of x1 to x4 such that y1 to y5 come as close to 0 as possible? All constants must be positive.
 
Physics news on Phys.org
  • #2
tjosan said:
Hi,

I have a set of equations that look like this:

y1 = k1*x1 + k2*x2 - A1 = 0
y2 = k3*x1 + k4*x3 - A2 = 0
y3 = k5*x2 + k6*x4 - A3 = 0
y4 = k7*x3 - A4 = 0
y5 = k8*x4 - A5 = 0

k1 to k8 are known positive constants. A1 to A5 are known positive constants (I will use different values for A1 to A5 depending on the cirumstances).

Assuming this system does not have any solution, how do I calculate the values of x1 to x4 such that y1 to y5 come as close to 0 as possible? All constants must be positive.
Apparently you are looking to minimize (abs(y1)+abs(y2)+abs(y3)+abs(y4)+abs(y5)). This is in contrast to least squares best fit where you would look to minimize (Y1^2+Y2^2+Y3^2+Y4^2+Y5^2).

The way you are doing it, the exact formula must take into consideration which k's are greater than which other k's.
But here is a loose procedure.

1) Solve for x3 and x4 using y4 and y5
2) Solve for x1 and x2 using y2 and y3, but keep x1 and x2 non-negative.
3) Evaluate all Y's
4) For each X, evaluate the changes to Sum(Y's) when X is increased and, for non-zero X, when X is decreased. So you have as many as 8 cases. In each case, the change to Sum(Y's) will be a sum or difference of some of the k's.
5) If none of these creates a net advantage, you are done.
6) Pick the X change that creates the fastest improvement, and apply that change to X until X reaches 0 or one of the Y's reaches 0.
7) Go back to step 3. This loop only ends in step 5.
 
  • Like
Likes tjosan
  • #3
Thank you I will try it out!

The constants are in this order:
k5>k6>k3>k8>k4>k2>k1>k7
 
  • #4
.Scott said:
Apparently you are looking to minimize (abs(y1)+abs(y2)+abs(y3)+abs(y4)+abs(y5)). This is in contrast to least squares best fit where you would look to minimize (Y1^2+Y2^2+Y3^2+Y4^2+Y5^2).

The way you are doing it, the exact formula must take into consideration which k's are greater than which other k's.
But here is a loose procedure.

1) Solve for x3 and x4 using y4 and y5
2) Solve for x1 and x2 using y2 and y3, but keep x1 and x2 non-negative.
3) Evaluate all Y's
4) For each X, evaluate the changes to Sum(Y's) when X is increased and, for non-zero X, when X is decreased. So you have as many as 8 cases. In each case, the change to Sum(Y's) will be a sum or difference of some of the k's.
5) If none of these creates a net advantage, you are done.
6) Pick the X change that creates the fastest improvement, and apply that change to X until X reaches 0 or one of the Y's reaches 0.
7) Go back to step 3. This loop only ends in step 5.

So I ended up going with least squares instead becase it was much easier (just manipulating matrices in excel). But I wonder if there is any formula for minimizing (abs(y1)+abs(y2)+abs(y3)+abs(y4)+abs(y5))? Is there any matrix operations similar to that of the least squares method?
 
  • #5
I found the formula: A^-1*b. But I need to omit one row (thus make 5 different calculations and pick the best).
 

1. What is the first step in getting as close as possible to a solution for a system of equations?

The first step is to identify the variables and their relationships in the system of equations. This will help determine the most appropriate method for solving the system.

2. How do I know if a solution to the system of equations is possible?

A solution is possible if the system of equations has the same number of equations as variables, and the equations are not all dependent or contradictory. This can be determined by checking the coefficients of the variables in each equation and looking for patterns.

3. What are some common methods for solving a system of equations?

Some common methods include substitution, elimination, and graphing. Each method has its own advantages and disadvantages, and the best method to use will depend on the specific system of equations.

4. How many solutions can a system of equations have?

A system of equations can have one unique solution, no solution, or infinitely many solutions. The number of solutions is determined by the relationships between the variables and the equations in the system.

5. What should I do if I am unable to find a solution to a system of equations?

If you are unable to find a solution, double check your work and make sure there are no errors. If the system is unsolvable, it is possible that there is a mistake in the original problem or that the equations are contradictory. You may also consider using a different method or seeking assistance from a teacher or tutor.

Similar threads

Replies
10
Views
281
Replies
5
Views
365
  • Engineering and Comp Sci Homework Help
Replies
14
Views
2K
  • Linear and Abstract Algebra
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
126
  • Linear and Abstract Algebra
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Linear and Abstract Algebra
Replies
6
Views
2K
  • Programming and Computer Science
Replies
15
Views
2K
  • Introductory Physics Homework Help
Replies
19
Views
2K
Back
Top