{"id":22598617,"url":"https://github.com/thiagomvas/tmath","last_synced_at":"2025-04-11T01:21:23.401Z","repository":{"id":209163002,"uuid":"723384842","full_name":"thiagomvas/TMath","owner":"thiagomvas","description":"A C# Math library using Generics to add support for more number types.","archived":false,"fork":false,"pushed_at":"2025-02-12T13:37:33.000Z","size":356,"stargazers_count":4,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T22:22:11.214Z","etag":null,"topics":["contributions-welcome","csharp","dotnet","easing","easing-functions","generic","generics","library","math","numerics","open-source","statistics"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thiagomvas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-25T13:56:28.000Z","updated_at":"2025-02-12T13:50:59.000Z","dependencies_parsed_at":"2023-12-26T17:41:13.537Z","dependency_job_id":"2bdb439e-cb14-4f38-9c6e-0fefd9408e3f","html_url":"https://github.com/thiagomvas/TMath","commit_stats":null,"previous_names":["thiagomvas/tmath"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagomvas%2FTMath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagomvas%2FTMath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagomvas%2FTMath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagomvas%2FTMath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thiagomvas","download_url":"https://codeload.github.com/thiagomvas/TMath/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248323302,"owners_count":21084477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["contributions-welcome","csharp","dotnet","easing","easing-functions","generic","generics","library","math","numerics","open-source","statistics"],"created_at":"2024-12-08T11:06:26.418Z","updated_at":"2025-04-11T01:21:23.387Z","avatar_url":"https://github.com/thiagomvas.png","language":"C#","readme":"# TMath - Generics Math Library for C#\n[![NUnit Tests](https://github.com/thiagomvas/TMath/actions/workflows/dotnet.yml/badge.svg)](https://github.com/thiagomvas/TMath/actions/workflows/dotnet.yml) [![Version](https://img.shields.io/nuget/v/tmath\n)](https://www.nuget.org/packages/TMath/) ![Downloads](https://img.shields.io/nuget/dt/tmath\n) ![Stars](https://img.shields.io/github/stars/thiagomvas/tmath \n) ![License](https://img.shields.io/github/license/thiagomvas/tmath)\n\n\nTMath is a C# Math library that has function implementations for any number or custom type \nthat implements ``INumber\u003cT\u003e``. Some functions require other implementations like \n``ILogarithmicFunctions\u003cT\u003e`` or ``IPowerFunctions\u003cT\u003e``.\n\n## 🌟 • Features\n- **Generics Support**: With TFunctions, you can make calculations using all number types with the same\nfunction call, doesn't matter if you're using `float`, `ulong`, `decimal` or your custom \nnumeric type, as long as it implements `INumber\u003cT\u003e`\n- **Generics Constants:** TMath also has a ``TConstants\u003cT\u003e`` class for getting mathematical\nconstants as any numeric type, such as **Euler's Number, Pi, Golden Ratio** and common square roots\n- **Expanded math functions**: More math functions not supported by the default `Math` class\nthat also work with generics, such as ``Factorial()``.\n- **Generics Easings Class:** ``TEasings`` offers a handful of easing functions for usage in\nyour projects that support any ``INumber\u003cT\u003e``\n- **Statistics Functions:** Use TStatistics to get info about a data set of numbers, such as Mean, Variance, etc.\nor use the ``DescriptiveStatistics`` class to hold all that info about a data set.\n\n## 📙 • Getting Started\n### Installation\nThere are multiple ways of installing TMath on your project:\n1. **NuGet Package Manager**: From your IDE, simply open the package manager and search for TMath\n2. **.NET CLI**: Open a command line and switch to the directory that contains your project file.\nAfter that, run the following command\n```shell \ndotnet add package TMath\n```\n3. **Forking / Cloning the repository**: Clone the repository into your projects and keep the package \nsaved on your project files.\n\u003e [!IMPORTANT]\n\u003e Downloading the files manually means you will have to update the package manually if you want the\n\u003e latest release whenever the package gets updated\n\n## 🔧 • Usage\nUsing TMath is very simple, simply call the functions like you would with ``Math`` and it'll automatically \nreturn\nthe correct type for most functions, with the exception of a handful of them like ``Factorial\u003cT\u003e()``.\n\nFor getting any constants using ``TConstants\u003cT\u003e``, specify your type (for example, ``TConstants\u003cfloat\u003e``).\n```csharp\n// Calculating the area of a circle arc.\ndecimal angle = TConstants\u003cdecimal\u003e.Pi;\ndecimal radius = 1;\ndecimal areaOfArc = (TFunctions.Rad2Deg(angle) / 360) * TConstants\u003cdecimal\u003e.Pi * TFunctions.Pow(radius, 2);\nConsole.WriteLine(areaOfArc);\n\n// Calculating 20!\nlong factorial = TFunctions.Factorial\u003clong\u003e(20);\nConsole.WriteLine(factorial);\n\n// Absolute value\nsbyte number = -34;\nsbyte abs = TFunctions.Abs(number);\nConsole.WriteLine(abs);\n\n// Getting the info about a data set\nfloat[] data = new float[] { 1, 2, 3, 4, 5, 6}\nfloat mean = TStatistics.Mean(data);\n\nDescriptiveStatistics statistics = new(data); // Or get all that info computed into the custom class\nConsole.WriteLine(statistics);\n\n```\n\n## 🤝 • Contributing\nIf you'd like to contribute in anyways, check out the [Contributing Guidelines](https://github.com/thiagomvas/TMath/blob/master/CONTRIBUTING.md) for info on how you can contribute.\n\n## 📄 • License\nTMath is licensed under the [MIT License](https://github.com/thiagomvas/TMath/blob/master/LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthiagomvas%2Ftmath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthiagomvas%2Ftmath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthiagomvas%2Ftmath/lists"}