Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

ironfroggy

toughy math with averages

This topic is 6163 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a small problem and I was wondering if anyone can help. it''s a little difficult, So hopefully you like math. I have five known variables: A1, A2, A3, A4, and A5. I have four unkown variables: a,b,c, and d. A1 = (a+b+c+d)/4 so it is the average of all of them A2 = (a+b)/2 A3 = (b+d)/2 A4 = (a+c)/2 A5 = (c+d)/2 So, how can I find a,b,c, and/or d?

Share this post


Link to post
Share on other sites
Advertisement
You will need to know all of the other unknown variables in the equation. for example...

A2 = (a+b)/2
TO FIND a
a = 2(A2)-b
TO FIND b
b = 2(A2)-a
I might be wrong, but it looks right (to me!)

I dont think there is any way to do this without knowing the other other variable in the equation.

for A1 = (a+b+c+d)/4, you would have to do something like this
a = 4(A1)-b-c-d

I hope this is corect, and helps. It is possible that i just answered a question that you did not ask, so if I missunderstood the question, let me know.

Share this post


Link to post
Share on other sites
Ive figured out that much, which is why i posted here.
I am thinking that I would have to use the A''s in pairs or trios. Like to find a maybe do something with A2 and A4?

Or i am thinking maybe since i have A2 and A5 I could use those and then A4 to get it somehow? This should get a and c both if its possible.

Share this post


Link to post
Share on other sites
Use matrices and L-U decomposition.

Say we have a resultant vector y = |A2 A3 A4 A5|, an original vector x = |a b c d| and a coefficient matrix

|1 1 0 0|
A = |0 1 0 1|
|1 0 1 0|
|0 0 1 1|


such that y = Ax, then A can be decomposed into lower and upper matrices L and U:

|1 0 0 0 | |U11 U12 U13 U14|
L = |L21 1 0 0 | , U = |0 U22 U23 U24|
|L31 L32 1 0 | |0 0 U33 U34|
|L41 L42 L43 1 | |0 0 0 U44|


such that A = LU. A can be shown to be given as
A(i,j) = S(k=1,j){L(i,k)U(k,j)}. Solving for the important terms (A(1,1), A(1,2), A(2,2), A(2,4), A(3,1), A(3,3), A(4,3), A(4,4)), we obtain the matrices

|1 0 0 0| |1 1 0 0|
L = |0 1 0 0| , U = |0 1 0 1|
|1 0 1 0| |0 0 1 0|
|0 0 0 1| |0 0 0 1|

(I may have made an error, so please validate this result by multiplication). We now obtain

|A2| |1 0 0 0| |1 1 0 0| |a|
|A3| = |0 1 0 0| * |0 1 0 1| * |b|
|A4| |1 0 1 0| |0 0 1 0| |c|
|A5| |0 0 0 1| |0 0 0 1| |d|

or |y| = |L| * |U| * |x|
The solution can now be achieved using y = L(Ux) by letting Ux = z, y = Lz and solving for z. Then solve for x in Ux = z.


Edited by - Oluseyi on June 30, 2001 9:51:21 PM

Share this post


Link to post
Share on other sites
okay, everyone watch me try to work this out :^)


the vector [[ a1 ] [ a2 ] [ a3 ] [ a4 ] [ a5 ]] = [T]* [[ a ] [ b ] [ c ] [ d ]]

