简体   繁体   English

C#指数公式

[英]C# exponential formula

I'm trying to find a way to write an exponential formula in C#.我正在尝试找到一种用 C# 编写指数公式的方法。 I'm awfully bad in math I admit.我承认我数学很差。

I have values linearly going from 10000 to 1 and need a formula to have results ranging from 400 to 1 but exponentially.我的值线性地从 10000 到 1 并且需要一个公式来获得从 400 到 1 但呈指数变化的结果。

Example results I'dd like:我喜欢的示例结果:

  • 10000 -> 400 10000 -> 400
  • 2000 -> 300 2000 -> 300
  • 1000 -> 200 1000 -> 200
  • 500 -> 100 500 -> 100
  • 100 -> 50 100 -> 50
  • 50 -> 10 50 -> 10
  • 10 -> 2 10 -> 2
  • 1 -> 1 1 -> 1

Does not have to be those exact values, but that's the idea.不必是那些确切的值,但这就是想法。 How would I write a formula to give me those results?我将如何编写一个公式来给出这些结果?

Thanks for any help possible感谢您提供任何可能的帮助

Assuming you want to use e^(value) , This might help.假设您想使用e^(value) ,这可能会有所帮助。

Math.Exp Method (Double) Math.Exp 方法(双)

One example could be,一个例子可能是,

// Evaluate (e ^ X) ^ Y == e ^ (X * Y).
Console.WriteLine( 
    " Math.Pow(Math.Exp({0}), {1}) == {2:E16} \n"+
    " Math.Exp({0} * {1}) == {3:E16}",
    argX, argY, Math.Pow(Math.Exp(argX), argY),
    Math.Exp(argX * argY) );

Using this create a formula which provides required output.使用它创建一个提供所需输出的公式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM