对数分布
首先,数学不是我的专长。
想象一个这样的问题:
我有很多钱要花,比如 500,并且我需要在固定的天数内花掉它们,比如 20。我每天有一个固定的最多花钱,比如 50。我一天不需要花钱。
现在我需要知道如何计算我每天必须花费的总金额才能获得如下所示的支出曲线:
我的目标是一个需要一定数量的钱和天数的函数,并返回一个包含天数和当天的钱数的元组。
我知道我需要使用某种类型的对数,并且我已经尝试了我的大脑可以处理的几乎所有内容。我一直在查看 wolfram mathworld 和这个公式:
y = a + b ln x
但是它并没有真正帮助我。
PHP、Python 或 C# 的提示或示例会很棒,但任何语言都可以。
请如果您需要更多信息或者问题含糊不清,请告诉我,我真的很想解决这个问题。谢谢你!
First of all, math is not my area.
Imagine a problem like this:
I have a number of money to spend, say 500, and i need to spend them on a fixed number of days, say 20. I have a fixed maximum of money to spend per day, like 50. I don't need to spend money on a day.
Now i need to know how to calculate the total number of money I have to spend each day to get a spending curve like the following:
My goal is a function that takes a number of money and a number of days, and returns an tuple with day number and ammount of money for that day.
I know i need to use logarithms of some type, and i've tried pretty much everything that my brain can handle. I've been looking at wolfram mathworld and this formula:
y = a + b ln x
But it does not really help me.
An hint or example in PHP, Python or C# would be great, but any language will do.
PLEASE let me know if you need any more information or if the question is vague, I really want to solve this. Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不明白你为什么想要日志分布。抛物线即可获得您想要的曲线形式:
其中:
您最后一天花费的金额为 1。
对于您的示例值:(amt 500,第 20 天)
I don't understand why you want a log distribution. A parabolic one will do to obtain the curve form you want:
where:
With this the amount you spend the last day is 1.
For your example values: (amt 500, days 20)
您确定您要求的不是线性方程吗?
例如
y=f(x)=-50x+500,总天数为 x,其中 y=0。
Are you sure what you are asking for is not a linear equation?
For example
y=f(x)=-50x+500 and the total number of days would be x where y=0.