MarcusMedina.Fluent.Maths.Algebra 0.5.0

Suggested Alternatives

MarcusMedina.Maths.Algebra

Additional Details

better code

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package MarcusMedina.Fluent.Maths.Algebra --version 0.5.0
                    
NuGet\Install-Package MarcusMedina.Fluent.Maths.Algebra -Version 0.5.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="MarcusMedina.Fluent.Maths.Algebra" Version="0.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MarcusMedina.Fluent.Maths.Algebra" Version="0.5.0" />
                    
Directory.Packages.props
<PackageReference Include="MarcusMedina.Fluent.Maths.Algebra" />
                    
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 MarcusMedina.Fluent.Maths.Algebra --version 0.5.0
                    
#r "nuget: MarcusMedina.Fluent.Maths.Algebra, 0.5.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 MarcusMedina.Fluent.Maths.Algebra@0.5.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=MarcusMedina.Fluent.Maths.Algebra&version=0.5.0
                    
Install as a Cake Addin
#tool nuget:?package=MarcusMedina.Fluent.Maths.Algebra&version=0.5.0
                    
Install as a Cake Tool

FluentBuilders.Algebra

NuGet NuGet Downloads C# .NET License: MIT Open Source Build Signed

Fluent API for algebraic expressions, symbolic mathematics, and equation manipulation in C#

Think of it as LINQ for mathematics โ€” the same idea of chaining readable operations, but instead of transforming collections, you transform algebraic expressions:

// LINQ transforms data:
numbers.Where(x => x > 0)
       .Select(x => x * 2)
       .Sum();

// Algebra transforms expressions:
Algebra.X.Square()
         .Add(Algebra.X.Multiply(3))
         .Subtract(7)
         .Differentiate("x");   // โ†’ 2x + 3

Just like LINQ hides iterators and lazy evaluation behind a clean API, this library hides expression trees behind readable math. You see what the code means, not how it works internally.


๐Ÿš€ Features

  • โœ… Expression Trees โ€” Build complex expressions programmatically
  • โœ… Symbolic Math โ€” Work with variables without immediate evaluation
  • โœ… Fluent API โ€” Chain operations naturally: Algebra.X.Add(5).Square()
  • โœ… Expression Parser โ€” Parse strings like "3*(x+2)^2" directly
  • โœ… Symbolic Differentiation โ€” expr.Differentiate("x") with full chain/product/quotient rules
  • โœ… Equation Solver โ€” Linear, quadratic, bisection, Newton-Raphson
  • โœ… Matrix Operations โ€” Add, multiply, transpose, determinant
  • โœ… Variable Substitution โ€” Replace variables with values or other expressions
  • โœ… Simplification โ€” Constant folding and identity rules
  • โœ… LaTeX Export โ€” Generate publication-ready mathematical notation
  • โœ… Constants โ€” Algebra.Pi, Algebra.E built in

๐Ÿ“ฆ Installation

dotnet add package MarcusMedina.Fluent.Maths.Algebra

Or via Package Manager Console:

Install-Package MarcusMedina.Fluent.Maths.Algebra

Requirements:

  • .NET 10.0 or later
  • C# 14.0 or later

๐ŸŽ“ Quick Start

Basic Usage

using MarcusMedina.Fluent.Maths.Algebra.Builders;
using MarcusMedina.Fluent.Maths.Algebra.Extensions;

// Create expression: (x + 2)^2 / 3
var expr = Algebra.X
    .Add(2)
    .Square()
    .Divide(3);

// Evaluate with x = 4
double result = expr.Evaluate("x", 4);  // (4 + 2)^2 / 3 = 12

// Export to LaTeX
string latex = expr.ToLaTeX();  // \frac{(x + 2)^{2}}{3}

Variable Substitution

// Work with multiple variables
var expr = Algebra.X.Multiply(2).Add(Algebra.Y);

// Substitute and evaluate
var vars = new Dictionary<string, double> { ["x"] = 3, ["y"] = 5 };
double result = expr.Evaluate(vars);  // 2*3 + 5 = 11

๐Ÿ“– Documentation


๐Ÿ”ง Use Cases

This library solves real-world problems in mathematics and education:

Each use case includes a working example and demonstrates how to integrate this library.


๐Ÿ’ก Examples

Creating Complex Expressions

// (2x^2 + 3x + 1) / (x - 1)
var numerator = Algebra.X
    .Square()
    .Multiply(2)
    .Add(Algebra.X.Multiply(3))
    .Add(1);

var denominator = Algebra.X.Subtract(1);

var fraction = numerator.Divide(denominator);
var simplified = fraction.Simplify();

Generating Mathematical Notation

var expr = Algebra.X
    .Add(5)
    .Multiply(Algebra.X.Subtract(3));

var latex = expr.ToLaTeX();
// Output: (x + 5)(x - 3)

var text = expr.ToString();
// Output: (x + 5) * (x - 3)

๐Ÿงช Testing

Run the test suite:

cd csharp
dotnet test --configuration Release

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿค Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“ž Support


Package integrity

All releases are signed with cosign (Sigstore keyless signing).

To verify a downloaded package, download both the .nupkg and its .sigstore.json bundle from the GitHub Release, then run:

cosign verify-blob <package.nupkg> \
  --bundle <package.nupkg.sigstore.json> \
  --certificate-identity-regexp "https://github.com/MarcusMedinaPro/.*/release.yml" \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

Expected output: Verified OK

Built with Human + AI Collaboration

This library was written by Marcus Medina together with Claude Code (Anthropic) โ€” not through "vibe coding" where you just describe and accept, but through genuine collaboration: planning together, reviewing each other's decisions, pushing back when something felt wrong, and iterating until the result felt right.

The goal was always to write code worth reading โ€” the kind a student can open, understand, and learn from. AI was a partner in that process, not a shortcut around it.

If you're curious about this way of working, the source code and git history are open. Every decision has a reason behind it.

Made for Curious Minds

This library was built with students in mind โ€” not as a black box to copy and paste, but as a real-world example of how clean, purposeful code is written and shared.

Whether you're discovering C# for the first time, need a reliable helper for your school project, or are simply trying to fall in love with writing code โ€” you're exactly who this was made for.

The source is open. Read it, fork it, break it, improve it. That's the whole point.

And if this library saved you an afternoon, or made something click that didn't before โ€” that's everything.

Non-students are equally welcome. Good code doesn't care about your diploma.

โญ If this helped you, consider starring the project on GitHub โ€” it helps other students find it too.

๐Ÿ’ฌ Have an idea, a feature request, or just want to say hi? Open an issue on GitHub โ€” I'd love to hear from you.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.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