【原创】开源Math.NET基础数学类库使用(07)常用的数学物理常数

               本博客所有文章分类的总目录:【总目录】本博客博文总目录-实时更新 

开源Math.NET基础数学类库使用总目录:【目录】开源Math.NET基础数学类库使用总目录

1.前言

  在前几篇关于Math.NET的博客中(见上面链接),主要是介绍了Math.NET中主要的数值功能,并进行了简单的矩阵向量计算例子,接着使用Math.NET的矩阵等对象,对3种常用的矩阵数据交换格式的读写。一方面可以了解Math.NET的使用,另一方面以后也可以直接读取和保存数据为这两种格式,并在第六篇中介绍了直接求解线性方程组的方法,下面介绍一个Math.NET中非常有用的类:Constants,其中封装了大量的数学及物理常数,可以直接拿来使用。

  如果本文资源或者显示有问题,请参考 本文原文地址http://www.cnblogs.com/asxinyu/p/4299983.html

  Math.NET中的数学物理常数类包括5个类型,下面分别一一进行介绍,主要是对源码的参数进行翻译,更加直观,使用的话根据自己的需要,就无需多说。

2.数学常数

  数学常数都是Double类型,已经非常精确了。直接看源码注释即可,部分没有翻译的,很少用到,看英文吧。  

  1 /// <summary>数学常数 e ,也称 欧拉数(Euler's number)</summary>
  2 public const double E = 2.7182818284590452353602874713526624977572470937000d;
  3 
  4 /// <summary>log[2](e):2为底,e的对数</summary>
  5 public const double Log2E = 1.4426950408889634073599246810018921374266459541530d;
  6 
  7 /// <summary>log[10](e):10为底,e的对数</summary>
  8 public const double Log10E = 0.43429448190325182765112891891660508229439700580366d;
  9 
 10 /// <summary>log[e](2):e为底,2的对数</summary>
 11 public const double Ln2 = 0.69314718055994530941723212145817656807550013436026d;
 12 
 13 /// <summary>log[e](10):e为底,10的对数</summary>
 14 public const double Ln10 = 2.3025850929940456840179914546843642076011014886288d;
 15 
 16 /// <summary>log[e](pi):e为底,pi的对数</summary>
 17 public const double LnPi = 1.1447298858494001741434273513530587116472948129153d;
 18 
 19 /// <summary>log[e](2*pi)/2</summary>
 20 public const double Ln2PiOver2 = 0.91893853320467274178032973640561763986139747363780d;
 21 
 22 /// <summary>1/e:e的倒数</summary>
 23 public const double InvE = 0.36787944117144232159552377016146086744581113103176d;
 24 
 25 /// <summary>sqrt(e)</summary>
 26 public const double SqrtE = 1.6487212707001281468486507878141635716537761007101d;
 27 
 28 /// <summary>sqrt(2)</summary>
 29 public const double Sqrt2 = 1.4142135623730950488016887242096980785696718753769d;
 30 
 31 /// <summary>sqrt(3)</summary>
 32 public const double Sqrt3 = 1.7320508075688772935274463415058723669428052538104d;
 33 
 34 /// <summary>sqrt(1/2) = 1/sqrt(2) = sqrt(2)/2</summary>
 35 public const double Sqrt1Over2 = 0.70710678118654752440084436210484903928483593768845d;
 36 
 37 /// <summary>sqrt(3)/2</summary>
 38 public const double HalfSqrt3 = 0.86602540378443864676372317075293618347140262690520d;
 39 
 40 /// <summary>pi,圆周率</summary>
 41 public const double Pi = 3.1415926535897932384626433832795028841971693993751d;
 42 
 43 /// <summary>pi*2</summary>
 44 public const double Pi2 = 6.2831853071795864769252867665590057683943387987502d;
 45 
 46 /// <summary>pi/2</summary>
 47 public const double PiOver2 = 1.5707963267948966192313216916397514420985846996876d;
 48 
 49 /// <summary>pi*3/2</summary>
 50 public const double Pi3Over2 = 4.71238898038468985769396507491925432629575409906266d;
 51 
 52 /// <summary>pi/4</summary>
 53 public const double PiOver4 = 0.78539816339744830961566084581987572104929234984378d;
 54 
 55 /// <summary>sqrt(pi)</summary>
 56 public const double SqrtPi = 1.7724538509055160272981674833411451827975494561224d;
 57 
 58 /// <summary>sqrt(2pi)</summary>
 59 public const double Sqrt2Pi = 2.5066282746310005024157652848110452530069867406099d;
 60 
 61 /// <summary>sqrt(2*pi*e)</summary>
 62 public const double Sqrt2PiE = 4.1327313541224929384693918842998526494455219169913d;
 63 
 64 /// <summary>log(sqrt(2*pi))</summary>
 65 public const double LogSqrt2Pi = 0.91893853320467274178032973640561763986139747363778;
 66 
 67 /// <summary>log(sqrt(2*pi*e))</summary>
 68 public const double LogSqrt2PiE = 1.4189385332046727417803297364056176398613974736378d;
 69 
 70 /// <summary>log(2 * sqrt(e / pi))</summary>
 71 public const double LogTwoSqrtEOverPi = 0.6207822376352452223455184457816472122518527279025978;
 72 
 73 /// <summary>1/pi</summary>
 74 public const double InvPi = 0.31830988618379067153776752674502872406891929148091d;
 75 
 76 /// <summary>2/pi</summary>
 77 public const double TwoInvPi = 0.63661977236758134307553505349005744813783858296182d;
 78 
 79 /// <summary>1/sqrt(pi)</summary>
 80 public const double InvSqrtPi = 0.56418958354775628694807945156077258584405062932899d;
 81 
 82 /// <summary>1/sqrt(2pi)</summary>
 83 public const double InvSqrt2Pi = 0.39894228040143267793994605993438186847585863116492d;
 84 
 85 /// <summary>2/sqrt(pi)</summary>
 86 public const double TwoInvSqrtPi = 1.1283791670955125738961589031215451716881012586580d;
 87 
 88 /// <summary>2 * sqrt(e / pi)</summary>
 89 public const double TwoSqrtEOverPi = 1.8603827342052657173362492472666631120594218414085755;
 90 
 91 /// <summary>(pi)/180 - 角度与弧度的转换常数</summary>
 92 /// <seealso cref="Trig.DegreeToRadian"/>
 93 /// <seealso cref="Trig.RadianToDegree"/>
 94 public const double Degree = 0.017453292519943295769236907684886127134428718885417d;
 95 
 96 /// <summary> (pi)/200 - factor to convert from NewGrad (grad) to Radians (rad).</summary>
 97 /// <seealso cref="Trig.GradToRadian"/>
 98 /// <seealso cref="Trig.RadianToGrad"/>
 99 public const double Grad = 0.015707963267948966192313216916397514420985846996876d;
