翻譯|使用教程|編輯:況魚杰|2019-12-09 11:29:58.300|閱讀 548 次
概述:為方便起見,NMath在類NMathFunctions上提供了靜態方法,用于求解線性系統以及計算行列式,逆數和條件數。所有方法都接受矩陣。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
NMath是一個適用于所有.NET語言,如C#、Visual Basic、F#和.NET的數學庫,它包含了.NET平臺上的面向對象數字計算的基礎類。我們將以連載的形式向大家介紹NMath的實用教程。
為方便起見,NMath在類NMathFunctions上提供了靜態方法,用于求解線性系統以及計算行列式,逆數和條件數。所有方法都接受矩陣。
提供以下靜態方法:
NMathFunctions.Solve()解決單個或多個右側的線性系統。
NMathFunctions.Inverse()計算給定矩陣的逆數。
NMathFunctions.Determinant()計算給定矩陣的行列式。
NMathFunctions.EstimateConditionNumber()估計指定范數類型中給定矩陣的條件編號。
NMathFunctions.ConditionNumber()直接計算指定范數類型中給定矩陣的條件編號。
例如:
代碼示例– C#LU分解
var A = new DoubleMatrix( "3x3 [2 1 1 4 1 0 -2 2 1]" ); var b = new DoubleVector( "[8 11 3]" );DoubleVector x = NMathFunctions.Solve( A, b ); var B = new DoubleMatrix( "3x2[8 3 11 11 3 8]" );DoubleMatrix X = NMathFunctions.Solve( A, B );DoubleMatrix AInv = NMathFunctions.Inverse( A ); double ADet = NMathFunctions.Determinant( A ); double ACond = NMathFunctions.ConditionNumber( A, NormType.InfinityNorm );
代碼示例– VB LU分解
Dim A As New DoubleMatrix("3x3 [2 1 1 4 1 0 -2 2 1]") Dim B As New DoubleVector("[8 11 3]") Dim X As DoubleVector = NMathFunctions.Solve(A, B) Dim B As New DoubleMatrix("3x2[8 3 11 11 3 8]") Dim X As DoubleMatrix = NMathFunctions.Solve(A, B) Dim AInv As DoubleMatrix = NMathFunctions.Inverse(A) Dim ADet As Double = NMathFunctions.Determinant(A) Dim ACond As Double = NMathFunctions.ConditionNumber(A, NormType.InfinityNorm)
請注意,每次調用NMathFunctions.Solve()都會創建一個LU分解實例。如果您反復(例如在循環內)調用Solve(),并且兩次調用之間的系數矩陣沒有變化,則效率更高:
代碼示例– C#LU分解
var fact = new DoubleLUFact( A, false ); ... fact.Solve( B );
代碼示例– VB LU分解
Dim Fact As New DoubleLUFact(A, False) ... Fact.Solve(B)
上一章:使用LU分解
下一章:最小二乘
==========================================
如果想要購買正版授權NMath的朋友,可以聯系
關注慧聚IT微信公眾號 ???,了解產品的最新動態及最新資訊。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自: