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许可证的许可。