Nerd_STF 3.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Nerd_STF --version 3.1.1
                    
NuGet\Install-Package Nerd_STF -Version 3.1.1
                    
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.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nerd_STF" Version="3.1.1" />
                    
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.1.1
                    
#r "nuget: Nerd_STF, 3.1.1"
                    
#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.1.1
                    
#: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.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Nerd_STF&version=3.1.1
                    
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 187 3/5/2026
3.1.2 159 1/28/2026
3.1.1 150 1/24/2026
3.1.0 170 1/2/2026
3.0.0 423 9/18/2025
3.0.0-beta3 212 2/19/2025
3.0.0-beta2 215 11/25/2024
3.0.0-beta1 185 10/29/2024
2.4.1 438 7/17/2023
2.4.0 338 7/10/2023
2.3.2 439 3/9/2023
2.3.1.68 544 11/12/2022
2.3.1.52-alpha 552 10/31/2022 2.3.1.52-alpha is deprecated because it has critical bugs.
2.3.1.39-alpha 538 9/30/2022 2.3.1.39-alpha is deprecated because it has critical bugs.
2.3.0 617 8/2/2022
2.2.0 650 6/10/2022
2.1.2 664 5/2/2022
2.1.1 617 4/17/2022
2.1.0 665 4/17/2022
Loading failed

Hi there! I mostly just have a few tweaks for this release, stuff I wanted to get out now so I can use it in other projects. There's plenty more tweaks to come in the future, but who knows when that'll be. Before or after the next major release, I couldn't tell you.

**This update mostly focuses on linear algebra tweaks.** I was messing around with some code to experiment with homework, and I wanted to project one vector upon another. Sometimes they would be 2d vectors, sometimes 3d. Problem was, the `IVectorOperations<T>` interface was really lame and didn't let me do that sort of thing with constraints.

So I've fixed that. Here's the simple projection method I wrote. The mathematical formula for projecting a vector $a$ onto $b$ goes like so: $\text{proj}^a_b = \frac{a \cdot b}{b \cdot b}b$. And the code looks like this:
```csharp
T Project<T>(T vec, T onto) where T : IVector<T>
{
   return onto * (T.Dot(vec, onto) / T.Dot(onto, onto));
}
```

Nice and simple. It works for all vector types, meaning `Float2`, `Float3`, `Float4`, and even the int equivalents if you substitute `IVector<T>` with `IVector<T, int>`.

---

What else... oh right. `ISplittable<T, TTuple>` was completely redundant, and has always been redundant, thanks to `System.Linq`. For example, take a list of `Float3`s, and we want to separate the X components from the rest.
```csharp
using System.Linq; // We need this or we'll get a weird compiler error.

List<Float3> items = [
   (1, 2, 3),
   (4, 5, 6),
   (7, 8, 9)
];

double[] option1 = Float3.SplitArray(items).Xs;           // We could do this and save all three variables in memory...
IEnumerable<double> option2 = from i in items select i.x; // Or we could do this.
```

So I removed ISplittable. This is technically a breaking change, but I doubt anyone was using it in any serious measure. Sorry if I screwed up your code :(

---

One last thing, this is a matrix feature (man, I've had matrices in my head a lot this update) that has been missing in 3.x, casting FloatXs to matrices. Now `Float2`, `Float3`, and `Float4`s can all be implicitly converted to column vectors, making them easy to multiply with the general matrix class. I also apparently forgot to create casting from specialized matrix classes to the generalized one, so I also implemented that.

---

Anyway, that's it. Not a huge update, I only spent about an hour implementing these thingies. I'm not done with small stuff, but whether it'll come out before or after the next major update I couldn't say. Wait, didn't I just say that? Call me AI the way I repeat myself but slightly rephrase words.

On that note, don't worry. I never EVER use AI in this project for any reason whatsoever. It's a passion project, why would I delegate something I love making? But yeah, no AI-generated changelog, no @Copilot pull requests, and no AI agent or autocomplete, but you'll have to take my word on that one since you can't really see my development environment.

Anyway, I'm definitely sick and tired of the choice I made way back at the beginning of 3.0: putting `w`s as the first component in `Float4`s. What a terrible idea. I think I'm going to revert that soon. I just keep facepalming every time I see the scuff that gets caused by that design choice. Oopsies.

Take care, enjoy 3.1.1!