Nerd_STF 3.2.0

dotnet add package Nerd_STF --version 3.2.0
                    
NuGet\Install-Package Nerd_STF -Version 3.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Nerd_STF" Version="3.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nerd_STF" Version="3.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Nerd_STF" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Nerd_STF --version 3.2.0
                    
#r "nuget: Nerd_STF, 3.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Nerd_STF@3.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Nerd_STF&version=3.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Nerd_STF&version=3.2.0
                    
Install as a Cake Tool

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

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.52-alpha is deprecated because it has critical bugs.
2.3.1.39-alpha 514 9/30/2022 2.3.1.39-alpha is deprecated because it has critical bugs.
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
Loading failed

Hi! This update spent a while idle before I got around to releasing it, whoops. Here, we're focusing on linear algebra changes.

## But first, Unit Tests!

I finally got around to experimenting with a test suite. I'm fairly new to this whole schpeel, so some of my tests might not be great. And there also aren't a ton right now. But I'll add many more over time. Hopefully I'll eventually get to testing nearly everything in Nerd_STF. But for now, it's cool to see the little check mark next to the commit.

One of the reasons I started writing tests is because I've had plenty of incidents where I missed bugs that occurred down the line when I would change a function. This hopefully prevents that.

Now the .sln file is finally exposed to the repo. Previously, I've had to hide it because my "messing around" project would be referenced and would cause compiler errors. I've replaced the messing around project with this new test project.

## More Matrix Operations

Like I said, this update concerns itself mainly with linear algebra. Some concepts have been added from that field of mathematics. Namely, I re-implemented the `SwapRows()`, `ScaleRow()`, and `AddRow()` operations from the 2.x versions. Here, `SwapRows(int, int)` swaps two rows of a matrix, `ScaleRow(int, double)` scales one by a certain factor, and `AddRow(int, double, int)` adds a scaled version of one row to another. In general, they're all basic row operations for matrices.

In addition, I also implemented a basic Row-Echelon solver. It's a simple Gaussian reduction algorithm and it is by no means perfect, but it kind of works. I may well make a better one in the future.

> [!NOTE]
> The row-echelon solver is only defined in the dynamic `Matrix` class. Call it using `Matrix.GaussElimination()`.

Range operations also are implemented in all matrix types now. You can use range operators to get particular rows and columns from a Matrix. Can be fairly useful in some circumstances. Here's an example:
```csharp
using Nerd_STF.Mathematics.Algebra;

// r  c 0: 1: 2:
// 0: [ 1, 2, 3 ]
// 1: [ 4, 5, 6 ]
// 2: [ 7, 8, 9 ]
Matrix m = new((3, 3), (x, y) => x * 3 + y + 1);

Matrix sub = m[1..3, 0..^1];
// Output:
// [ 4, 5 ]
// [ 7, 8 ]
```

Remember that matrix rows and columns are indexed 0-based.

One more thing before we end this part. To improve the use of generics again, I moved all declarations of `IMatrixOperations` into `IMatrix` for simplicity's sake.

---

That's about it. Enjoy the update! I'll be cranking out more unit tests and probably fixing bugs for a while.