# Thread: Disperse value proportionately (x = a*3+b*0.02+c*0.5)

1. ## Disperse value proportionately (x = a*3+b*0.02+c*0.5)

An example equation:
x = a*3+b*0.02+c*0.5

I need to change the value of x by some number "s".
This means I need to change the value of a, b, and c so that when added up, new x is now x + s.

The obvious solution to this would be:
new a = a + s * a / x
new b = b + s * b / x
new c = c + s * c / x

new x results in the correct amount, equal to x + s.
However, I need to be able to take into account the product of each variable and the constant it's being multiplied by.
I need to increase each variable depending on that product's percentage of the total value of x.

If we simply do:
new a = a + s * a * 3 / x
new b = b + s * b * 0.02 / x
new c = c + s * c * 0.5 / x

Unlike in the previous example solution, this results in the sum of the change applied to a, b and c being equal to s. So that (new a + new b + new c = x + s), however, that is not desired either, because the equation that needs to equal x + s has constants which will be multiplied by these variables, producing a different total.

EDIT:
I need two things:
1. (∆a : ∆b : ∆c) to be proportionate to (a*u : b*v : c*w)

2. (a+∆a)*u + (b+∆b)*v + (c+∆c)*w = x+∆x
I've been struggling with this for days. I'm sure I'm missing something obvious.
My only hope is the math geniuses here.

If it helps, every example equation will follow the pattern of x = a*b+c*d+e*f+g*h.. etc.
If there's any information necessary to solve this missing from what I've provided, I may have it available. Please do ask.

EDIT: I realize this post might have been unclear for a lot of people.

2. If I understand you correctly, you want to increase $a$, $b$ and $c$ in the proportion $(3a:0.02b:0.5d)$ so that $x$ becomes $x+s$.

If we write $\Delta a$, $\Delta b$, $\Delta c$, and $\Delta x$ for the increases in $a$, $b$, $c$, and $x$, we must have:

$3\Delta a + 0.02\Delta b + 0.5\Delta c = \Delta x = s$

to ensure that $x$ becomes $x + s$.

The required proportion is:

$\displaystyle\frac{\Delta a}{3a} = \frac{\Delta b}{0.02b} = \frac{\Delta c}{0.5c}$

Define new variables $u=3\Delta a$, $v=0.02\Delta b$, and $w = 0.5\Delta c$. The equations become:

$u+v+w = s$

$\displaystyle\frac{u}{9a} = \frac{v}{0.0004b} = \frac{w}{0.25c}$

And this is a normal proportion problem. You will have:

$u = \dfrac{9as}{9a + 0.0004b + 0.25c}$

$\Delta a = \dfrac{u}{3}$

and a similar result for $\Delta b$ and $\Delta c$.

3. It isn't quite clear what your goal is. You say you want the increases to be proportional; but then you say they should depend [in an unspecified way] on that product's percentage of the total value of x.

If proportional means that each of a, b, and c should increase by the same percentage, then your 'obvious solution' is indeed the obvious solution; and I think that's what Denis is doing.

What barrick is doing is based on an assumption that you want each increase to be proportional, not to the value of a, b, or c itself, but to the product with its corresponding multiplier (that is, to its total contribution to x). This is correct if you meant exactly what you said, with "depending" taken as "proportional".

It may help if you tell us something about your application, so we can be sure what you really need. Things like this are hard to talk about in the abstract. Once we are sure, we can probably explain more succinctly what to do.

4. Hey @barrick, I'm having a little trouble understanding your example...
I'm sure I'm again, missing something obvious, but I tried simplifying your proposed solution down to:

t = a*3*3 + b*0.02*0.02 + c*0.5*0.5
Δa = a + s / t / 3
Δb = b + s / t / 0.02
Δc
= c + s / t / 0.5

However, I'm getting some wonky answers.
Δx ≠ s

Originally Posted by Denis
Change to : x = a*3 + b*2 + c*5
d=3, e=2, f=5 ; equation is now: x = da + eb + fc

Make a=10, b=6, c=4: so x = 3*10+2*6+5*4 = 62

x + k = d(a+u) + e(b+v) + f(c+w)

To remain with same proportions:
u = ak/x, v = bk/x, w = ck/x

