0
$\begingroup$

Let's say I have

$an_1+bn_2+cn_3=n_T$

$ap_1+bp_2+cp_3=p_T$

$ak_1+bk_2+ck_3=k_T$

where $a,b,c \geqslant 0$

What's the best way to find solutions for a, b and c so that the results of the sums are as close as possible to the terms on the right-hand side? My method has been a brute-force search but maybe there's a better way. I tagged this with 'matrices' because I didn't know what else to tag it with.

I've also thought about trying to find the variance of the variances to determine a best fit.

  • 0
    So the $n_i$, $p_i$ and $k_i$ are given? What do you mean by "the results of the sums are as close as possible to the terms on the right-hand sides"?2012-03-09

1 Answers 1

1

First, rewrite the system as $Ax = d$: $ \begin{pmatrix} n_1 & n_2 & n_3 \\ p_1 & p_2 & p_3 \\ k_1 & k_2 & k_3 \end{pmatrix} \begin{pmatrix} a \\ b \\ c \end{pmatrix} = \begin{pmatrix} n_T \\ p_T \\ k_T \end{pmatrix} $ If $A$ is non-singular, i.e. $\operatorname{det}(A) \neq 0$, and $d \neq 0$, then the system has one solution, namely $ x = A^{-1} d,$ which might violate the condition $a,b,c \geqslant 0.$

However, if $\operatorname{det}(A) = 0$, then you are looking for a vector $x$ in the nullspace of $A$. You will have to find the nullspace basis of $A$: $\{ B_1, \ldots, B_{3-r} \}$, where $r = {\rm rank}(A)$. and form a vector $x = \sum B_i$ s.t. $x$ satisfies the conditions.

  • 0
    Thanks, I can learn from that. However, for a solution to my problem I took an easy way out and wrote a genetic algorithm to find my solution. Worked!2012-03-24