News for hackers. Stuff that matters.
Re:Symbolic Algebraic Library written entirely in C# by tomdre on Saturday October 07, 2017 @11:52PM (#15426901)
I worked with GiNaC https://www.ginac.de/ and noticed that the bottleneck was variable substitutions, e.g., replace a variable with a constant and simplify the expression. I'm still dreaming of an efficient CAS.
Re:Symbolic Algebraic Library written entirely in C# by dsharlet on Sunday October 08, 2017 @12:17AM (#15426957)
https://github.com/dsharlet/ComputerAlgebra (disclaimer: my project) might do what you want, it lets you manipulate expressions and then compile them to "native" .net functions that can be evaluated with high performance.
Re:Symbolic Algebraic Library written entirely in C# by tomdre on Sunday October 08, 2017 @12:38AM (#15426994)
Thanks! I'll have a look at it for sure. During my phd I developed a tool for reachability analysis of polynomial dynamical systems https://github.com/dreossi/sapo I needed expression manipulation to compute Bernestein coefficients of polynomials
Re:Symbolic Algebraic Library written entirely in C# by ibluesun on Sunday October 08, 2017 @08:25AM (#15427943)
after parsing the symbolic calculations you can execute them as a normal function call

in case of single variable for example var result = SymbolicVariable.Parse("sin(3*x)").Execute(2);

in case of multi variables you can send the values based on their alphabet order

var d = SymbolicVariable.Parse("a^b^c"); Assert.AreEqual("a^(b^c)", d.ToString());

var r = d.Execute(3, 2, 4); Assert.AreEqual(43046721.0, r);

or by assigning them to a dictionary of Dictionary<string, double>

Re:Symbolic Algebraic Library written entirely in C# by Clubber on Saturday October 07, 2017 @11:18PM (#15426829)
FYI, small typo in the last line of your README.

vap p = SymbolicVariable.Parse("(sin(x)^3+cos(x)^5-x^3*y-3) | x");

should be

var p = ...

Re:Symbolic Algebraic Library written entirely in C# by ahmgeek on Sunday October 08, 2017 @05:29AM (#15427558)
thanks, your PR gonna be merged soon.
Re:Symbolic Algebraic Library written entirely in C# by naasking on Sunday October 08, 2017 @09:25AM (#15428098)
I wrote a simple algebra system in C# [1] that uses term rewriting expressed as algebraic identities to simplify terms. You can then compile them to .NET functions for efficient execution.

It uses a recursion limit, but I sketched out a design that eliminates the need for it by use of a specific data structure as used in the Simplify theorem prover to ensure termination in the presence of rewriting. Haven't gotten around to it unfortunately.

[1] https://github.com/naasking/Algebra.NET

Re:Symbolic Algebraic Library written entirely in C# by runald on Sunday October 08, 2017 @10:39AM (#15428369)
You forgot to include [1], I think.
Re:Symbolic Algebraic Library written entirely in C# by naasking on Sunday October 08, 2017 @11:02AM (#15428457)
Ha, thanks, fixed!
Re:Symbolic Algebraic Library written entirely in C# by NonEUCitizen on Saturday October 07, 2017 @07:01PM (#15426158)
What is the license for this? Thanks.
Re:Symbolic Algebraic Library written entirely in C# by ahmgeek on Sunday October 08, 2017 @05:18AM (#15427535)
The author of this is my friend, I told him as most of his projects has no licenses. He's going to add them soon, my hunch says it will be MIT, meanwhile feel free to open issue in the repo to tell him.
Re:Symbolic Algebraic Library written entirely in C# by colejohnson66 on Sunday October 08, 2017 @05:03AM (#15427519)
There isn’t one, so legally it’s illegal to use
Re:Symbolic Algebraic Library written entirely in C# by kwhitefoot on Sunday October 08, 2017 @07:04AM (#15427765)
Sez who?
Re:Symbolic Algebraic Library written entirely in C# by kittiepryde on Sunday October 08, 2017 @08:41AM (#15427984)
Copyright law
Re:Symbolic Algebraic Library written entirely in C# by dharmatech on Sunday October 08, 2017 @10:36AM (#15428354)
Nice!