100 
101 /// <summary>The number ln(10)/20 - factor to convert from Power Decibel (dB) to Neper (Np). Use this version when the Decibel represent a power gain but the compared values are not powers (e.g. amplitude, current, voltage).</summary>
102 public const double PowerDecibel = 0.11512925464970228420089957273421821038005507443144d;
103 
104 /// <summary>The number ln(10)/10 - factor to convert from Neutral Decibel (dB) to Neper (Np). Use this version when either both or neither of the Decibel and the compared values represent powers.</summary>
105 public const double NeutralDecibel = 0.23025850929940456840179914546843642076011014886288d;
106 
107 /// <summary>The Catalan constant</summary>
108 /// <remarks>Sum(k=0 -> inf){ (-1)^k/(2*k + 1)2 }</remarks>
109 public const double Catalan = 0.9159655941772190150546035149323841107741493742816721342664981196217630197762547694794d;
110 
111 /// <summary>The Euler-Mascheroni constant</summary>
112 /// <remarks>lim(n -> inf){ Sum(k=1 -> n) { 1/k - log(n) } }</remarks>
113 public const double EulerMascheroni = 0.5772156649015328606065120900824024310421593359399235988057672348849d;
114 
115 /// <summary>(1+sqrt(5))/2, 黄金比例</summary>
116 public const double GoldenRatio = 1.6180339887498948482045868343656381177203091798057628621354486227052604628189024497072d;
117 
118 /// <summary>Glaisher常数</summary>
119 /// <remarks>e^(1/12 - Zeta(-1))</remarks>
120 public const double Glaisher = 1.2824271291006226368753425688697917277676889273250011920637400217404063088588264611297d;
121 
122 /// <summary>Khinchin常数</summary>
123 /// <remarks>prod(k=1 -> inf){1+1/(k*(k+2))^log(k,2)}</remarks>
124 public const double Khinchin = 2.6854520010653064453097148354817956938203822939944629530511523455572188595371520028011d;

