## The Design of Software (CLOSED)A public forum for discussing the design of software, from the user interface to the code architecture. Now closed. |
||

The "Design of Software" discussion group has been merged with the main
Joel on Software discussion group.
The archives will remain online indefinitely. |
sorry about the formatting.
take these numbers... Cost; Age; Cost * Age x; 6; 8,025; 20; 160,500 346,950; 47; 16,306,650 279,252; 58; 16,196,616 387,640; 69.2; 26,824,688 84,500; 80; 6,760,000 Totals 1,106,367; 59.9; 66,248,454 the task is to find x which brings the total Age (59.9) down to 40. now, the total cost number (1,106,367) can not change. meaning, x must be subtracted out starting from the bottom. so, if x is 80,000, 84,500 is reduced to 4,500 and Cost * Age becomes 360,000. the idea is bring total Cost * Age down to 44,254,680 (1,106,467 * 40). i just can not for the life of me figure out how to calculate x. can anyone help? thanks
math dummy Thursday, May 26, 2005
Now if what you say is true that "x must be subtracted starting from the bottom", your number is ~304622. There isn't a whole number solution.
On a different note, damn that was the hardest question I've ever read in my life. Do you work in product management? The way the "Totals" column, weren't actually totals for age, and you made it seem like age was a constant even though it wasn't in the problem. Man. Anyway, I think that is right.
i didn't do a good job of explaining. your answer is close, but unfortuntely, not close enough.
Cost; Age; Cost * Age 1) x; 6; 6x 2) 8,025; 20; 160,500 3) 346,950; 47; 16,306,650 4) 279,252; 58; 16,196,616 5) 387,640; 69.2; 26,824,688 6) 84,500; 80; 6,760,000 Totals 1,106,367; 59.9; 66,248,454 the total age, which should called average age, (59.9) is the total of cost * age (66,248,454) divided by the total of cost (1,106,367). total cost and total cost * age are just sums. x must be subtracted from cost starting with line 6 and working up until the total remains the same (1,106,367). so, if x is 100,000, cost on line 6 becomes 0 and cost on line 5 becomes 372,140. which leads to total cost * age of 59,015,854 and total/average age of 53.3. so, i can't figure out how to calculate x without making a good guess and trying values from there. is this something that lends itself to newton's method?
math dummy Thursday, May 26, 2005
to me, this translates to something like
f(a,b,c,..,n) = K with 'n' variables that can be adjusted to arrive at the final value. so - yes, the way to arrive at that would be to change values of each variable and "fit" them.. newton-raphson I think (don't remember now). You might find it simple to use a perl script or something to simulate this. Thursday, May 26, 2005
First, you take away all of the age 80 group and see that it isn't going to cut it.
Next, I guessed that the next group might have enough cost so I assumed that as high as I would need to go. So with all of the 80's gone, turned into 6's, my big total is at, 59,995,454. I still need 59,995,454-44,254,680 = 15,740,774 less. So for every 1 item (I looked at it as "Cost" being "Number of items" - I can visualize it that way) I change from a 69.2 into a 6, my total goes down 63.2. Do some math (15,740,774 / 63.2) and you get 249,062 and change. Round up and add the 84,500 that used to be 80's and you get 333,563.
That's phrased really awfully, but it looks like it boils down to a simple linear equation, or at worst a set of them. Identify the information you have about your unknowns, write out the equations, and solve them. Piece of piss.
Matt Thursday, May 26, 2005
Doh, I didn't read it properly.
Still, writing it out as an equation, or a set of equations, is the first step.
Matt Thursday, May 26, 2005
OK, so it does look linear, but with lots of special cases for the borderlines between the different amounts you might have to subtract bits of x from. Essentially a bunch of piece-wise linear equations. You could solve it formally but it'd be fiddly and tedious. If you have maple or mathematica plug them into that, or just solve it with one of the solvers in a spreadsheet.
If you need a general solution then perhaps might be worth trying to formalise it. Maple could give you a big ugly formula that'd solve the general problem, I'm sure.
Matt Thursday, May 26, 2005 |

Powered by FogBugz