TMath
1.0.0
Tmath是一個C#數學庫,它具有實現INumber<T>的任何數字或自定義類型的功能實現。某些功能需要其他實現,例如ILogarithmicFunctions<T>或IPowerFunctions<T> 。
float , ulong , decimal還是您的自定義數字類型,只要它實現INumber<T>TConstants<T>類別Math類不支持的更多數學函數,它也與仿製藥一起使用,例如Factorial() 。TEasings在您的項目中提供了一些寬鬆功能,以支持任何INumber<T>DescriptiveStatistics學類保存有關數據集的所有信息。 在您的項目上安裝TMATH有多種方法:
dotnet add package TMath重要的
手動下載文件意味著如果您想要最新版本,則必須手動更新軟件包
使用tmath非常簡單,只需像Math那樣調用功能,它將自動返回大多數函數的正確類型,除了少數函數(例如Factorial<T>()之外。
對於使用TConstants<T>獲得任何常數,請指定您的類型(例如, TConstants<float> )。
// Calculating the area of a circle arc.
decimal angle = TConstants < decimal > . Pi ;
decimal radius = 1 ;
decimal areaOfArc = ( TFunctions . Rad2Deg ( angle ) / 360 ) * TConstants < decimal > . Pi * TFunctions . Pow ( radius , 2 ) ;
Console . WriteLine ( areaOfArc ) ;
// Calculating 20!
long factorial = TFunctions . Factorial < long > ( 20 ) ;
Console . WriteLine ( factorial ) ;
// Absolute value
sbyte number = - 34 ;
sbyte abs = TFunctions . Abs ( number ) ;
Console . WriteLine ( abs ) ;
// Getting the info about a data set
float [ ] data = new float [ ] { 1 , 2 , 3 , 4 , 5 , 6 }
float mean = TStatistics . Mean ( data ) ;
DescriptiveStatistics statistics = new ( data ) ; // Or get all that info computed into the custom class
Console . WriteLine ( statistics ) ; 如果您想在任何方面做出貢獻,請查看有關如何貢獻的信息的貢獻指南。
Tmath已獲得MIT許可證的許可。