Rebirths math problem

My question is what is the formula?

This is exactly what arithmetic series sums do as I have said above. To get the price of x amount of rebirths it would be s(currentRebirths + x) - s(currentRebirths) where s is the sum function. Refer to my post above for code.

I edited post above, but here it is again:

scale = 10000
final_cost = 0.5*scale * HowManyRebirths * (HowManyRebirths + 2*RebirthsIHave - 1)

Wow, thank you! This is what I was looking for! I printed it and it printed out the exact number I wanted.

1 Like

that will give you your first rebirth free
just so you know

1 Like

Yea, I’ll try to find something for this by myself. Thanks for this notice!

check my first response, it is a very similar formula but it shifts everything 1 spot so starting at 0, it is 10k

local e = 10 -- steepness of the scale

function expoScale(x)
  return e^x
end

function expoScaleInt(x)
  return (e^(x+1)-1)/(e-1)
end

is what you want

But I don’t understand it, could you repost it more clearly now?

Yours work perfectly but doesn’t include how many rebirths you have rn.

expoScale gives you a curve exponentially increasing by e, expoScaleInt is the analytic form for the series sum of that function.

It is just variables, put your variable for current rebirths in for cR and how many they buy for nR

1 Like

The fundamental theorem of calculus says you can just subtract whatever the sum of a series from the sum of a series to get the sum over an interval, thus

expoScaleInt(goalRebirths) - expoScaleInt(currentRebirths)

is what you would want to do.

What is the 2cR? its erroring me this

its just 2*cR, sorry for the confusion. formatting removes * and such

When RebirthsIHave=0 and HowManyRebirths=1 then the price is 0. If that’s not what you want, then you’ll need to shift things so that costs something else (probably 10000).

The fn that Pharyx_Styx posted is pretty much identical to the one I ended up with. Just change the -1 at the end of the fn to +1 and it will shift everything up by 10k.

I was trying to replicate what you did whereas he was showing the right way to do it :smiley:
Should mark his first post as solution. He was on to the answer right from the start.

2 Likes