【原創】開源Math.NET基礎數學類庫使用(07)常用的數學物理常數

資料之巔發表於2015-03-02

               本部落格所有文章分類的總目錄:【總目錄】本部落格博文總目錄-實時更新 

開源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

相關文章