Using above equation and adding 31 (k=31):
x + 31 = d(a+u) + e(b+v) + f(c+w)

u = ak/x = 10*31/62 = 5
v = bk/x = 6*31/62 = 3
w = ck/x = 4*31/62 = 2

62+31 = 3(10+5) + 2(6+3) + 5(4+2)
93 = 93

Used above example to end up with integer solution.
Most cases will not end up with integers, of course.

Just remember that this is what's important:
To remain with same proportions:
u = ak/x, v = bk/x, w = ck/x
Thanks Denis, however, the solution you've described is the exact solution I first mentioned in my original post. Which is of an undesired proportion.

I need (∆a : ∆b : ∆c) to be proportionate to (a*u : b*v : c*w)

Apologies for being too incompetent to clarify that in my first post.
I also need for:

If x = a*u + b*v + c*w
(a+∆a)*u + (b+∆b)*v + (c+∆c)*w = x + s

Thank you both for your help so far.

5. Originally Posted by Dr.Peterson
It isn't quite clear what your goal is. You say you want the increases to be proportional; but then you say they should depend [in an unspecified way] on that product's percentage of the total value of x.

If proportional means that each of a, b, and c should increase by the same percentage, then your 'obvious solution' is indeed the obvious solution; and I think that's what Denis is doing.

What barrick is doing is based on an assumption that you want each increase to be proportional, not to the value of a, b, or c itself, but to the product with its corresponding multiplier (that is, to its total contribution to x). This is correct if you meant exactly what you said, with "depending" taken as "proportional".

It may help if you tell us something about your application, so we can be sure what you really need. Things like this are hard to talk about in the abstract. Once we are sure, we can probably explain more succinctly what to do.
Apologies. I've always pushed myself into areas I specifically struggled in, as opposed to areas where I thrive. This being one of those areas, I'm not surprised I failed at conveying what I need in my first post.

I did correct myself in my previous post though, directly after yours:

I need two things:
1. (∆a : ∆b : ∆c) to be proportionate to (a*u : b*v : c*w)

2. (a+∆a)*u + (b+∆b)*v + (c+∆c)*w = x+∆x

6. Originally Posted by justis
An example equation:
x = a*3+b*0.02+c*0.5

I need to change the value of x by some number "s".
This means I need to change the value of a, b, and c so that when added up, new x is now x + s.

The obvious solution to this would be:
new a = a + s * a / x
new b = b + s * b / x
new c = c + s * c / x

new x results in the correct amount, equal to x + s.
However, I need to be able to take into account the product of each variable and the constant it's being multiplied by.
I need to increase each variable depending on that product's percentage of the total value of x.

If we simply do:
new a = a + s * a * 3 / x
new b = b + s * b * 0.02 / x
new c = c + s * c * 0.5 / x

Unlike in the previous example solution, this results in the sum of the change applied to a, b and c being equal to s. So that (new a + new b + new c = x + s), however, that is not desired either, because the equation that needs to equal x + s has constants which will be multiplied by these variables, producing a different total.

I've been struggling with this for days. I'm sure I'm missing something obvious.
My only hope is the math geniuses here.

If it helps, every example equation will follow the pattern of x = a*b+c*d+e*f+g*h.. etc.
If there's any information necessary to solve this missing from what I've provided, I may have it available. Please do ask.
You posted this to "Arithmetic", yet you're using variables, ratios and proportions, and algebraic equations. So what is your actual level of study? What subject generated this homework exercise?

7. Originally Posted by Dr.Peterson
It isn't quite clear what your goal is. You say you want the increases to be proportional; but then you say they should depend [in an unspecified way] on that product's percentage of the total value of x.

If proportional means that each of a, b, and c should increase by the same percentage, then your 'obvious solution' is indeed the obvious solution; and I think that's what Denis is doing.

What barrick is doing is based on an assumption that you want each increase to be proportional, not to the value of a, b, or c itself, but to the product with its corresponding multiplier (that is, to its total contribution to x). This is correct if you meant exactly what you said, with "depending" taken as "proportional".

It may help if you tell us something about your application, so we can be sure what you really need. Things like this are hard to talk about in the abstract. Once we are sure, we can probably explain more succinctly what to do.

I doubt knowing my application will help, however, I've got a collection of price objects in this program I'm making, each price object contains a map of price objects used to calculate the total price of the item as well as the amount of those individual prices used in the calculation (the constants).
This is done through the example expression I first provided.
When I want to change the price of x, I need to iterate through all of its depending price objects and apply the change to them so that when the total price is calculated up again, it will be x + the change.
I'm currently achieving this by means of the first solution I gave, and the one Denis suggested. However, consider this:
The worth of price x = a*1000 + b*0.1
Where a = 0.04 and b = 100
Price of x = 40 + 10 = 50

With the solution I'm currently using, and the one denis suggested:
Let's assume we want x to change by +10.
∆a = 0.04 * 10 / 50 = 0.008
∆b = 100 * 10 / 50 = 20
x + ∆x = (0.04+0.008)*1000 + (100+20)*0.1 = 48 + 12 = 60

We get the correct new price of the total x.
However, look at the resulting dependencies.
a initially accounted for 80% of x's worth, while b only accounted for 20%.
Yet the price of b increased by 20 while the price of a only increased by 0.008.
This change is not proportionate to their actual weight in the price of x.

If a price x is only minisculely dependent on the price of b, the change in price x should only minisculely affect the price of b.
Inversely, if the price of x is majorly dependent on the price of a, the change in price x should majorly affect the price of a.

Hence the proportions I need fulfilled while maintaining the correct ∆x.

Originally Posted by stapel
You posted this to "Arithmetic", yet you're using variables, ratios and proportions, and algebraic equations. So what is your actual level of study? What subject generated this homework exercise?

I wasn't sure where to post this, as I'm unfamiliar with the exact level of math I'm attempting to work with. Labeling it was difficult.
I'm just a highschool graduate. Not currently attending college. This isn't homework, it's a personal project I've spent the last year on.

8. Originally Posted by justis
I doubt knowing my application will help, however, I've got a collection of price objects in this program I'm making, each price object contains a map of price objects used to calculate the total price of the item as well as the amount of those individual prices used in the calculation (the constants).
This is done through the example expression I first provided.
When I want to change the price of x, I need to iterate through all of its depending price objects and apply the change to them so that when the total price is calculated up again, it will be x + the change.
I'm currently achieving this by means of the first solution I gave, and the one Denis suggested. However, consider this:
The worth of price x = a*1000 + b*0.1
Where a = 0.04 and b = 100
Price of x = 40 + 10 = 50

With the solution I'm currently using, and the one denis suggested:
Let's assume we want x to change by +10.
∆a = 0.04 * 10 / 50 = 0.008
∆b = 100 * 10 / 50 = 20
x + ∆x = (0.04+0.008)*1000 + (100+20)*0.1 = 48 + 12 = 60

We get the correct new price of the total x.
However, look at the resulting dependencies.
a initially accounted for 80% of x's worth, while b only accounted for 20%.
Yet the price of b increased by 20 while the price of a only increased by 0.008.
This change is not proportionate to their actual weight in the price of x.

If a price x is only minisculely dependent on the price of b, the change in price x should only minisculely affect the price of b.
Inversely, if the price of x is majorly dependent on the price of a, the change in price x should majorly affect the price of a.

Hence the proportions I need fulfilled while maintaining the correct ∆x.
The reason I asked for the application was to figure out what you really need things to be proportional to. That still isn't quite clear, because you've focused more on the programming than on the application of the program.

You say each "price object" contains "price objects". It sounds as if each top-level object represents some number n of items of the same kind, each with a given price p, giving a total value of np; and the total value of all these collections is the sum of np for each kind of item, which we can write in summation notation as $x=\sum_i n_i p_i$. Since it appears that both n and p can be decimals, I'll suppose that n is not really a number of items, but a quantity (number of shares with partial shares allowed?).

Now you want to change all the individual prices ($p_i$) in a consistent way. I don't see why it would be inappropriate to just multiply all the prices by the same amount you want to multiply x by, namely $\dfrac{x+\Delta x}{x}$. I think this is effectively what Denis suggested.

You say that you want the change in the price of each kind of item (?) to be proportional to the total cost of those items, so that the total investment (?) still has the same proportion, like rebalancing a portfolio (except that there you would be changing the quantities rather than prices. Is it something like that?

The more you tell us, the better we can understand; it will make this a lot easier for us!

I wasn't sure where to post this, as I'm unfamiliar with the exact level of math I'm attempting to work with. Labeling it was difficult.
I'm just a highschool graduate. Not currently attending college. This isn't homework, it's a personal project I've spent the last year on.
Clearly it is well beyond arithmetic, though I can see that you saw it as just a matter of proportion, and it may end up being that. But it may be that Barrick's answer was what you want; we can clarify that once we are sure of the problem.

9. Originally Posted by justis
Hey @barrick, I'm having a little trouble understanding your example...
I'm sure I'm again, missing something obvious, but I tried simplifying your proposed solution down to:

t = a*3*3 + b*0.02*0.02 + c*0.5*0.5
Δa = a + s / t / 3
Δb = b + s / t / 0.02
Δc
= c + s / t / 0.5

However, I'm getting some wonky answers.
Δx ≠ s
Hi justis,

I made a mistake in the next to last equation: the numerator of $u$ should be $9as$ instead of $s$
(otherwise you would have $u=v=w$). I have corrected my initial post.

To be precise, the equations are:

\begin{align*} u &= \frac{9as}{9a + 0.0004b + 0.25c}\\ v &= \frac{0.0004bs}{9a + 0.0004b + 0.25c}\\ w &= \frac{0.25cs}{9a + 0.0004b + 0.25c} \end{align*}

Sorry for that...

10. Originally Posted by Dr.Peterson
The reason I asked for the application was to figure out what you really need things to be proportional to. That still isn't quite clear, because you've focused more on the programming than on the application of the program.

You say each "price object" contains "price objects". It sounds as if each top-level object represents some number n of items of the same kind, each with a given price p, giving a total value of np; and the total value of all these collections is the sum of np for each kind of item, which we can write in summation notation as $x=\sum_i n_i p_i$. Since it appears that both n and p can be decimals, I'll suppose that n is not really a number of items, but a quantity (number of shares with partial shares allowed?).

Now you want to change all the individual prices ($p_i$) in a consistent way. I don't see why it would be inappropriate to just multiply all the prices by the same amount you want to multiply x by, namely $\dfrac{x+\Delta x}{x}$. I think this is effectively what Denis suggested.

You say that you want the change in the price of each kind of item (?) to be proportional to the total cost of those items, so that the total investment (?) still has the same proportion, like rebalancing a portfolio (except that there you would be changing the quantities rather than prices. Is it something like that?

The more you tell us, the better we can understand; it will make this a lot easier for us!

Clearly it is well beyond arithmetic, though I can see that you saw it as just a matter of proportion, and it may end up being that. But it may be that Barrick's answer was what you want; we can clarify that once we are sure of the problem.
Barrick's answer was exactly what I needed.
However, if you're still interested in the application... My private messages are always open. Having worked on this for almost a year and a half now, I don't mind ranting. XP
I just imagine that, judging by the usual results of my attempting to explain something, if I respond with more details here, only more questions will arise, and I'd hate to continue a conversation in this thread and mislead future readers into thinking I am still in need of help.
Thank you for putting your time and effort into trying to understand my problem and help me through it.

Originally Posted by barrick
Hi justis,

I made a mistake in the next to last equation: the numerator of $u$ should be $9as$ instead of $s$
(otherwise you would have $u=v=w$). I have corrected my initial post.

To be precise, the equations are:

\begin{align*} u &= \frac{9as}{9a + 0.0004b + 0.25c}\\ v &= \frac{0.0004bs}{9a + 0.0004b + 0.25c}\\ w &= \frac{0.25cs}{9a + 0.0004b + 0.25c} \end{align*}

Sorry for that...
Sorry??? You just solved something that might have taken me months to solve on my own.
This is exactly what I needed, and I think I might actually cry, because I'm finally getting perfect numbers. Yep, I feel the tears coming.
Thank you. This project is really important to me, stressing me out, and finally being able to move on past this roadblock knowing all is well in the world... The relief is overwhelming.
Thank you.