c# - c# .net 中的物理和数学常量和基本转换库

标签 c# .net

<分区>

我看到我们可以通过 C# 中的 Math.PI 获取 PI 的值。

您是否知道是否存在用于获取其他著名常数(例如 Avogadroo、Kelvin、Planck、Coulombs、黄金数、牛顿常数)的舍入值的库或程序包?

如果能做一些简单的转换就好了。

在另一个世界:一个用于科学的 light moment.js,它将为很多人节省大量时间。

最佳答案

正如他已经提到的,您可以使用 const keyword用于存储常量值。你也可以看到这个article :

// Physical Constants in cgs Units

// Boltzman Constant. Units erg/deg(K) 
public const double BOLTZMAN = 1.3807e-16;

// Elementary Charge. Units statcoulomb 
public const double ECHARGE = 4.8032e-10;

// Electron Mass. Units g 
public const double EMASS = 9.1095e-28;

// Proton Mass. Units g 
public const double PMASS = 1.6726e-24;

// Gravitational Constant. Units dyne-cm^2/g^2
public const double GRAV = 6.6720e-08;

// Planck constant. Units erg-sec 
public const double PLANCK = 6.6262e-27;

// Speed of Light in a Vacuum. Units cm/sec 
public const double LIGHTSPEED = 2.9979e10;

// Stefan-Boltzman Constant. Units erg/cm^2-sec-deg^4 
public const double STEFANBOLTZ = 5.6703e-5;

// Avogadro Number. Units  1/mol 
public const double AVOGADRO = 6.0220e23;

// Gas Constant. Units erg/deg-mol 
public const double GASCONSTANT = 8.3144e07;

// Gravitational Acceleration at the Earths surface. Units cm/sec^2 
public const double GRAVACC = 980.67;

// Solar Mass. Units g 
public const double SOLARMASS = 1.99e33;

// Solar Radius. Units cm
public const double SOLARRADIUS = 6.96e10;

// Solar Luminosity. Units erg/sec
public const double SOLARLUM = 3.90e33;

// Solar Flux. Units erg/cm^2-sec
public const double SOLARFLUX = 6.41e10;

// Astronomical Unit (radius of the Earth's orbit). Units cm
public const double AU = 1.50e13;

It would be great if it would exists a a package, a library or a native class for that

因此,没有您可以使用的此类库或 native 类。最好是将上述常量包含在一个单独的类中,然后使用它。

关于c# - c# .net 中的物理和数学常量和基本转换库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35172414/

相关文章:

c# - ADFS 登录页面本地化 - ASP.NET : I can't seem to be able to change language of the page dynamically

.net - 使用伪正确数据进行测试

c# - 在循环中创建的分隔字符串

c# - 将答案存储在具有唯一 ID 的 SQL 表中,并将每个答案存储在列中

c# - 如何在 C# 中获取当前用户的 Active Directory 详细信息

c# - 尽管存在 DataAccessKind.Read,SqlFunction 仍无法打开上下文连接

.net - WCF 返回类型

C# 属性强制属性

c# - 如果 modelstate 无效,则 Action Filter 不会运行

c# - 如何将对象转换为具有公共(public)无参数构造函数以遵守 : new() constraint?