3.普适常数  

 1 /// <summary>真空中的光速: c_0 = 2.99792458e8 [m s^-1] (defined, exact; 2007 CODATA)</summary>
 2 public const double SpeedOfLight = 2.99792458e8;
 3 
 4 /// <summary>真空中的磁导率: mu_0 = 4*Pi * 10^-7 [N A^-2 = kg m A^-2 s^-2] (defined, exact; 2007 CODATA)</summary>
 5 public const double MagneticPermeability = 1.2566370614359172953850573533118011536788677597500e-6;
 6 
 7 /// <summary>真空中的介电常数: epsilon_0 = 1/(mu_0*c_0^2) [F m^-1 = A^2 s^4 kg^-1 m^-3] (defined, exact; 2007 CODATA)</summary>
 8 public const double ElectricPermittivity = 8.8541878171937079244693661186959426889222899381429e-12;
 9 
10 /// <summary>真空中的特性阻抗常数: Z_0 = mu_0*c_0 [Ohm = m^2 kg s^-3 A^-2] (defined, exact; 2007 CODATA)</summary>
11 public const double CharacteristicImpedanceVacuum = 376.73031346177065546819840042031930826862350835242;
12 
13 /// <summary>牛顿引力常数: G = 6.67429e-11 [m^3 kg^-1 s^-2] (2007 CODATA)</summary>
14 public const double GravitationalConstant = 6.67429e-11;
15 
16 /// <summary>普朗克常数: h = 6.62606896e-34 [J s = m^2 kg s^-1] (2007 CODATA)</summary>
17 public const double PlancksConstant = 6.62606896e-34;
18 
19 /// <summary>约化普朗克常数: h_bar = h / (2*Pi) [J s = m^2 kg s^-1] (2007 CODATA)</summary>
20 public const double DiracsConstant = 1.054571629e-34;
21 
22 /// <summary>普朗克质量: m_p = (h_bar*c_0/G)^(1/2) [kg] (2007 CODATA)</summary>
23 public const double PlancksMass = 2.17644e-8;
24 
25 /// <summary>普朗克温度: T_p = (h_bar*c_0^5/G)^(1/2)/k [K] (2007 CODATA)</summary>
26 public const double PlancksTemperature = 1.416786e32;
27 
28 /// <summary>普朗克长度: l_p = h_bar/(m_p*c_0) [m] (2007 CODATA)</summary>
29 public const double PlancksLength = 1.616253e-35;
30 
31 /// <summary>普朗克时间: t_p = l_p/c_0 [s] (2007 CODATA)</summary>
32 public const double PlancksTime = 5.39124e-44;

4.电磁常数   

 1 /// <summary>基本电子电荷: e = 1.602176487e-19 [C = A s] (2007 CODATA)</summary>
 2 public const double ElementaryCharge = 1.602176487e-19;
 3 
 4 /// <summary>磁通量子: theta_0 = h/(2*e) [Wb = m^2 kg s^-2 A^-1] (2007 CODATA)</summary>
 5 public const double MagneticFluxQuantum = 2.067833668e-15;
 6 
 7 /// <summary>电导量子(Conductance Quantum): G_0 = 2*e^2/h [S = m^-2 kg^-1 s^3 A^2] (2007 CODATA)</summary>
 8 public const double ConductanceQuantum = 7.7480917005e-5;
 9 
10 /// <summary>约瑟夫森效应常数(Josephson Constant): K_J = 2*e/h [Hz V^-1] (2007 CODATA)</summary>
11 public const double JosephsonConstant = 483597.891e9;
12 
13 /// <summary>克里青常数(Von Klitzing Constant): R_K = h/e^2 [Ohm = m^2 kg s^-3 A^-2] (2007 CODATA)</summary>
14 public const double VonKlitzingConstant = 25812.807557;
15 
16 /// <summary>玻尔磁子(Bohr Magneton): mu_B = e*h_bar/2*m_e [J T^-1] (2007 CODATA)</summary>
17 public const double BohrMagneton = 927.400915e-26;
18 
19 /// <summary>核磁子(Nuclear Magneton): mu_N = e*h_bar/2*m_p [J T^-1] (2007 CODATA)</summary>
20 public const double NuclearMagneton = 5.05078324e-27;

