Multiplying a number, and adding it to the previous result.

QuestionMark

New member
Joined
Oct 12, 2020
Messages
5
Hello all,

First of all, I apologize for the thread name. I'm not a native English speaker, nor did I ever have math class in English, so I don't know how to call this problem.
So I'll try to explain my problem as best as I can.

I have a base number, called "Y".
I have a standard multiplier, called "a",

The base number can be multiplied by a, but the result has to be added to the previous result. This process should be repeated X times.
X + aY + (a^2)Y + (a^3)Y + (a^4)Y ... etc

So for example using 10 as "Y", 1.1 as "a", and X = 3:
10 + 1.1*10 + (1.1^2)*10 +(1.1^3)*10 the outcome would be 46.41.

But how do I make a formula of this, where I can use X as a variable?

I hope I explained my question enough for you so you can understand what I mean.

Kind Regards,

Mark
 
Search for the term "geometric series".

I believe you didn't mean to start your sum with X, but rather with Y; and your X would usually be thought of as 1 less than the number of terms, which we might call n.
 
Search for the term "geometric series".

I believe you didn't mean to start your sum with X, but rather with Y; and your X would usually be thought of as 1 less than the number of terms, which we might call n.

Thanks!
This is indeed what I was looking for.

Have a good day.
 
You mean Y+ aY+ a^2Y+ ...+ a^nY.

That is a "geometric series" and it is easy to find its sum.
Let S= Y+ aY+ a^2Y+ ...+ a^nY
S- Y=aY+ a^2Y+ ...+ a^nY= a(Y+ aY+...+ a^(n-1)Y)

The sum in the parentheses is almost the same as the original sum- it is just missing "a^nY" so add that in (and subtract it):
S- Y= a(Y+ aY+ ...+ a^(n-1)Y+ a^nY- a^nY)
S- Y= a(Y+ aY+ ...+ a^(n- 1)Y+ a^nY)- a^(n+1)Y
Now the sum in the parentheses IS the original sum, S

S- Y= aS- a^(n+1)Y
S- aS= Y- a^(n+1)Y
(1- a)S= (1- a^(n+1))Y
Finally,
S= [(1- a^(n+1))/(1- a)]Y.

In your example, with Y= 10, a= 1.1, n= 3
That is S= [(1- 1.1^(4)]/(1- 1.1)]10= [(0.4641)/(0.1)]10= 46.41 as you got.
 
You mean Y+ aY+ a^2Y+ ...+ a^nY.

That is a "geometric series" and it is easy to find its sum.
Let S= Y+ aY+ a^2Y+ ...+ a^nY
S- Y=aY+ a^2Y+ ...+ a^nY= a(Y+ aY+...+ a^(n-1)Y)

The sum in the parentheses is almost the same as the original sum- it is just missing "a^nY" so add that in (and subtract it):
S- Y= a(Y+ aY+ ...+ a^(n-1)Y+ a^nY- a^nY)
S- Y= a(Y+ aY+ ...+ a^(n- 1)Y+ a^nY)- a^(n+1)Y
Now the sum in the parentheses IS the original sum, S

S- Y= aS- a^(n+1)Y
S- aS= Y- a^(n+1)Y
(1- a)S= (1- a^(n+1))Y
Finally,
S= [(1- a^(n+1))/(1- a)]Y.

In your example, with Y= 10, a= 1.1, n= 3
That is S= [(1- 1.1^(4)]/(1- 1.1)]10= [(0.4641)/(0.1)]10= 46.41 as you got.

Very clear, thanks!

However, while implementing this formula in my hobby programming project, another question araised.
How do I go about it when I know S, Y, and a, but I need to know n?

I tried to reverse engineer it from the formula above, but I'm stuck. It has been a few years since I had math class for the last time.
 
Very clear, thanks!

However, while implementing this formula in my hobby programming project, another question araised.
How do I go about it when I know S, Y, and a, but I need to know n?

I tried to reverse engineer it from the formula above, but I'm stuck. It has been a few years since I had math class for the last time.

Sorry, I'm new to this forum, and I could not find a way to edit my previous comment, so I put it in a new one.

But I think I got it:

Y ( 1 - a ^ (n+1) ) = S * (1-a)
1 - a ^ (n+1) = (S * (1-a)) / Y
- a ^ (n+1) = (S * (1-a) / Y) - 1
a ^ n+1 = -(S * (1-a) / Y) + 1
n + 1 = Log a [-(S * (1-a) / Y) + 1]
n = (Log a [-(S * (1-a) / Y) + 1]) - 1

It took me quite a while, but I believe this is correct.
 
Sorry, I'm new to this forum, and I could not find a way to edit my previous comment, so I put it in a new one.

But I think I got it:

Y ( 1 - a ^ (n+1) ) = S * (1-a)
1 - a ^ (n+1) = (S * (1-a)) / Y
- a ^ (n+1) = (S * (1-a) / Y) - 1
a ^ n+1 = -(S * (1-a) / Y) + 1
n + 1 = Log a [-(S * (1-a) / Y) + 1]
n = (Log a [-(S * (1-a) / Y) + 1]) - 1

It took me quite a while, but I believe this is correct.
Good work, but it will be easier to evaluate if you use the common or natural log, rather than the base-a log.

You are solving [MATH]S = \dfrac{1 - a^{n+1}}{1 - a} Y[/MATH]. After you get to [MATH]a^{n+1} = 1-\frac{S}{Y}(1-a)[/MATH], you can just take the log (base 10 as I'm writing it, or base e):

[MATH]\log\left(a^{n+1}\right) = \log\left(1-\frac{S}{Y}(1-a)\right)[/MATH]​
[MATH](n+1)\log(a) = \log\left(1-\frac{S}{Y}(1-a)\right)[/MATH]​
[MATH]n+1 = \frac{\log\left(1-\frac{S}{Y}(1-a)\right)}{\log(a)}[/MATH]​
[MATH]n = \frac{\log\left(1-\frac{S}{Y}(1-a)\right)}{\log(a)}-1[/MATH]​

(You could get this from your answer if you know the change-of-base formula.)
 
Good work, but it will be easier to evaluate if you use the common or natural log, rather than the base-a log.

You are solving [MATH]S = \dfrac{1 - a^{n+1}}{1 - a} Y[/MATH]. After you get to [MATH]a^{n+1} = 1-\frac{S}{Y}(1-a)[/MATH], you can just take the log (base 10 as I'm writing it, or base e):

[MATH]\log\left(a^{n+1}\right) = \log\left(1-\frac{S}{Y}(1-a)\right)[/MATH]​
[MATH](n+1)\log(a) = \log\left(1-\frac{S}{Y}(1-a)\right)[/MATH]​
[MATH]n+1 = \frac{\log\left(1-\frac{S}{Y}(1-a)\right)}{\log(a)}[/MATH]​
[MATH]n = \frac{\log\left(1-\frac{S}{Y}(1-a)\right)}{\log(a)}-1[/MATH]​

(You could get this from your answer if you know the change-of-base formula.)

Thank you very much for the explanation!

And it works perfectly now it is scripted in my program.

Have a good day.
 
Top