asc-community / AngouriMath

New open-source cross-platform symbolic algebra library for C# and F#. Can be used for both production and research purposes.
https://am.angouri.org
MIT License
783 stars 74 forks source link

Let's compare ourselves to alternatives... #184

Open Happypig375 opened 4 years ago

Happypig375 commented 4 years ago
### .NET https://github.com/mathnet/mathnet-symbolics - Is most popular .NET computer algebra library - Written in F# (less code to maintain but harder for outsiders to contribute) - Has sec, csc, asec, acsc, hyperbolic and abs nodes plus some special functions but no factorials (ha) - Separates ComplexInfinity from Undefined - Can output MathML but splits simplify, collapse and expand into 3 separate modules (bruh) - No limits nor arbitrary-precision arithmetic https://github.com/dharmatech/Symbolism - Supports boolean algebra but can't parse expressions from string - Only algebra, no calculus - No arbitrary-precision arithmetic and separates floating-points from fractions - Doesn't even have an arccosine function (https://github.com/dharmatech/Symbolism/issues/12) - Has more stars and watchers but less NuGet downloads (lol)

https://github.com/sympy/sympy

### JavaScript and friends https://github.com/davidedc/Algebrite - Has integration, summation, product, erf.. but no limits (ha) - CoffeeScript? Not TypeScript -1 - Availability of functions is not bad https://github.com/aantthony/javascript-cas - Is dead - Is GPL https://github.com/MatthewJA/Coffeequate - Is dead - Very basic, no trig - Symbolic constants need to be prepended by a backslash (no one wants that) https://github.com/nicolewhite/algebra.js - A waste of 1.3k stars - No trig again - Has summation though https://github.com/jiggzson/nerdamer - Can do limits, differentiation, calculus and even trig integral functions - Fake arbitrary precision (aka only double precision but shows 100 digits so asin(1)*2 is only correct to ~15 digits) - Availability of functions is not bad

There are probably more out there...

WhiteBlackGoose commented 4 years ago

Nice! You compiled a long list.

SymPy I guess is half-way, the goal is WolframAlpha. For example, recently I wanted to see how SymPy solves a trigonometric equation and guess what? It couldn't solve it. I think SymPy is rather a mess of genious mathematical ideas mixed into something that works sometimes. Of course, we're still far from that, but it might be not the finish-line for us :).

I think we can indeed surpass Math.Net, even if it's so popular and etc. We can integrate things way faster than big boys.

Thank you for the list again, mb we will add some more to it.

MomoDeve commented 4 years ago

sec, csc, asec, acsc

useless functions. They exist because someone was so stupid to suggest sin^-1(x) mean other than power. Why not have asin, acos, atan, acot as inverse functions and write 1/sin 1/cos and etc?

Supports boolean algebra but can't parse expressions from string

We also support it, doesn't we? @WhiteBlackGoose lol it was in our old website codebase

Has more stars and watchers but less NuGet downloads (lol)

Nuget downloads also come from CI systems so its hard to judge how many people use the library

https://github.com/sympy/sympy This is our dream to reach

Actually we noticed that sympy cannot solve 4-th degree polynoms with non-numeric constants and trigonometric equations like sin(2x + 2) + sin(x + 1) - a

WhiteBlackGoose commented 4 years ago

Also I think we gotta dig deeper into our alternative's simplification algorithms, because even though I've been working on it since AM's start, it seems to suck 😢

@MomoDeve you're probably referring to this https://github.com/WhiteBlackGoose/asc-community/blob/master/ascsite/Core/AscSci/AscMath/BoolEng.cs

Happypig375 commented 4 years ago

C# 9 will come with Visual Studio 16.7 and with the and, or, not patterns, records, and covariant returns I'll refactor AngouriMath into a much cleaner state.

WhiteBlackGoose commented 4 years ago

In what way you want to refactor it?

Happypig375 commented 4 years ago

From Discord

So I've been thinking of replacing Pattern objects with C# Patterns because they are type-unsafe and replacing Entity.Children with properties that match the functions, e.g. Logf as a class has Base and Num as properties

Happypig375 commented 4 years ago

They exist because someone was so stupid to suggest sin^-1(x) mean other than power.

Just wait till you see https://en.wikipedia.org/wiki/Versine and https://en.wikipedia.org/wiki/Exsecant

Nuget downloads also come from CI systems so its hard to judge how many people use the library

Stars and watchers also don't translate to actual uses. People could leave a star then go onto other projects to star. There doesn't seem to be a better metric to use.

WhiteBlackGoose commented 4 years ago

Stars and watchers also don't translate to actual uses. People could leave a star then go onto other projects to star. There doesn't seem to be a better metric to use.

Of course, we do not judge by any of those numbers, but they enourage us to keep working on AM.

Happypig375 commented 4 years ago

Why not have asin, acos, atan, acot as inverse functions and write 1/sin 1/cos and etc?

@WhiteBlackGoose Why did we skip sec and csc but kept cot? cot(x) = 1/tan(x) so there is an inconsistency here.

WhiteBlackGoose commented 4 years ago

We don't have a separate node for sec and csc, but so far I don't see the reason we should have it. It's not hard to implement them though

Happypig375 commented 4 years ago

But cot falls into the same bucket as sec and csc in that they are inverted tan, cos, sin respectively so why did we keep cot as a node?

WhiteBlackGoose commented 4 years ago

Not really the same "bucket". Tan and cot are opposite on the triangle but symmetric. The same way sin and cos are. While sec and csc are way more rarely used & are inverted (as ^(-1)) of sine and cosine, so I didn't think we really need them

Happypig375 commented 4 years ago

Well, cot, sec and csc are grouped together in almost all results in https://www.google.com.hk/search?sxsrf=ALeKk02Dx9VrJJlM3TQ7UWB55MqEtwYGHA%3A1596606585051&source=hp&ei=eUgqX7lzluv5Bt6TncgB&q=is+cot+more+used+than+sec&btnK=Google+Search

Happypig375 commented 4 years ago

When we say "trigonometric functions", we either mean the 3-function group (sin, cos, tan) or the 6-function group (sin, cos, tan, cot, sec, csc). The 3-function group is taught in basic Trigonometry classes and are the group present in basic calculators. The 6-function group is taught in basic Calculus classes and are the group used in Wikipedia, on the Windows calculator, Wolfram Alpha, etc.

I have never heard of the 4-function group (sin, cos, tan, cot) excluding sec and csc until now. If we use the definition of trig functions in basic Trigonometry classes, we would not simplify 1/sin, 1/cos and 1/tan. If we use the definition of trig functions in basic Calculus classes, we would simplify 1/sin, 1/cos, 1/tan to csc, sec and cot respectively. However, with our current definition, we would see 1/sin, 1/cos and cot respectively. This is confusing behaviour and we should pick a side.

WhiteBlackGoose commented 4 years ago

I see where you came from, and yes, I'm surely more used to what you call "4-function group". But I think we still can add secant and cosecant as nodes

MomoDeve commented 4 years ago

I am just afraid that existance of many trigonometrc functions will complicate trigonometric solver and simlificator. We of course can do substitution right at the beginnig of solving, but its a weird solution

WhiteBlackGoose commented 4 years ago

https://github.com/axkr/symja_android_library this might be also worth consideration

Happypig375 commented 4 years ago

Ewwwwww GPL

MomoDeve commented 4 years ago

https://github.com/axkr/symja_android_library this might be also worth consideration

Cannot solve 2^x + 4^x + c, bruh