# 一个数学计算问题

0
[已解决问题] 解决于 2019-04-01 14:09

MSky | 菜鸟二级 | 园豆：436

key 是整数吗？

Shendu.CC 2年前

0

double start = 2000.0000;
double end = 15000.0000;
double key;
key=Math.Pow(end/start, 1d / 1300d);

double end1 =Math.Pow(key, 1300d) * 2000d;
//测试最终end1约等于15000，应该是这样吧

MSky | 菜鸟二级 |园豆：436 | 2019-03-05 14:11

0
``````     double start = 2000;
double end = 15000;
double key;
double dd = 1300;``````
``````        key = Math.Pow(end / start, 1 / dd) - 1;

Console.WriteLine(key);

double result = start;

for (var i = 0; i < 1300; i++)
{
result *= (1 + key);
}
Console.WriteLine(result);

dlrowolleh | 园豆：296 (菜鸟二级) | 2019-03-05 14:40
0
``````static void Main(string[] args)
{
double from = 2000d;
double to = 15000d;
int count = 1300;
double key = Cal(from, to, count);
Console.WriteLine(key);
}

static double Cal(double from, double to, int count)
{
double key = Math.Pow(to / from, 1d / (count - 1)) - 1;
return key;
}``````

0

startNum * (1+key)^1300-1 = endNum

``````  1+key = （1300-1）√endNum/startNum

key = （1300-1）√endNum/startNum - 1``````

0

JackLiMVP | 园豆：202 (菜鸟二级) | 2019-04-01 21:01

您需要登录以后才能回答，未注册用户请先注册