Skip to main content

Posts

Showing posts from August, 2015

Algebra.NET: A Simple Algebra eDSL for .NET

Algebra.NET is a simple library designed to facilitate easy expression and manipulation of algebraic functions. For instance, here's a simple function: Function<Func<double, double>> a = Algebra.Function(x => 2 * x + 1); We can compile such a function to efficient IL:Func<double, double> func = a.Compile("times2plus1"); Or we can apply some algebraic identities to rewrite it:Identity associative = Algebra.Identity(x => x + 1 == 1 + x); Identity mulEqAdd = Algebra.Identity(x => 2 * x == x + x); Console.WriteLine(a); Console.WriteLine(a.Rewrite(1, associative, mulEqAdd)); // Prints: // ((2 * x) + 1) // (1 + (x + x)) Rewrites can sometimes loop forever (consider "x + y == y + x"), so the Rewrite method takes a number indicating the maximum number of iterations to perform all the rewrites.All the usual arithmetic operations are available, including an extension method for exponentiation:var f = Algebra.Function(x => x.Pow(3)); Console…

Sasa v0.17.0 Released

A few new features in this release, and a few bugfixes and enhancements in MIME parsing. As before, the online docs are available on my site, the full release including experimental assemblies on Sourceforge, and the production assemblies on Nuget. The changelog: * sasametal can now replace columns and FK associations with enums that are provided separately * sasametal can now output an interface file, which generates an interface describing the database entities * many MIME fixes thanks to a few bug reports on Sasa discussion list * added System.Data, which provides useful extensions to ADO.NET and IQueryable, like a simple interface for batched SQL queries * MIME parser now accepts an optional parsing parameter that controls various parsing options, like how strict e-mail address formatting accepted, and whether HTML views should be parsed into MailMessage.Body * added enum as a primitive to Sasa.Dynamics IReducer and IBuilder * fixed Sasa.Enums.IsSequential ch…