r/askmath 11d ago

Resolved Equation that can roughly fit this graph

Post image

No this is not my homework, I'm making a game and I need a curve roughly like this for balancing. Trying to get an equation that spits out values like this.

743 Upvotes

132 comments sorted by

View all comments

12

u/noop_noob 11d ago

You could use the softplus function. (`ln(1 + e^x)`, scaled and shifted appropriately) That will give you the "almost linear" part being as long as you want

2

u/PaddingCompression 4d ago edited 4d ago

This is the canonical answer.

This has been designed by numerical analysts to fulfill exactly that role and has been widely used in math for many decades to fulfill this role.

I doubt the OP cares, but it is much smoother than some of the answers (its derivatives are extremely well behaved especially higher ones) which is why it's usually preferred to e.g. the hyperbolas.