5.原子和核常量

  一些常用的:  

 1 /// <summary>精细结构常数(Fine Structure Constant): alpha = e^2/4*Pi*e_0*h_bar*c_0 [1] (2007 CODATA)</summary>
 2 public const double FineStructureConstant = 7.2973525376e-3;
 3 
 4 /// <summary>里德伯常量(Rydberg Constant): R_infty = alpha^2*m_e*c_0/2*h [m^-1] (2007 CODATA)</summary>
 5 public const double RydbergConstant = 10973731.568528;
 6 
 7 /// <summary>Bor Radius: a_0 = alpha/4*Pi*R_infty [m] (2007 CODATA)</summary>
 8 public const double BohrRadius = 0.52917720859e-10;
 9 
10 /// <summary>Hartree Energy: E_h = 2*R_infty*h*c_0 [J] (2007 CODATA)</summary>
11 public const double HartreeEnergy = 4.35974394e-18;
12 
13 /// <summary>Quantum of Circulation: h/2*m_e [m^2 s^-1] (2007 CODATA)</summary>
14 public const double QuantumOfCirculation = 3.6369475199e-4;
15 
16 /// <summary>Fermi Coupling Constant: G_F/(h_bar*c_0)^3 [GeV^-2] (2007 CODATA)</summary>
17 public const double FermiCouplingConstant = 1.16637e-5;
18 
19 /// <summary>Weak Mixin Angle: sin^2(theta_W) [1] (2007 CODATA)</summary>
20 public const double WeakMixingAngle = 0.22256;
21 
22 /// <summary>电子质量(Electron Mass): [kg] (2007 CODATA)</summary>
23 public const double ElectronMass = 9.10938215e-31;
24 
25 /// <summary>Electron Mass Energy Equivalent: [J] (2007 CODATA)</summary>
26 public const double ElectronMassEnergyEquivalent = 8.18710438e-14;
27 
28 /// <summary>电子摩尔质量(Electron Molar Mass): [kg mol^-1] (2007 CODATA)</summary>
29 public const double ElectronMolarMass = 5.4857990943e-7;
30 
31 /// <summary>电子的康普顿波长(Electron Compton Wavelength): [m] (2007 CODATA)</summary>
32 public const double ComptonWavelength = 2.4263102175e-12;
33 
34 /// <summary>经典电子半径(Classical Electron Radius): [m] (2007 CODATA)</summary>
35 public const double ClassicalElectronRadius = 2.8179402894e-15;
36 
37 /// <summary>Tomson Cross Section: [m^2] (2002 CODATA)</summary>
38 public const double ThomsonCrossSection = 0.6652458558e-28;
39 
40 /// <summary>电子磁矩(Electron Magnetic Moment): [J T^-1] (2007 CODATA)</summary>
41 public const double ElectronMagneticMoment = -928.476377e-26;

还有一些不常用的,需要在很专业的地方才能用得上,代码折叠了:  

  1 /// <summary>Electon G-Factor: [1] (2007 CODATA)</summary>
  2 public const double ElectronGFactor = -2.0023193043622;
  3 
  4 /// <summary>μ介子质量(Muon Mass): [kg] (2007 CODATA)</summary>
  5 public const double MuonMass = 1.88353130e-28;
  6 
  7 /// <summary>Muon Mass Energy Equivalent: [J] (2007 CODATA)</summary>
  8 public const double MuonMassEnegryEquivalent = 1.692833511e-11;
  9 
 10 /// <summary>Muon Molar Mass: [kg mol^-1] (2007 CODATA)</summary>
 11 public const double MuonMolarMass = 0.1134289256e-3;
 12 
 13 /// <summary>Muon Compton Wavelength: [m] (2007 CODATA)</summary>
 14 public const double MuonComptonWavelength = 11.73444104e-15;
 15 
 16 /// <summary>Muon Magnetic Moment: [J T^-1] (2007 CODATA)</summary>
 17 public const double MuonMagneticMoment = -4.49044786e-26;
 18 
 19 /// <summary>Muon G-Factor: [1] (2007 CODATA)</summary>
 20 public const double MuonGFactor = -2.0023318414;
 21 
 22 /// <summary>Tau Mass: [kg] (2007 CODATA)</summary>
 23 public const double TauMass = 3.16777e-27;
 24 
 25 /// <summary>Tau Mass Energy Equivalent: [J] (2007 CODATA)</summary>
 26 public const double TauMassEnergyEquivalent = 2.84705e-10;
 27 
 28 /// <summary>Tau Molar Mass: [kg mol^-1] (2007 CODATA)</summary>
 29 public const double TauMolarMass = 1.90768e-3;
 30 
 31 /// <summary>Tau Compton Wavelength: [m] (2007 CODATA)</summary>
 32 public const double TauComptonWavelength = 0.69772e-15;
 33 
 34 /// <summary>Proton Mass: [kg] (2007 CODATA)</summary>
 35 public const double ProtonMass = 1.672621637e-27;
 36 
 37 /// <summary>Proton Mass Energy Equivalent: [J] (2007 CODATA)</summary>
 38 public const double ProtonMassEnergyEquivalent = 1.503277359e-10;
 39 
 40 /// <summary>Proton Molar Mass: [kg mol^-1] (2007 CODATA)</summary>
 41 public const double ProtonMolarMass = 1.00727646677e-3;
 42 
 43 /// <summary>Proton Compton Wavelength: [m] (2007 CODATA)</summary>
 44 public const double ProtonComptonWavelength = 1.3214098446e-15;
 45 
 46 /// <summary>Proton Magnetic Moment: [J T^-1] (2007 CODATA)</summary>
 47 public const double ProtonMagneticMoment = 1.410606662e-26;
 48 
 49 /// <summary>Proton G-Factor: [1] (2007 CODATA)</summary>
 50 public const double ProtonGFactor = 5.585694713;
 51 
 52 /// <summary>Proton Shielded Magnetic Moment: [J T^-1] (2007 CODATA)</summary>
 53 public const double ShieldedProtonMagneticMoment = 1.410570419e-26;
 54 
 55 /// <summary>Proton Gyro-Magnetic Ratio: [s^-1 T^-1] (2007 CODATA)</summary>
 56 public const double ProtonGyromagneticRatio = 2.675222099e8;
 57 
 58 /// <summary>Proton Shielded Gyro-Magnetic Ratio: [s^-1 T^-1] (2007 CODATA)</summary>
 59 public const double ShieldedProtonGyromagneticRatio = 2.675153362e8;
 60 
 61 /// <summary>中子质量(Neutron Mass): [kg] (2007 CODATA)</summary>
 62 public const double NeutronMass = 1.674927212e-27;
 63 
 64 /// <summary>Neutron Mass Energy Equivalent: [J] (2007 CODATA)</summary>
 65 public const double NeutronMassEnegryEquivalent = 1.505349506e-10;
 66 
 67 /// <summary>Neutron Molar Mass: [kg mol^-1] (2007 CODATA)</summary>
 68 public const double NeutronMolarMass = 1.00866491597e-3;
 69 
 70 /// <summary>Neuron Compton Wavelength: [m] (2007 CODATA)</summary>
 71 public const double NeutronComptonWavelength = 1.3195908951e-1;
 72 
 73 /// <summary>Neutron Magnetic Moment: [J T^-1] (2007 CODATA)</summary>
 74 public const double NeutronMagneticMoment = -0.96623641e-26;
 75 
 76 /// <summary>Neutron G-Factor: [1] (2007 CODATA)</summary>
 77 public const double NeutronGFactor = -3.82608545;
 78 
 79 /// <summary>Neutron Gyro-Magnetic Ratio: [s^-1 T^-1] (2007 CODATA)</summary>
 80 public const double NeutronGyromagneticRatio = 1.83247185e8;
 81 
 82 /// <summary>氘核质量(Deuteron Mass): [kg] (2007 CODATA)</summary>
 83 public const double DeuteronMass = 3.34358320e-27;
 84 
 85 /// <summary>Deuteron Mass Energy Equivalent: [J] (2007 CODATA)</summary>
 86 public const double DeuteronMassEnegryEquivalent = 3.00506272e-10;
 87 
 88 /// <summary>Deuteron Molar Mass: [kg mol^-1] (2007 CODATA)</summary>
 89 public const double DeuteronMolarMass = 2.013553212725e-3;
 90 
 91 /// <summary>Deuteron Magnetic Moment: [J T^-1] (2007 CODATA)</summary>
 92 public const double DeuteronMagneticMoment = 0.433073465e-26;
 93 
 94 /// <summary>Helion Mass: [kg] (2007 CODATA)</summary>
 95 public const double HelionMass = 5.00641192e-27;
 96 
 97 /// <summary>Helion Mass Energy Equivalent: [J] (2007 CODATA)</summary>
 98 public const double HelionMassEnegryEquivalent = 4.49953864e-10;
 99 
