Nerd_STF 3.1.2
See the version list below for details.
dotnet add package Nerd_STF --version 3.1.2
NuGet\Install-Package Nerd_STF -Version 3.1.2
<PackageReference Include="Nerd_STF" Version="3.1.2" />
<PackageVersion Include="Nerd_STF" Version="3.1.2" />
<PackageReference Include="Nerd_STF" />
paket add Nerd_STF --version 3.1.2
#r "nuget: Nerd_STF, 3.1.2"
#:package Nerd_STF@3.1.2
#addin nuget:?package=Nerd_STF&version=3.1.2
#tool nuget:?package=Nerd_STF&version=3.1.2
Nerd_STF
Nerd_STF is a multi-purpose library for .NET focused primarily on mathematics. It supports basically all versions of .NET has plenty of flexibility to let you do what you please with it.
Contents
- Examples
- How to Install
- I found a bug!
- I'd like to contribute!
- When's your next release?
- Older Versions
Examples
Here's how to derive a polynomial in Nerd_STF:
using Nerd_STF.Mathematics.Equations;
Polynomial poly = new(2, 1, 3); // 2x^2 + x + 3
Polynomial derivative = poly.Derive();
Console.WriteLine(derivative); // Output: 4x + 1
Here's how to get or set part of a number group:
Float3 xyz = (1, 2, 3);
Float2 xy = new(xyz["xy"]);
Float2 zy = new(xyz["zy"]);
double[] yxzy = [.. xyz["yxzy"]];
xyz["yz"] = [7, 8];
Console.WriteLine(xyz); // Output: (1, 7, 8)
Pretty easy, right?
How to Install
NuGet
You can install the package very easily with the NuGet Package Manager. The link to its NuGet page is here. You could install it by running a command:
# Do not include version flag to download the latest release.
dotnet add package Nerd_STF --version 3.0
or by including a package reference element in your project file:
<PackageReference Include="Nerd_STF" Version="3.0" />
Manual Reference
You could also manually reference the DLL for the project. Go to the releases page and select the library version and .NET target of your choice. At the time of writing, this project compiles to .NET Standard 1.3, 2.1, and .NET 7.0, but more may be added in the future.
Place the DLL somewhere you'll be able to reference later.
If you're using Visual Studio 2019 or 2022:
- Right click the project icon in the hierarchy.
- Go to Add > Project Reference
- Click Browse and locate the DLL you saved earlier.
- Click OK. You should be good to go!
Otherwise, you'll have to add a project reference element in your project file somewhere.
<Reference Include="Nerd_STF">
<HintPath>path\to\your\download\Nerd_STF.3.0.NET7.0.dll</HintPath>
</Reference>
I found a bug!
I'm not surprised, I'm only one guy. Feel free to make an issue in the repository and I'll get to it when I can!
I'd like to contribute!
Well, I'd prefer to do most of the programming myself, but if anyone wants to submit a pull request, feel free! Stick to the version-specific branches, try not to make commits on the main branch.
When's your next release?
No idea. This is a pet project, so progress on this library will come and go. It was more than a year between versions 2.4.1 and 3.0. It's really whenever mood strikes, so just watch the project to see what the current status is.
Older Versions
3.0 has plenty of breaking changes from 2.4.1 (and the rest of the 2.x updates), so it's totally fine if you don't want to update. I'll keep the 2.x updates up for the long-term, no reason to remove them. As for the versions before 2.0, well, it wasn't even really a library at that point. Do with it what you will.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. 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. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 is compatible. netcoreapp3.1 was computed. |
| .NET Standard | netstandard1.1 is compatible. netstandard1.2 was computed. netstandard1.3 is compatible. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 was computed. netstandard2.1 is compatible. |
| .NET Framework | net45 was computed. net451 was computed. net452 was computed. net46 is compatible. net461 was computed. net462 is compatible. net463 was computed. net47 is compatible. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
| Universal Windows Platform | uap was computed. uap10.0 was computed. |
| Windows Phone | wpa81 was computed. |
| Windows Store | netcore was computed. netcore45 was computed. netcore451 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.0
- No dependencies.
-
.NETFramework 4.6
- System.Memory (>= 4.5.5)
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.6.2
- System.Memory (>= 4.6.2)
- System.ValueTuple (>= 4.6.1)
-
.NETFramework 4.7
- System.Memory (>= 4.6.2)
-
.NETStandard 1.1
- NETStandard.Library (>= 1.6.1)
- System.Drawing.Primitives (>= 4.3.0)
- System.Memory (>= 4.5.5)
- System.Net.Http (>= 4.3.4)
- System.Numerics.Vectors (>= 4.5.0)
- System.Text.RegularExpressions (>= 4.3.1)
- System.ValueTuple (>= 4.5.0)
-
.NETStandard 1.3
- NETStandard.Library (>= 1.6.1)
- System.Drawing.Primitives (>= 4.3.0)
- System.Memory (>= 4.5.5)
- System.Net.Http (>= 4.3.4)
- System.Numerics.Vectors (>= 4.5.0)
- System.Text.RegularExpressions (>= 4.3.1)
- System.ValueTuple (>= 4.5.0)
-
.NETStandard 2.1
- No dependencies.
-
net5.0
- No dependencies.
-
net7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 3.2.0 | 68 | 3/5/2026 | |
| 3.1.2 | 108 | 1/28/2026 | |
| 3.1.1 | 105 | 1/24/2026 | |
| 3.1.0 | 124 | 1/2/2026 | |
| 3.0.0 | 379 | 9/18/2025 | |
| 3.0.0-beta3 | 179 | 2/19/2025 | |
| 3.0.0-beta2 | 181 | 11/25/2024 | |
| 3.0.0-beta1 | 157 | 10/29/2024 | |
| 2.4.1 | 407 | 7/17/2023 | |
| 2.4.0 | 309 | 7/10/2023 | |
| 2.3.2 | 414 | 3/9/2023 | |
| 2.3.1.68 | 513 | 11/12/2022 | |
| 2.3.1.52-alpha | 521 | 10/31/2022 | |
| 2.3.1.39-alpha | 514 | 9/30/2022 | |
| 2.3.0 | 587 | 8/2/2022 | |
| 2.2.0 | 618 | 6/10/2022 | |
| 2.1.2 | 632 | 5/2/2022 | |
| 2.1.1 | 582 | 4/17/2022 | |
| 2.1.0 | 633 | 4/17/2022 |
Welcome! I have some more small tweaks.
### You Don't Always Start With A `W`.
I finally got around to making `w` the last item in `Float4`s, `Int4`s, and `Quaternion`s. Really, it was a very peculiar hill I chose to die on there. My reasoning was mostly "w comes first in the alphabet, yeah? So it should contain the first value," but that's a silly argument because it's now no longer backwards compatible with 2s and 3s anymore. So I put it back. I had to do most of these changes manually, so I hope I didn't miss anything.
> [!WARNING]
> This is a breaking change! My *hope* is that anyone using this library was annoyed by this and now enjoys the new fix, but if you relied on this ordering, you might have to tweak some variables. Sorry about that.
### A Better `Sin()` function.
For a while now (basically since 3.0), the new Sin() function was quite inaccurate towards zero. It followed a proper Taylor series implementation and I think some floating point error was accumulating there. Not super certain. But I replaced it with another linear regression, like in 2.x. But it's a bit smarter: rather than making a polynomial represent the whole sin function, there are two polynomials that each represent an eighth of the range $[0..2\pi)$, and the rest of the range is mirrored to fit in one of those two categories. This way, the polynomial can be specifically taylored (hehe... taylored) to be good at either close to zero cases or close to one cases. It also uses less terms.
Shouldn't change your side very much, it'll just be more accurate. As far as I know, in normal situations the error never goes above 0.00004%.
### Some small stuff.
That's about all of the big stuff, not a super duper ton.
- I made the `IMagnitudeOperators` interface included in versions of C# < 11.
- I might do that with the other interfaces, though I'm not quite sure if it's logical to include interfaces that would be completely empty in some versions of C#.
- I also added the `Magnitude` and `MagnitudeSqr` property to the `IMagnitudeOperators` interface.
- I also added `MagnitudeSqr` to some more types, namely the `FloatX` and `IntX` types.
- I found a much simpler system for `MathE.ModAbs(num, mod)`. I unfortunately don't remember who I got it from, someone on StackOverflow that I found while looking for something else. It's constant-time rather than linear time. My previous approach was pretty dense if you ask me.
---
Anyway, that's all. Enjoy!