Nancy.Expressions
Nancy.Expressions is a new library built on top of Nancy. While Nancy is meant to perform the operations as you write them in code, Nancy.Expressions is designed to represent a complex expression, allowing you to manipulate, visualize and simplify it before running its computation.
Nancy vs Nancy.Expressions​
To make it easy to adopt, the syntax of the two libraries is very similar.
The main differce is the switch from Curve
to Expressions
as the type to use to call methods, and that you have to manually call Compute()
to have the result.
var f = new Curve(
<constructor arguments for f>
);
var g = new Curve(
<constructor arguments for g>
);
var f_sac = f.SubAdditiveClosure();
var conv = Curve.Convolution(f_sac, g);
var result = Curve.Deconvolution(conv, f_sac);
var f = Expressions.FromCurve(
curve: new Curve(
<constructor arguments for f>
);
var g = Expressions.FromCurve(
curve: new Curve(
<constructor arguments for g>
);
var f_sac = f.SubAdditiveClosure();
var conv = Expressions.Convolution(f_sac, g);
var deconv = Expressions.Deconvolution(conv, f_sac);
var result = deconv.Compute();
Works like an extension​
When you call Compute()
, the usual Nancy algorithms are used to compute your expression, and a Curve or a Rational is returned.
So you can still do all you were doing with Nancy, but with a some more tools that work at the expression level.