# Thread: Not sure how to even find a solution for this

1. ## Not sure how to even find a solution for this

Ill try to be brief

I need a formula that can count the number of terms in a series until the value Im subtracting it from reaches 10 (or less than 10)

I have all the values in the formula below. The idea is to calculate how long itll take stock to reach close to 0 based on the sale of the previous 2 months, factoring in the % increase or drop of sales for that item from one month to the next

n = qty remaining
a = amount sold in last month
x = % change

n - [xa + (x^2)a + x^3)a...] < 10

not sure if im on the right path even, but what I need is the number of terms in the brackets until the formula reaches a value of less than 10

2. ## Re: Not sure how to even find a solution for this

$n-(xa+x^2a+x^3a+\ldots) < 10$

$n-a(1+x+x^2+x^3+\ldots) +a < 10$

$n-a\dfrac{1-x^k}{1-x}+a < 10$

$x^k < 1+\dfrac{(10-a-n)(1-x)}{a}$

$k > \dfrac{\ln\left(1+\dfrac{(10-a-n)(1-x)}{a}\right)}{\ln x}$

(Here, I assume that $x<1$ since it is a percent, and 1 = 100%. If $x>1$, then reverse the inequality.)

Find the smallest value of $k$ that makes the inequality true.

3. ## Re: Not sure how to even find a solution for this

Im trying to follow what you did there - just for curiosity's sake - but first of all thank you very much, I really appreciate you taking the time

on the second line I see you factored out the a, but then added it at the end there, why is that?

on the third line, why is the series able to be replaced by 1-x^k/1-x ?

and then the rest I cant even follow enough to know what to ask lol but its alright

those are strictly for curiosity like I said, its been a long time since I had to do math like this.

And yes, your assumption is correct that it is less than one, but thanks for letting me know about reversing the inequality, I was actually going to ask about that

So to find the smallest value of k that makes it true - does that mean input the values on the right, get some #, say 15, and then k would be 16, if using whole numbers?

4. ## Re: Not sure how to even find a solution for this

oh and lastly, I am assuming there is no way to input something like this in excel? I can do it myself and just enter the values I get but its for an excel sheet for 1000s of items of inventory, trying to save myself from having to do actual work, haha, cant have that

5. ## Re: Not sure how to even find a solution for this

Im running into an error on a test Im doing

so if N is the qty remaining - 100
a is 25 sold in the last month
x is .5, a 50 percent drop off from last month....

then the term in the numerator of the main fraction is negative, and cant take the natural log

10-a-n is 10-25-100 = -115
1-x is 1-.5 = .5

multiplied they give -57.5 and then divided by a (25) its -2.3

1 + (.2.3) = -1.3

did i do something wrong?

btw the reason im not very good at this is that its not part of my job, I am doing this to convince the boss he needs inventory forecasting software of some kind, because we are a large company and they over or under order often and im trying to show him the value of using these formulas to make basic predictions

6. ## Re: Not sure how to even find a solution for this

im also noticing the drop off is too extreme

is there a way to set a limit, for example, stopping at x^3 and leaving at that for all future months after that?

7. ## Re: Not sure how to even find a solution for this

$(1+x+x^2+\ldots + x^{k-1})(1-x) = 1-x^k$

How do we know this is true? Here is how:

\begin{align*}(1 &+ x+x^2+\ldots + x^{k-1})(1-x) = \\1 & + x + x^2+\ldots + x^{k-1}) \\ & -x - x^2 - \ldots - x^{k-1} - x^k \\ = 1 & +0+0+\ldots + 0 -x^k\end{align*}

So, if we solve for the partial sum, we get:

$1+x+x^2+\ldots + x^{k-1} = \dfrac{1-x^k}{1-x}$

So, I recommended that you find the smallest value of $k$ so that:

$k>\dfrac{\ln \left(1+\dfrac{(10-a-n)(1-x)}{a}\right)}{\ln x}$

You want one less term than that.