{"id":20410440,"url":"https://github.com/alex-titarenko/mathcore","last_synced_at":"2025-04-12T16:04:03.200Z","repository":{"id":27653132,"uuid":"31138488","full_name":"alex-titarenko/mathcore","owner":"alex-titarenko","description":"Advanced .NET math library (.NET Standard).","archived":false,"fork":false,"pushed_at":"2021-02-10T06:01:45.000Z","size":1194,"stargazers_count":25,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-01T00:08:59.266Z","etag":null,"topics":["c-sharp","complex-numbers","expression-tree","expression-tree-builder","genetic-algorithm","linear-algebra","math","matrices","net-standard","nuget","optimization","statistics","unit-conversion"],"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/alex-titarenko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-21T19:51:43.000Z","updated_at":"2024-05-05T14:41:58.000Z","dependencies_parsed_at":"2022-09-02T20:12:45.562Z","dependency_job_id":null,"html_url":"https://github.com/alex-titarenko/mathcore","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-titarenko%2Fmathcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-titarenko%2Fmathcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-titarenko%2Fmathcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-titarenko%2Fmathcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alex-titarenko","download_url":"https://codeload.github.com/alex-titarenko/mathcore/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224427287,"owners_count":17309367,"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":["c-sharp","complex-numbers","expression-tree","expression-tree-builder","genetic-algorithm","linear-algebra","math","matrices","net-standard","nuget","optimization","statistics","unit-conversion"],"created_at":"2024-11-15T05:46:25.069Z","updated_at":"2024-11-15T05:46:25.867Z","avatar_url":"https://github.com/alex-titarenko.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MathCore\n![Build](https://github.com/alex-titarenko/mathcore/workflows/Build/badge.svg?branch=main)\n\nAdvanced .NET math library (.NET Standard).\n\n## Structure\n* **MathCore** - base library, contains the following features: complex numbers, fractions, complex polynomials, unit conversion, coordinate system conversion, numeric utils and some extensions for Math class.\n* **MathCore.LinearAlgebra** - linear algebra extension for math core, contains the following features: complex matrices, eigen problem solver, bunch operations with matrices (concat, add, sub, mult, rise to power, multiply, sqrt, inverse, trace, determinant and etc.).\n* **MathCore.NumericalAnalysis** - numeric analysis extension for math core, contains the following features: equation solver, interpolation, numeric integration, optimization.\n* **MathCore.SpecialFunctions** - special functions extension for math core, contains the following features: calculating of error functions and etc.\n* **MathCore.Statistics** - statistics extension for math core, contains the following features: distribution (normal, uniform, exponential), calculation of mean, mode, correlation, standard deviation and etc.\n* **MathCore.Optimization** - optimization extension for math core, contains implementation of simple genetic algorithm and cellular genetic algorithm.\n* **MathCore.ExpressionsBase** - base library, which allow from usual string make expression tree to be able evaluate math expression of any level of complexity.\n* **MathCore.ComplexExpressions** - extension for expression base library, which adds support complex numbers in expressions.\n* **MathCore.ComplexExpressions.Extensions** - sets of functions and constants for complex expressions library.\n\n## Examples of usage\nHow to initialize expression tree builder:\n```C#\nvar targetAssembly = Assembly.LoadFrom(\"TAlex.MathCore.ComplexExpressions.Extensions.dll\");\n\nvar constantFactory = new ConstantFlyweightFactory\u003cobject\u003e();\nconstantFactory.LoadFromAssemblies(new List\u003cAssembly\u003e { targetAssembly });\n\nvar functionFactory = new FunctionFactory\u003cobject\u003e();\nfunctionFactory.LoadFromAssemblies(new List\u003cAssembly\u003e { targetAssembly });\n\nvar expressionTreeBuilder = new ComplexExpressionTreeBuilder\n{\n    ConstantFactory = constantFactory,\n    FunctionFactory = functionFactory\n};\n```\nHow to use expression tree builder:\n```C#\nvar tree = expressionTreeBuilder.BuildTree(\"abs(2+4.1i)*9i\");\nobject actual = tree.Evaluate(); // 41.0562...\n\ntree = expressionTreeBuilder.BuildTree(\"integ(sin(x)**x, 0, 100, x)\");\nactual = tree.Evaluate(); // 7.4990012... + 0.13462383i...\n\ntree = expressionTreeBuilder.BuildTree(\"lsolve({2, 3; 5i, 14}, {2; -1})+10\");\nactual = tree.Evaluate(); // {10.860258 + 0.46085233i; 10.093162 - 0.30723489i}\n```\n\nUnit conversion example:\n```C#\nvar value = UnitConverter.Convert(23, Length.Inch, Length.Centimeter); // 58.42\n```\n\nMatrix multiplication:\n```C#\nvar a = new CMatrix(new Complex[,] { {2, 3}, {5, 8} });\nvar b = new CMatrix(new Complex[,] { {1, 1}, {18, -1} });\n\nvar result = a * b; // {56, -1; 149, -3}\n```\n\n## Get it on NuGet!\n```\nInstall-Package TAlex.MathCore\nInstall-Package TAlex.MathCore.LinearAlgebra\nInstall-Package TAlex.MathCore.NumericalAnalysis\nInstall-Package TAlex.MathCore.SpecialFunctions\nInstall-Package TAlex.MathCore.Statistics\nInstall-Package TAlex.MathCore.Optimization\nInstall-Package TAlex.MathCore.ExpressionsBase\nInstall-Package TAlex.MathCore.ComplexExpressions\nInstall-Package TAlex.MathCore.ComplexExpressions.Extensions\n```\n\n## License\nMathCore is under the [MIT license](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex-titarenko%2Fmathcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falex-titarenko%2Fmathcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex-titarenko%2Fmathcore/lists"}