All Projects → asc-community → Angourimath

asc-community / Angourimath

Licence: mit
Open-source symbolic algebra library for C# and F#. One of the most powerful in .NET

Programming Languages

csharp
926 projects

Projects that are alternatives of or similar to Angourimath

Nerdamer
a symbolic math expression evaluator for javascript
Stars: ✭ 322 (+21.05%)
Mutual labels:  latex, integration, math, algebra, solver, calculus
Algebra Latex
Parse and calculate latex formatted math
Stars: ✭ 20 (-92.48%)
Mutual labels:  latex, parse, math, algebra
Mather
zzllrr mather(an offline tool for Math learning, education and research)小乐数学,离线可用的数学学习(自学或教学)、研究辅助工具。计划覆盖数学全部学科的解题、作图、演示、探索工具箱。目前是演示Demo版(抛转引玉),但已经支持数学公式编辑显示,部分作图功能,部分学科,如线性代数、离散数学的部分解题功能。最终目标是推动专业数学家、编程专家、教育工作者、科普工作者共同打造出更加专业级的Mather数学工具
Stars: ✭ 270 (+1.5%)
Mutual labels:  math, algebra, solver
Symja android library
☕️ Symja - computer algebra language & symbolic math library. A collection of popular algorithms implemented in pure Java.
Stars: ✭ 170 (-36.09%)
Mutual labels:  algebra, computer-algebra, calculus
desktop
Extendable calculator for the 21st Century ⚡
Stars: ✭ 85 (-68.05%)
Mutual labels:  parse, parsing, math
Newton Api
➗ A really micro micro-service for advanced math.
Stars: ✭ 358 (+34.59%)
Mutual labels:  math, algebra, calculus
Grassmann.jl
⟨Leibniz-Grassmann-Clifford⟩ differential geometric algebra / multivector simplicial complex
Stars: ✭ 289 (+8.65%)
Mutual labels:  math, algebra, computer-algebra
Reduce.jl
Symbolic parser generator for Julia language expressions using REDUCE algebra term rewriter
Stars: ✭ 172 (-35.34%)
Mutual labels:  math, algebra, computer-algebra
Gap
Main development repository for GAP - Groups, Algorithms, Programming, a System for Computational Discrete Algebra
Stars: ✭ 447 (+68.05%)
Mutual labels:  math, algebra, computer-algebra
Mathematics for Machine Learning
Learn mathematics behind machine learning and explore different mathematics in machine learning.
Stars: ✭ 28 (-89.47%)
Mutual labels:  calculus, algebra, math
LeagueReplayParser
C# library which can read some data from a .rofl file, and start a replay in the client. (no longer actively maintained)
Stars: ✭ 20 (-92.48%)
Mutual labels:  parse, parsing, nuget
symengine.rb
Ruby wrappers for SymEngine
Stars: ✭ 26 (-90.23%)
Mutual labels:  math, computer-algebra
maths-for-deep-learning-ai
A open source book covering the foundational maths of deep learning and machine learning using TensorFlow
Stars: ✭ 35 (-86.84%)
Mutual labels:  calculus, math
Hecke.jl
Computational algebraic number theory
Stars: ✭ 142 (-46.62%)
Mutual labels:  math, computer-algebra
calculus-notes
微积分学笔记,包含极限论、微分、积分、级数理论.
Stars: ✭ 67 (-74.81%)
Mutual labels:  calculus, math
HCubature.jl
pure-Julia multidimensional h-adaptive integration
Stars: ✭ 119 (-55.26%)
Mutual labels:  integration, math
hfmath
Render LaTeX math with Hershey Fonts
Stars: ✭ 76 (-71.43%)
Mutual labels:  latex, math
bcmath-extended
Extends php BCMath lib for missing functions like floor, ceil, round, abs, min, max, rand for big numbers. Also wraps existing BCMath functions.
Stars: ✭ 59 (-77.82%)
Mutual labels:  math, arbitrary-precision
Symbolic-computation-Python
Symbolic computation using SymPy and various applications
Stars: ✭ 18 (-93.23%)
Mutual labels:  calculus, algebra
OpenGraph-Net
.Net Open Graph Parser written in C#
Stars: ✭ 111 (-58.27%)
Mutual labels:  parse, nuget