Does it feature equation solving, variable elimination, etc? See for example:

https://gist.github.com/dharmatech/a5e74ef03d98b3ff1c45

Re:Symbolic Algebraic Library written entirely in C# by ibluesun on Sunday October 08, 2017 @01:49PM (#15429147)
are you trying to solve system of linear equations ?!!
Re:Symbolic Algebraic Library written entirely in C# by dharmatech on Sunday October 08, 2017 @03:26PM (#15429550)
That system of equations contains quadratic equations.
Re:Symbolic Algebraic Library written entirely in C# by gravypod on Sunday October 08, 2017 @07:32AM (#15427830)
Do you plan on supporting latex math expressions? That way we can visualize and run the same functions so we can make sure there is no typo.
Re:Symbolic Algebraic Library written entirely in C# by ibluesun on Sunday October 08, 2017 @08:27AM (#15427945)
I know latex expressions .. but I don't know exactly how do you want to merge them.

a use case would be helpful for me.

Re:Symbolic Algebraic Library written entirely in C# by gravypod on Sunday October 08, 2017 @10:17AM (#15428287)
Suppose I find a paper submitted to a conference. The conference lets me download the original latex source of the paper. If I want to take the function they wrote out and take the derivative of it I'd currently have to rewrite the expression. Unfortunately this is very risky with extremely large and complex functions. Ideally it would be cool to just copy a latex expression into your "SymbolicVariable.Parse" method and tell it that it's written in LaTeX.

Copy and paste has a much lower chance to incur errors than rewriting an expression.

Re:Symbolic Algebraic Library written entirely in C# by ibluesun on Sunday October 08, 2017 @01:38PM (#15429103)
well I think that would be another layer before sending this to parser

so we can convert the latex expression and send it to the library after that .. I guess it is doable if we are limiting ourself to the math expressions only.

Re:Symbolic Algebraic Library written entirely in C# by qubex on Sunday October 08, 2017 @03:13PM (#15429475)
My hard-earned lesson is that representation and manipulation should not be commingled. Traditional mathematical notation is too irregular and idiosyncratic to be safely handled by a symbolic mathematics system. That’s part of the reason why a trained eye can almost always spot the output of a CAS because though correct it almost always expresses stuff in vaguely ’mechanistic’ and/or longwinded ways.

Mentioned elsewhere: I built an (incomplete) implementation of the Risch algorithm for symbolic integration and slapped a MathML-parsing front end on it, and frequently ran into ambiguous cases where the ”abstract syntax” of the purported integral wasn’t what any sane human mathematician would think it could be, yet these errors were self-consistent (limits on double- and higher integrals being circumstances that constantly vexed me).

No, don’t suggest or try doing both of these things in the same place. Keep them separate. It’s just basic software architecture.

Re:Symbolic Algebraic Library written entirely in C# by qubex on Sunday October 08, 2017 @10:02AM (#15428226)
Trying to support cool MathML syntax (and failing) in my (partial) implantation for symbolic integration using the Risch algorithm got me banned on Twitter by Nassim Nicholas Taleb. True story.
Re:Symbolic Algebraic Library written entirely in C# by studentik on Sunday October 08, 2017 @05:11AM (#15427528)
smath.info is much more advanced
Re:Symbolic Algebraic Library written entirely in C# by ibluesun on Sunday October 08, 2017 @08:29AM (#15427947)
you can check my opensource project that seems to make the same as smath

it is called Quantity System http://QuantitySystem.org

and it blends numerical and symbolic in the same context and it supports units in the context of quantities

check the specs and tell me your opinion.

Re:Symbolic Algebraic Library written entirely in C# by kwhitefoot on Sunday October 08, 2017 @07:08AM (#15427776)
SMath Studio is an application not a library.