SMath 0.9.0
dotnet add package SMath --version 0.9.0
NuGet\Install-Package SMath -Version 0.9.0
<PackageReference Include="SMath" Version="0.9.0" />
<PackageVersion Include="SMath" Version="0.9.0" />
<PackageReference Include="SMath" />
paket add SMath --version 0.9.0
#r "nuget: SMath, 0.9.0"
#addin nuget:?package=SMath&version=0.9.0
#tool nuget:?package=SMath&version=0.9.0
<p align="center"> <img src="\src\code\SMath\icon.png"" alt="SMath" width="50"/> </p>
SMath
Overview
SMath is a math library built on .NET 7 generic math, offering a comprehensive set of static types for working with 2D geometry and statistics.
Features
Generic Math Capabilities
Leverages .NET 7�s new generic math features, allowing type-safe mathematical operations on various numeric types.
Geometry (2D)
Handle 2D geometric computations with ease. Available types and operations include:
- Point
- Euclidean distance, Manhattan distance, Chebyshev distance, Minkowski distance
- Line
- Ray, Line Segment
- Operations: Projection, Intersection, Inclusion
- Circle
- Arc, Chord, Sector, Segment
- Operations: Perimeter, Region, Tangent Points, Inclusion
- Rectangles
- Vertices
- Operations: Perimeter
Statistical Analysis
Perform basic statistical calculations:
- Correlation
- Variance
- Covariance
- Standard Deviation
- Histograms
Setup
Add nuget package to project.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SMath" Version="X.X.X" />
</ItemGroup>
</Project>
Replace 'X.X.X' with the appropriate version from NuGet.
Usage
Here are some basic usage examples to get started with SMath:
Geometry: Working with Circles and Lines
// Using double precision
var line1 = Circle.TangentLine.FromAngle(radius: 5d, angle: Math.PI / 4d);
// Using float precision
var line2 = Circle.TangentLine.FromAngle(radius: 5f, angle: MathF.PI / 4f);
// Find tangent points from a circle
var tangentPoints = Circle.TangentPoint.FromPoint(radius: 2d, (4, 4));
var secantLine = Line.FromTwoPoints(tangentPoints.Value.Point1, tangentPoints.Value.Point2);
Statistical Calculations
// Example of calculating variance
var values = new double[] { 1, 2, 3, 4, 5 };
double variance = Statistics.Variance(values);
Console.WriteLine($"Variance: {variance}");
Contributing
Any ideas, contributions and bug reports are welcome!
For new idea create an issue.
For bug report create an issue.
For contribution create a pull request.
License
Project is under MIT license.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net7.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SMath:
Package | Downloads |
---|---|
SPhysics
Alternative physics library based on .Net 7 generic math. |
GitHub repositories
This package is not used by any popular GitHub repositories.