AngouriMath logo

AngouriMath

New, leading symbolic algebra library in .NET. Everything one would need.
Download ( C# , F# ) · Examples · Contributions · What's new · Official website

GitHub Workflow Status (event) Codecov Nuget (with prereleases) Nuget Discord

What is it about?

AngouriMath now supports Jupyter integration

AngouriMath is an open source symbolic algebra library. That is, via AngouriMath, you can automatically solve equations, systems of equations, work with sets, differentiate, parse from string, compile expressions.

It is not a CAS, so you can use it in any your project by installing it from NuGet. AngouriMath can be used in calculators, algebra systems, educational/quiz apps, graphics, TeX rendering applications, etc.

It is free to use even in commercial projects. We work on it a lot, so your requests on issues are likely to be considered within a few hours.

Finally, if still not sure about it, you can try it even before installation! | Try live | |:--------:| || ||

Quick start

  1. Install AngouriMath from NuGet.
  2. Write the following code:
using AngouriMath; using System;
Entity expr = "x + sin(y)";
Console.WriteLine(expr);
  1. Run.

More detailed Quick Start.

If you are new to AM, we suggest you checking out some samples instead of reading boring documentation. If you want to contribute, we would be happy to welcome you in our community.

For any questions, feel free to contact us via Discord.

Official website: am.angouri.org.

Examples

Expand any section to see. Examples with live shell are on the website.

Computations

Use as a simple calculator:

Entity expr = "1 + 2 * log(3, 9)";
Console.WriteLine(expr.EvalNumerical());
Console.WriteLine("2 / 3 + sqrt(-16)".EvalNumerical());
>>> 2 / 3 + 4i
Console.WriteLine("(-2) ^ 3".EvalNumerical());

Build expressions with variables and substitute them:

Entity expr = "2x + sin(x) / sin(2 ^ x)";
var subs = expr.Substitute("x", 0.3m);
Console.WriteLine(subs);

Simplify complicated expressions:

Console.WriteLine("2x + x + 3 + (4 a * a^6) / a^3 / 5".Simplify());
var expr = "1/2 + sin(pi / 4) + (sin(3x)2 + cos(3x)2)";
Console.WriteLine(expr.Simplify());

Compiled functions work 15x+ faster

var x = MathS.Variable("x");
var expr = MathS.Sin(x) + MathS.Sqrt(x) / (MathS.Sqrt(x) + MathS.Cos(x)) + MathS.Pow(x, 3);
var func = expr.Compile(x);
Console.WriteLine(func.Substitute(3));
var expr = "sin(x) + sqrt(x) / (sqrt(x) + cos(x)) + x3";
var compiled = expr.Compile("x");
Console.WriteLine(compiled.Substitute(4));
Algebra

Start with boolean algebra:

Entity expr1 = "a and b or c";

// Those are the same
Entity expr3 = "a -> b";
Entity expr3 = "a implies b";
Entity expr = "a -> true";
Console.WriteLine(MathS.SolveBooleanTable(expr, "a"));
>>> Matrix[2 x 1]
>>> False
>>> True

Next, solve some equations:

Console.WriteLine("x2 + x + a".SolveEquation("x"));

Under developing now and forever (always available)

Entity expr = "(sin(x)2 - sin(x) + a)(b - x)((-3) * x + 2 + 3 * x ^ 2 + (x + (-3)) * x ^ 3)";
Console.WriteLine(expr.SolveEquation("x").Latexise());

Try some inequalities:

Console.WriteLine("(x - 6)(x + 9) >= 0".Solve("x"));

Systems of equations:

var system = MathS.Equations(
    "x2 + y + a",
    "y - 0.1x + b"
);
Console.WriteLine(system);
var solutions = system.Solve("x", "y");
Console.WriteLine(solutions);

System:

Result:

var system = MathS.Equations(
    "cos(x2 + 1)^2 + 3y",
    "y * (-1) + 4cos(x2 + 1)"
);
Console.WriteLine(system.Latexise());
var solutions = system.Solve("x", "y");
Console.WriteLine(solutions);
(solution matrix is too complicated to show)
Calculus

Find derivatives:

Entity func = "x2 + ln(cos(x) + 3) + 4x";
Entity derivative = func.Differentiate("x");
Console.WriteLine(derivative.Simplify());

Find limits:

WriteLine("(a x2 + b x) / (e x - h x2 - 3)".Limit("x", "+oo").InnerSimplified);

Find integrals:

WriteLine("x2 + a x".Integrate("x").InnerSimplified);
Sets

There are four types of sets:

WriteLine("{ 1, 2 }".Latexise());
WriteLine("[3; +oo)".Latexise());
WriteLine("RR".Latexise());
WriteLine("{ x : x8 + a x < 0 }".Latexise());

And there operators:

WriteLine(@"A \/ B".Latexise());
WriteLine(@"A /\ B".Latexise());
WriteLine(@"A \ B".Latexise());
Syntax

You can build LaTeX with AngouriMath:

var expr = "x ^ y + sqrt(x) + integral(sqrt(x) / a, x, 1) + derive(sqrt(x) / a, x, 1) + limit(sqrt(x) / a, x, +oo)";
Console.WriteLine(expr.Latexise());
>>> {x}^{y}+\sqrt{x}+\int \left[\frac{\sqrt{x}}{a}\right] dx+\frac{d\left[\frac{\sqrt{x}}{a}\right]}{dx}+\lim_{x\to \infty } \left[\frac{\sqrt{x}}{a}\right]

You can parse Entity from string with

var expr = MathS.FromString("x + 2 + sqrt(x)");
Entity expr = "x + 2 + sqrt(x)";

A few convenient features: x2 => x^2, a x => a * x, (...)2 => (...)^2, 2(...) => 2 * (...)

Compilation

Now you can compile expressions with pritimives into native lambdas. They will be at least as fast as if you wrote them in line in code, or faster if you have same subexpressions in your expression.

Entity expr = "a and x > 3";
var func = expr.Compile<bool, double, bool>("a", "x");
WriteLine(func(true, 6));
WriteLine(func(false, 6));
WriteLine(func(true, 2));
WriteLine(func(false, 2));

Output:

True
False
False
False
F#

Download

Not everything is supported directly from F#, so if something missing, you will need to address that functional from AngouriMath.

open Functions
open Operators
open FromToString


solve "x" "x + 2 = 0"

simplify (solve "x" "x2 + 2 a x + a2 = 0")

differentiate "x" "x2 + a x"

integrate "x" "x2 + e"

limit "x" "0" "sin(a x) / x"

"sin(a x) / x" &&& "x" --> 0

latex "x / e + alpha + sqrt(x) + integral(y + 3, y, 1)"
AM in Jupyter

If you already installed Jupyter and Interactive for it, install package by copying this to your first cell:

#r "nuget:AngouriMath.Interactive, *-*"
Interactive.magic();

Now any ILatexiseable will be displayed as LaTeX:

Check the F# and C# samples.

Multithreading

You are guaranteed that all functions in AM run in one thread. It is also guaranteed that you can safely run multiple functions from AM in different threads, that is, all static variables and lazy properties are thread-safe.

There is also support of cancellation a task. However, to avoid injecting the cancellation token argument into all methods, we use AsyncLocal<T> instead. That is why instead of passing your token to all methods what you need is to pass it once to the MathS.Multithreading.SetLocalCancellationToken(CancellationToken) method.

There is a sample code demonstrating cancellation:

var cancellationTokenSource = new CancellationTokenSource();

// That goes instead of passing your token to methods
MathS.Multithreading.SetLocalCancellationToken(cancellationTokenSource.Token);

// Then you normally run your task
var currTask = Task.Run(() => InputText.Text.Solve("x"), cancellationTokenSource.Token);

try
{
    await currTask;
    LabelState.Text = currTask.Result.ToString();
}
catch (OperationCanceledException)
{
    LabelState.Text = "Operation canceled";
}

Contribution

We appreciate and welcome any contributors to AngouriMath. Current tasks can be tracked on this page.

Use pull requests to contribute to it. We also appreciate early pull requests so that we know what you are improving and can help you with something.

Documentation for contributors and developers is here.

License

GitHub

The project is open source, but can be used in closed commercial projects. There is no restriction on it with the only requirement to keep the MIT license with all distributives of AngouriMath.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].