TMATH เป็นไลบรารีคณิตศาสตร์ C# ที่มีการใช้งานฟังก์ชั่นสำหรับหมายเลขหรือประเภทที่ INumber<T> ใด ๆ ฟังก์ชั่นบางอย่างต้องการการใช้งานอื่น ๆ เช่น ILogarithmicFunctions<T> หรือ IPowerFunctions<T>
float , ulong , decimal หรือประเภท INumber<T> ใดTConstants<T> สำหรับการได้รับค่าคงที่ทางคณิตศาสตร์เป็นตัวเลขประเภทใด ๆ เช่น จำนวนออยเลอร์, PI, อัตราส่วนทองคำ และรากสี่เหลี่ยมทั่วไป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