Nerd_STF 3.0.0-beta2
dotnet add package Nerd_STF --version 3.0.0-beta2
NuGet\Install-Package Nerd_STF -Version 3.0.0-beta2
<PackageReference Include="Nerd_STF" Version="3.0.0-beta2" />
paket add Nerd_STF --version 3.0.0-beta2
#r "nuget: Nerd_STF, 3.0.0-beta2"
// Install Nerd_STF as a Cake Addin #addin nuget:?package=Nerd_STF&version=3.0.0-beta2&prerelease // Install Nerd_STF as a Cake Tool #tool nuget:?package=Nerd_STF&version=3.0.0-beta2&prerelease
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. |
.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 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. 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.
-
.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.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.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.0.0-beta2 | 37 | 11/25/2024 | |
3.0.0-beta1 | 68 | 10/29/2024 | |
2.4.1 | 248 | 7/17/2023 | |
2.4.0 | 175 | 7/10/2023 | |
2.3.2 | 274 | 3/9/2023 | |
2.3.1.68 | 364 | 11/12/2022 | |
2.3.1.52-alpha | 240 | 10/31/2022 | |
2.3.1.39-alpha | 203 | 9/30/2022 | |
2.3.0 | 436 | 8/2/2022 | |
2.2.0 | 452 | 6/10/2022 | |
2.1.2 | 447 | 5/2/2022 | |
2.1.1 | 413 | 4/17/2022 | |
2.1.0 | 433 | 4/17/2022 | |
2.0.1 | 444 | 4/3/2022 | |
2.0.0 | 434 | 4/3/2022 |
# Nerd_STF v3.0-beta2
I've added a substantial number of things in this update, mostly matrix related.
## List Tuples
In the previous beta, I introduced **Combination Indexers** for the double and int groups, however a problem was that they only returned `IEnumerable`s. So while some interesting things were supported, some things were not.
```csharp
Float4 wxyz = (1, 2, 3, 4);
IEnumerable<double> vals1 = wxyz["xy"]; // Yields [2, 3]
Float2 vals2 = wxyz["xy"]; // Not allowed!
```
And that kind of sucked. So I created the `ListTuple<T>` type. It's job is to act like a regular tuple, but be able to impliclty convert to either an `IEnumerable` or a regular `ValueTuple<T>`, thus allowing conversions to the double and int groups indirectly. Now, all combination indexers return a `ListTuple` instead of an `IEnumerable`.
Under the hood, the `ListTuple` actually uses an array, but you get the idea.
```csharp
Float4 wxyz = (1, 2, 3, 4);
ListTuple<double> vals1 = wxyz["xy"]; // Yields (2, 3)
Float2 vals2 = vals1; // Yields (2, 3)
IEnumerable<double> vals3 = vals1; // Yields [2, 3]
```
Problem is, now the names have the potential to make much less sense.
```csharp
Float4 wxyz = (1, 2, 3, 4);
Float2 xy = wxyz["xy"]; // x <- x, y <- y
Float2 wz = wxyz["wz"]; // x <- w, y <- z
```
But whatever. You can always stick to using `IEnumerable`s if you want.
## No More `*.Abstract`
I got rid of all the `Abstract` namespaces, since they don't really make much sense in the grand scheme of things. They've all been moved to the namespace that applies to them most (eg. `INumberGroup` went to `Nerd_STF.Mathematics`, `ICombinationIndexer` went to `Nerd_STF` since it applies to more than just mathematics).
## The `Fraction` Type
This type originally went under the name of `Rational` in Nerd_STF 2.x, but that name is actually incorrect, right? So in the rework, it changed names. But it also can do much more now thanks to the `INumber` interface added in .NET 7.0. If you're using that framework or above, the fraction type is fully compatible with that type, and all the math functions in `MathE` and elsewhere that use `INumber` will work with it.
Can I just say that the `INumber` interface is really annoying to write a type for? There's so many weird casting functions and a whole lot of methods that even the .NET developers will hide in public declarations. Why have them at all?
---
And I want to change the name of the `MathE` class. I'm thinking `Math2`, but I'm open to suggestions.
## And Best of All, Matrices
Oh yeah, we're adding those things again. I haven't completed (or even started) the dynamic `Matrix` class, that will arrive in beta3. But I have the `Matrix2x2`, `Matrix3x3`, and `Matrix4x4` fully implemented. The `ToString()` methods are much better with the new implementation than previously, and the `GetHashCode()` methods give different results even if the numbers have their positions swapped (which they originally didn't do).
And it's much faster. Much, much faster. Don't get me wrong, multiplying a 4x4 matrix still requires 64 multiplications and 48 additions, which is quite a lot, but my original implementation was littered with many method calls, easily doubling the runtime. I have now super-inlined basically all of the static matrix code. And I mean, replacing all method calls with nothing but multiplication and addition for things like the determinants, the cofactors, the inverses, and more. Don't look at the source, it's really ugly.
---
That's all the major stuff in this update! I'll see you guys in beta3!
P.S. I know that the System library also includes `Vector2`, `Vector3`, and `Vector4` types. I'll add casting support for them soon.