...with T = [[1/4 1/4 1/4 1/4]
[1/2 1/2 0 0 ]
[ 0 1/2 0 1/2]
[1/2 0 1/2 0 ]
[ 0 0 1/2 1/2]


If there is a way to reverse the calculations and find out what the source vector was from the transformed vector, T has to be inverted, which means it must be square. We'll just drop the first row (A1) and use that as the new matrix T.
Calculating det(t), we find that it is = 0. This is because the rows can be added such that they become multiples of each other, even if we left the first row in... and you can't invert a matrix whose determinate is zero.

What you ask cannot be done without knowing at least one of the variables. End of story. End of Linear Algebra proof.

...and I'm moderately sure that the above post is wrong... at any rate, one of us has to be, and I'd love a third opinion stating who it is... anyone a math prof?

--Tr][aD--

Edited by - TrIaD on June 30, 2001 10:05:57 PM

Share this post


Link to post
Share on other sites
I agree with TrIaD. Let me do it the long way...

Althought it -seems- like you have 5 equations and only 4 unknowns, since the equations are not linearly independent, there is no way to find a unique solution.

This is easily proved by guassian elimination: Take the matrix equation (forgive my crappy matrix drawing):

|1 1 1 1||a| = |2*A1|
|1 1 0 0||b| = |2*A2|
|1 0 1 0||c| = |2*A4|
|0 1 0 1||d| = |2*A3|
|0 0 1 1||-| = |2*A5|

To do guassian elimination we change that into the augmented matrix:

|1 1 1 1 || 2*A1|
|1 1 0 0 || 2*A2|
|1 0 1 0 || 2*A4|
|0 1 0 1 || 2*A3|
|0 0 1 1 || 2*A5|

Which reduces to:

|01 01 01 01 || 2*A1|
|00 00 -1 -1 || 2*A2 - 2*A1|
|00 -1 00 -1 || 2*A4 - 2*A1|
|00 01 00 01 || 2*A3|
|00 00 01 01 || 2*A5|

-->

|01 01 01 01 || 2*A1|
|00 00 -1 -1 || 2*A2 - 2*A1|
|00 -1 00 -1 || 2*A4 - 2*A1|
|00 00 00 00 || 2*A3 + 2*A4 - 2*A1|
|00 00 00 00 || 2*A5 + 2*A2 - 2*A1|

As you can see, this gives the l.i. equations:

a + b + c + d = A1
c + d = A1 - A2
b + d = A1 - A4

Which, since there are four unknowns and only three equations, has infinitely many solutions.

What you CAN say, however, is that unless (2*A3 + 2*A4 - 2A1 = 0), and (2*A5 + 2*A2 - 2*A1 = 0), the system is inconsistant and there are no solutions; but that's pretty obvious anyway.

If you want to find any particular solution, let's just say, let d be some arbitrary variable x. Then the solution for any particular x would be:

d = x
b = 2*A1 - 2*A4 - x
c = 2*A1 - 2*A2 - x
a = -2*A1 + 2*A2 + 2*A4 + x

Hope that helps.

Edited by - Shadow Mint on June 30, 2001 10:11:17 PM

Edited by - Shadow Mint on June 30, 2001 10:13:55 PM

Share this post


Link to post
Share on other sites
quote:
Original post by TrIaD
...and I''m moderately sure that the above post is wrong... at any rate, one of us has to be, and I''d love a third opinion stating who it is... anyone a math prof?



Actually, I''m moderately sure myself. Logic seems to dictate that you do need to know at least one of the unknowns, but I''m too lazy to work it all out and verify it. Plus, I may have fumbled on the decomposition. In any case, someone will come along and provide the solution (or definitive proof of a lack of one) in a flash of brilliance.

Share this post


Link to post
Share on other sites
Thanks for all the help you peoples, but sadly I have proved it impossible. A real shame too. If this would have worked, I could have compressed any data at a constant ratio based on data size. Larger the data, better compression is. But, it would only work if I could store just THREE of the averages and find the original values then. You can get the other two from them then easily. O well.

Share this post


Link to post
Share on other sites
you can figure it out
and it isnt that hard
look here
A2 = (a+b)/2
can be rewritten as
a = (2*A2)-b
then you have
A4 = (a+c)/2
can be rewritten as
a = (2*A4)-c

so you can then set the two a equations equal to each other
so that
(2*A2)-b = (2*A4)-c
if you know A2 and A4 then you can get b and c
you can use the same method for the other variables

"I pity the fool, thug, or soul who tries to take over the world, then goes home crying to his momma."
- Mr. T

Share this post


Link to post
Share on other sites
quote:
Original post by ncsu121978
so you can then set the two a equations equal to each other
so that
(2*A2)-b = (2*A4)-c
if you know A2 and A4 then you can get b and c
you can use the same method for the other variables



Substitute any two values you like for A2 and A4 and see what you get. (2*A2) and (2*A4) will be constants, so 10 and 8 are as good choices as any. Given
10 - b = 8 - c, what are b and c?

Not as easy as you thought, eh? There''s no answer.

quote:
"I pity the fool, thug, or soul who tries to take over the world, then goes home crying to his momma."
- Mr. T


Aye. Me too.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!