100 /// <summary>Helion Molar Mass: [kg mol^-1] (2007 CODATA)</summary>
101 public const double HelionMolarMass = 3.0149322473e-3;
102 
103 /// <summary>Avogadro constant: [mol^-1] (2010 CODATA)</summary>
104 public const double Avogadro = 6.0221412927e23;
View Code

6.科学计算前缀

 1 /// <summary>The SI prefix factor corresponding to 1 000 000 000 000 000 000 000 000</summary>
 2 public const double Yotta = 1e24;
 3 
 4 /// <summary>The SI prefix factor corresponding to 1 000 000 000 000 000 000 000</summary>
 5 public const double Zetta = 1e21;
 6 
 7 /// <summary>The SI prefix factor corresponding to 1 000 000 000 000 000 000</summary>
 8 public const double Exa = 1e18;
 9 
10 /// <summary>The SI prefix factor corresponding to 1 000 000 000 000 000</summary>
11 public const double Peta = 1e15;
12 
13 /// <summary>The SI prefix factor corresponding to 1 000 000 000 000</summary>
14 public const double Tera = 1e12;
15 
16 /// <summary>The SI prefix factor corresponding to 1 000 000 000</summary>
17 public const double Giga = 1e9;
18 
19 /// <summary>The SI prefix factor corresponding to 1 000 000</summary>
20 public const double Mega = 1e6;
21 
22 /// <summary>The SI prefix factor corresponding to 1 000</summary>
23 public const double Kilo = 1e3;
24 
25 /// <summary>The SI prefix factor corresponding to 100</summary>
26 public const double Hecto = 1e2;
27 
28 /// <summary>The SI prefix factor corresponding to 10</summary>
29 public const double Deca = 1e1;
30 
31 /// <summary>The SI prefix factor corresponding to 0.1</summary>
32 public const double Deci = 1e-1;
33 
34 /// <summary>The SI prefix factor corresponding to 0.01</summary>
35 public const double Centi = 1e-2;
36 
37 /// <summary>The SI prefix factor corresponding to 0.001</summary>
38 public const double Milli = 1e-3;
39 
40 /// <summary>The SI prefix factor corresponding to 0.000 001</summary>
41 public const double Micro = 1e-6;
42 
43 /// <summary>The SI prefix factor corresponding to 0.000 000 001</summary>
44 public const double Nano = 1e-9;
45 
46 /// <summary>The SI prefix factor corresponding to 0.000 000 000 001</summary>
47 public const double Pico = 1e-12;
48 
49 /// <summary>The SI prefix factor corresponding to 0.000 000 000 000 001</summary>
50 public const double Femto = 1e-15;
51 
52 /// <summary>The SI prefix factor corresponding to 0.000 000 000 000 000 001</summary>
53 public const double Atto = 1e-18;
54 
55 /// <summary>The SI prefix factor corresponding to 0.000 000 000 000 000 000 001</summary>
56 public const double Zepto = 1e-21;
57 
58 /// <summary>The SI prefix factor corresponding to 0.000 000 000 000 000 000 000 001</summary>
59 public const double Yocto = 1e-24;

7.资源

  源码下载:http://www.cnblogs.com/asxinyu/p/4264638.html

  如果本文资源或者显示有问题,请参考 本文原文地址http://www.cnblogs.com/asxinyu/p/4299983.html

.NET数据挖掘与机器学习,作者博客: http://www.cnblogs.com/asxinyu

E-mail:1287263703@qq.com

posted @ 2015-03-02 08:14  数据之巅  阅读(6459)  评论(4编辑  收藏  举报