Multiple inputs, multiple outputs; solving when you have simple linear models
up vote
0
down vote
favorite
I am working on a mathematical problem related to a steady state controls problem, and I think this might be the place to ask this. I've figured out some of the simple cases, and am wondering where might the best place to look for a more generic solution, since the real problem involves more inputs (over 50; this is a problem for multiple light sources and sensors, but could be applied to multi-zone heating ovens, for example).
The problem is simplified, since the outputs are linearly dependent on the inputs.
For a single input, and three outputs; say, a single light illuminating 3 sensors:
I've been able to write out the following; the coefficients are based on geometry, and are fixed.
y1=a*x1+b
y2=c*x1+d
y3=e*x1+f
The goal is to have the values y1, y2, and y3 set to some specific outputs (ya, yb, and yc; in our case the same values, but I solved the generic case).
If we create a objective function F=(ya-y1)^2+(yb-y2)^2+(yc-y3)^2, and derive w/r/t x1 and set to zero, I can find a best fit for things:
x1=((a * ya + c * yb + e * yc)-(a * b + c * d + e * f))/(a^2+c^2+e^2)
(For example, for a = 1, b = -3, c = 2, d = -10, e = 5, f = -25, with ya = 10, yb = 11, yc = 12, the objective function (F = 59) is smallest at x1 = 8).
I've checked this result against a spreadsheet solver algorithm, so I think my algebra is correct.
For a 3 input, 3 output problem; say, 3 lights illuminating 3 sensors:
... the equations are:
y1= a0 + a1 * x1 + a2 * x2 + a3 * x3
y2= b0 + b1 * x1 + b2 * x2 + b3 * x3
y3= c0 + c1 * x1 + c2 * x2 + c3 * x3
I actually solved this problem first, but used a spreadsheet solver, where the objective function is still F=(ya-y1)^2+(yb-y2)^2+(yc-y3)^2. Asking the solver to vary y1, y2, and y3, and minimizing F works.
The more general case(s)
Where do I look for solving problems where I've got n inputs, and m outputs, when the relations are linear? Is a spreadsheet solver still going to cut it? It kind of bothers me that it is a bit of black magic which I'm not clear how it solves it.
When inputs are less than outputs (like the first problem), solving algebraically for larger values of n seems unwieldy. I've looked at the two input, 4 output problem, and have tentatively solved it, but you start to turn your paper sideways when deriving for more inputs. This problem has a lot more inputs and outputs (we'll be looking at as many sensors), so unless I'm mistaken, algebra is out.
I'm thinking this is somewhat related to curve fitting of the multiple linear input problem, where you have y = a0 + a1 * x1 + a2 * x2 + a3 * x3 + ..., and are trying to find the coefficients a0, a1, a2 etc, given a bunch of data.
In this case, we know the coefficients, but want to set the outputs, but am not quite sure where to go next. I've used Nelder-Mead (https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method) in the past for solving nonlinear 2D problems; would this be a solution, perhaps? Are there any open-source solvers/libraries in Python that might help here?
systems-of-equations linear-programming
add a comment |
up vote
0
down vote
favorite
I am working on a mathematical problem related to a steady state controls problem, and I think this might be the place to ask this. I've figured out some of the simple cases, and am wondering where might the best place to look for a more generic solution, since the real problem involves more inputs (over 50; this is a problem for multiple light sources and sensors, but could be applied to multi-zone heating ovens, for example).
The problem is simplified, since the outputs are linearly dependent on the inputs.
For a single input, and three outputs; say, a single light illuminating 3 sensors:
I've been able to write out the following; the coefficients are based on geometry, and are fixed.
y1=a*x1+b
y2=c*x1+d
y3=e*x1+f
The goal is to have the values y1, y2, and y3 set to some specific outputs (ya, yb, and yc; in our case the same values, but I solved the generic case).
If we create a objective function F=(ya-y1)^2+(yb-y2)^2+(yc-y3)^2, and derive w/r/t x1 and set to zero, I can find a best fit for things:
x1=((a * ya + c * yb + e * yc)-(a * b + c * d + e * f))/(a^2+c^2+e^2)
(For example, for a = 1, b = -3, c = 2, d = -10, e = 5, f = -25, with ya = 10, yb = 11, yc = 12, the objective function (F = 59) is smallest at x1 = 8).
I've checked this result against a spreadsheet solver algorithm, so I think my algebra is correct.
For a 3 input, 3 output problem; say, 3 lights illuminating 3 sensors:
... the equations are:
y1= a0 + a1 * x1 + a2 * x2 + a3 * x3
y2= b0 + b1 * x1 + b2 * x2 + b3 * x3
y3= c0 + c1 * x1 + c2 * x2 + c3 * x3
I actually solved this problem first, but used a spreadsheet solver, where the objective function is still F=(ya-y1)^2+(yb-y2)^2+(yc-y3)^2. Asking the solver to vary y1, y2, and y3, and minimizing F works.
The more general case(s)
Where do I look for solving problems where I've got n inputs, and m outputs, when the relations are linear? Is a spreadsheet solver still going to cut it? It kind of bothers me that it is a bit of black magic which I'm not clear how it solves it.
When inputs are less than outputs (like the first problem), solving algebraically for larger values of n seems unwieldy. I've looked at the two input, 4 output problem, and have tentatively solved it, but you start to turn your paper sideways when deriving for more inputs. This problem has a lot more inputs and outputs (we'll be looking at as many sensors), so unless I'm mistaken, algebra is out.
I'm thinking this is somewhat related to curve fitting of the multiple linear input problem, where you have y = a0 + a1 * x1 + a2 * x2 + a3 * x3 + ..., and are trying to find the coefficients a0, a1, a2 etc, given a bunch of data.
In this case, we know the coefficients, but want to set the outputs, but am not quite sure where to go next. I've used Nelder-Mead (https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method) in the past for solving nonlinear 2D problems; would this be a solution, perhaps? Are there any open-source solvers/libraries in Python that might help here?
systems-of-equations linear-programming
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am working on a mathematical problem related to a steady state controls problem, and I think this might be the place to ask this. I've figured out some of the simple cases, and am wondering where might the best place to look for a more generic solution, since the real problem involves more inputs (over 50; this is a problem for multiple light sources and sensors, but could be applied to multi-zone heating ovens, for example).
The problem is simplified, since the outputs are linearly dependent on the inputs.
For a single input, and three outputs; say, a single light illuminating 3 sensors:
I've been able to write out the following; the coefficients are based on geometry, and are fixed.
y1=a*x1+b
y2=c*x1+d
y3=e*x1+f
The goal is to have the values y1, y2, and y3 set to some specific outputs (ya, yb, and yc; in our case the same values, but I solved the generic case).
If we create a objective function F=(ya-y1)^2+(yb-y2)^2+(yc-y3)^2, and derive w/r/t x1 and set to zero, I can find a best fit for things:
x1=((a * ya + c * yb + e * yc)-(a * b + c * d + e * f))/(a^2+c^2+e^2)
(For example, for a = 1, b = -3, c = 2, d = -10, e = 5, f = -25, with ya = 10, yb = 11, yc = 12, the objective function (F = 59) is smallest at x1 = 8).
I've checked this result against a spreadsheet solver algorithm, so I think my algebra is correct.
For a 3 input, 3 output problem; say, 3 lights illuminating 3 sensors:
... the equations are:
y1= a0 + a1 * x1 + a2 * x2 + a3 * x3
y2= b0 + b1 * x1 + b2 * x2 + b3 * x3
y3= c0 + c1 * x1 + c2 * x2 + c3 * x3
I actually solved this problem first, but used a spreadsheet solver, where the objective function is still F=(ya-y1)^2+(yb-y2)^2+(yc-y3)^2. Asking the solver to vary y1, y2, and y3, and minimizing F works.
The more general case(s)
Where do I look for solving problems where I've got n inputs, and m outputs, when the relations are linear? Is a spreadsheet solver still going to cut it? It kind of bothers me that it is a bit of black magic which I'm not clear how it solves it.
When inputs are less than outputs (like the first problem), solving algebraically for larger values of n seems unwieldy. I've looked at the two input, 4 output problem, and have tentatively solved it, but you start to turn your paper sideways when deriving for more inputs. This problem has a lot more inputs and outputs (we'll be looking at as many sensors), so unless I'm mistaken, algebra is out.
I'm thinking this is somewhat related to curve fitting of the multiple linear input problem, where you have y = a0 + a1 * x1 + a2 * x2 + a3 * x3 + ..., and are trying to find the coefficients a0, a1, a2 etc, given a bunch of data.
In this case, we know the coefficients, but want to set the outputs, but am not quite sure where to go next. I've used Nelder-Mead (https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method) in the past for solving nonlinear 2D problems; would this be a solution, perhaps? Are there any open-source solvers/libraries in Python that might help here?
systems-of-equations linear-programming
I am working on a mathematical problem related to a steady state controls problem, and I think this might be the place to ask this. I've figured out some of the simple cases, and am wondering where might the best place to look for a more generic solution, since the real problem involves more inputs (over 50; this is a problem for multiple light sources and sensors, but could be applied to multi-zone heating ovens, for example).
The problem is simplified, since the outputs are linearly dependent on the inputs.
For a single input, and three outputs; say, a single light illuminating 3 sensors:
I've been able to write out the following; the coefficients are based on geometry, and are fixed.
y1=a*x1+b
y2=c*x1+d
y3=e*x1+f
The goal is to have the values y1, y2, and y3 set to some specific outputs (ya, yb, and yc; in our case the same values, but I solved the generic case).
If we create a objective function F=(ya-y1)^2+(yb-y2)^2+(yc-y3)^2, and derive w/r/t x1 and set to zero, I can find a best fit for things:
x1=((a * ya + c * yb + e * yc)-(a * b + c * d + e * f))/(a^2+c^2+e^2)
(For example, for a = 1, b = -3, c = 2, d = -10, e = 5, f = -25, with ya = 10, yb = 11, yc = 12, the objective function (F = 59) is smallest at x1 = 8).
I've checked this result against a spreadsheet solver algorithm, so I think my algebra is correct.
For a 3 input, 3 output problem; say, 3 lights illuminating 3 sensors:
... the equations are:
y1= a0 + a1 * x1 + a2 * x2 + a3 * x3
y2= b0 + b1 * x1 + b2 * x2 + b3 * x3
y3= c0 + c1 * x1 + c2 * x2 + c3 * x3
I actually solved this problem first, but used a spreadsheet solver, where the objective function is still F=(ya-y1)^2+(yb-y2)^2+(yc-y3)^2. Asking the solver to vary y1, y2, and y3, and minimizing F works.
The more general case(s)
Where do I look for solving problems where I've got n inputs, and m outputs, when the relations are linear? Is a spreadsheet solver still going to cut it? It kind of bothers me that it is a bit of black magic which I'm not clear how it solves it.
When inputs are less than outputs (like the first problem), solving algebraically for larger values of n seems unwieldy. I've looked at the two input, 4 output problem, and have tentatively solved it, but you start to turn your paper sideways when deriving for more inputs. This problem has a lot more inputs and outputs (we'll be looking at as many sensors), so unless I'm mistaken, algebra is out.
I'm thinking this is somewhat related to curve fitting of the multiple linear input problem, where you have y = a0 + a1 * x1 + a2 * x2 + a3 * x3 + ..., and are trying to find the coefficients a0, a1, a2 etc, given a bunch of data.
In this case, we know the coefficients, but want to set the outputs, but am not quite sure where to go next. I've used Nelder-Mead (https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method) in the past for solving nonlinear 2D problems; would this be a solution, perhaps? Are there any open-source solvers/libraries in Python that might help here?
systems-of-equations linear-programming
systems-of-equations linear-programming
asked Nov 24 at 0:32
asylumax
1011
1011
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
Hint.
As far as I understood, it seems that your problem can be represented as
$$
E(x) = ||A x+b-y_0||
$$
or
$$
E^2(x) = x^t A^t A x +2(b-y_0)A x + ||b-y_0||^2
$$
with minimum at
$$
A^tA x_0+A^t(b-y_0) = 0
$$
with
$$
x_0 = -(A^t A)^{-1}A^t(b-y_0)
$$
Here
$b = (a_0,b_0,cdots, n_0)$ and $y_0 = (y_a, y_b,cdots, y_n)$
The linear modeling can give strange solutions. For example, in case of $x$ associated to light sources the solution can give darkening properties to some sources... ($ x < 0$)
add a comment |
up vote
0
down vote
You might want to try total least squares model based off of your previous success with summing residuals, like you would in the least squares model. Wikipedia has a naive gnu implementation of the algorithm, and with some trial and error you could get it running in pandas if you wanted.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Hint.
As far as I understood, it seems that your problem can be represented as
$$
E(x) = ||A x+b-y_0||
$$
or
$$
E^2(x) = x^t A^t A x +2(b-y_0)A x + ||b-y_0||^2
$$
with minimum at
$$
A^tA x_0+A^t(b-y_0) = 0
$$
with
$$
x_0 = -(A^t A)^{-1}A^t(b-y_0)
$$
Here
$b = (a_0,b_0,cdots, n_0)$ and $y_0 = (y_a, y_b,cdots, y_n)$
The linear modeling can give strange solutions. For example, in case of $x$ associated to light sources the solution can give darkening properties to some sources... ($ x < 0$)
add a comment |
up vote
0
down vote
Hint.
As far as I understood, it seems that your problem can be represented as
$$
E(x) = ||A x+b-y_0||
$$
or
$$
E^2(x) = x^t A^t A x +2(b-y_0)A x + ||b-y_0||^2
$$
with minimum at
$$
A^tA x_0+A^t(b-y_0) = 0
$$
with
$$
x_0 = -(A^t A)^{-1}A^t(b-y_0)
$$
Here
$b = (a_0,b_0,cdots, n_0)$ and $y_0 = (y_a, y_b,cdots, y_n)$
The linear modeling can give strange solutions. For example, in case of $x$ associated to light sources the solution can give darkening properties to some sources... ($ x < 0$)
add a comment |
up vote
0
down vote
up vote
0
down vote
Hint.
As far as I understood, it seems that your problem can be represented as
$$
E(x) = ||A x+b-y_0||
$$
or
$$
E^2(x) = x^t A^t A x +2(b-y_0)A x + ||b-y_0||^2
$$
with minimum at
$$
A^tA x_0+A^t(b-y_0) = 0
$$
with
$$
x_0 = -(A^t A)^{-1}A^t(b-y_0)
$$
Here
$b = (a_0,b_0,cdots, n_0)$ and $y_0 = (y_a, y_b,cdots, y_n)$
The linear modeling can give strange solutions. For example, in case of $x$ associated to light sources the solution can give darkening properties to some sources... ($ x < 0$)
Hint.
As far as I understood, it seems that your problem can be represented as
$$
E(x) = ||A x+b-y_0||
$$
or
$$
E^2(x) = x^t A^t A x +2(b-y_0)A x + ||b-y_0||^2
$$
with minimum at
$$
A^tA x_0+A^t(b-y_0) = 0
$$
with
$$
x_0 = -(A^t A)^{-1}A^t(b-y_0)
$$
Here
$b = (a_0,b_0,cdots, n_0)$ and $y_0 = (y_a, y_b,cdots, y_n)$
The linear modeling can give strange solutions. For example, in case of $x$ associated to light sources the solution can give darkening properties to some sources... ($ x < 0$)
answered Nov 24 at 1:25
Cesareo
7,4303416
7,4303416
add a comment |
add a comment |
up vote
0
down vote
You might want to try total least squares model based off of your previous success with summing residuals, like you would in the least squares model. Wikipedia has a naive gnu implementation of the algorithm, and with some trial and error you could get it running in pandas if you wanted.
add a comment |
up vote
0
down vote
You might want to try total least squares model based off of your previous success with summing residuals, like you would in the least squares model. Wikipedia has a naive gnu implementation of the algorithm, and with some trial and error you could get it running in pandas if you wanted.
add a comment |
up vote
0
down vote
up vote
0
down vote
You might want to try total least squares model based off of your previous success with summing residuals, like you would in the least squares model. Wikipedia has a naive gnu implementation of the algorithm, and with some trial and error you could get it running in pandas if you wanted.
You might want to try total least squares model based off of your previous success with summing residuals, like you would in the least squares model. Wikipedia has a naive gnu implementation of the algorithm, and with some trial and error you could get it running in pandas if you wanted.
answered Nov 24 at 2:46
multicusp
211
211
add a comment |
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3011027%2fmultiple-inputs-multiple-outputs-solving-when-you-have-simple-linear-models%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown