Page 1 of 2 12 LastLast
Results 1 to 10 of 12

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

  1. #1
    New Member
    Join Date
    Nov 2017
    Posts
    11

    Arrow 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.
    Please do read down where I further clarify in conversation.
    Last edited by justis; 11-26-2017 at 06:30 AM.

  2. #2
    New Member
    Join Date
    Nov 2017
    Location
    Brussels, Belgium
    Posts
    15
    If I understand you correctly, you want to increase [tex]a[/tex], [tex]b[/tex] and [tex]c[/tex] in the proportion [tex](3a:0.02b:0.5d)[/tex] so that [tex]x[/tex] becomes [tex]x+s[/tex].

    If we write [tex]\Delta a[/tex], [tex]\Delta b[/tex], [tex]\Delta c[/tex], and [tex]\Delta x[/tex] for the increases in [tex]a[/tex], [tex]b[/tex], [tex]c[/tex], and [tex]x[/tex], we must have:

    [tex]3\Delta a + 0.02\Delta b + 0.5\Delta c = \Delta x = s[/tex]

    to ensure that [tex]x[/tex] becomes [tex]x + s[/tex].

    The required proportion is:

    [tex]\displaystyle\frac{\Delta a}{3a} = \frac{\Delta b}{0.02b} = \frac{\Delta c}{0.5c}[/tex]

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

    [tex]u+v+w = s[/tex]

    [tex]\displaystyle\frac{u}{9a} = \frac{v}{0.0004b} = \frac{w}{0.25c}[/tex]

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

    [tex]u = \dfrac{9as}{9a + 0.0004b + 0.25c}[/tex]

    [tex]\Delta a = \dfrac{u}{3}[/tex]

    and a similar result for [tex]\Delta b[/tex] and [tex]\Delta c[/tex].
    Last edited by barrick; 11-26-2017 at 03:08 AM. Reason: Correction

  3. #3
    Elite Member
    Join Date
    Feb 2004
    Location
    Ottawa, Ontario
    Posts
    16,645
    Say we use this equation (easier to play with!):
    x = 3a + 2b + 5c

    60 is added:
    x + 60 = 3(a+u) + 2(b+v) + 5(c+w)

    Then 3u + 2v + 5w = 60

    x/(3a) = (x+60)/[3(a+u)]
    x/(2b) = (x+60)/[2(b+v)]
    x/(5c) = (x+60)/[5(c+w)]

    Is that the way it works?
    I'm just an imagination of your figment !

  4. #4
    Elite Member
    Join Date
    Feb 2004
    Location
    Ottawa, Ontario
    Posts
    16,645
    Quote Originally Posted by justis View Post
    An example equation:
    x = a*3+b*0.02+c*0.5
    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

    k is added to x:
    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
    I'm just an imagination of your figment !

  5. #5
    Junior Member
    Join Date
    Nov 2017
    Location
    Rochester, NY
    Posts
    155
    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.

  6. #6
    New Member
    Join Date
    Nov 2017
    Posts
    11
    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

    Quote Originally Posted by Denis View Post
    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

    k is added to x:
    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.

  7. #7
    New Member
    Join Date
    Nov 2017
    Posts
    11
    Quote Originally Posted by Dr.Peterson View Post
    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

  8. #8
    Elite Member stapel's Avatar
    Join Date
    Feb 2004
    Posts
    15,514

    Cool

    Quote Originally Posted by justis View Post
    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?

    Please be specific. Thank you!

  9. #9
    New Member
    Join Date
    Nov 2017
    Posts
    11
    Quote Originally Posted by Dr.Peterson View Post
    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.


    Quote Originally Posted by stapel View Post
    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?

    Please be specific. Thank you!
    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.

  10. #10
    Junior Member
    Join Date
    Nov 2017
    Location
    Rochester, NY
    Posts
    155
    Quote Originally Posted by justis View Post
    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 [tex]x=\sum_i n_i p_i[/tex]. 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 ([tex]p_i[/tex]) 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 [tex]\dfrac{x+\Delta x}{x}[/tex]. 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.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •