18
1
using System; using AngouriMath; using System.Numerics;
2
3
Entity expr = "e ^ x";
4
var func = expr.Compile<Complex, Complex>("x");
5
Console.WriteLine(func(new Complex(1, 0)));
6
Console.WriteLine(func(new Complex(0, 1)));
7
Console.WriteLine(func(new Complex(1, 1)));
8
9
Entity expr2 = "x + sin(x) + y";
10
var func2 = expr2.Compile<double, double, double>("x", "y");
11
Console.WriteLine(func2(2, 3));
12
13
Entity expr3 = "x > 3 and tan(y) < 6";
14
var func3 = expr3.Compile<double, double, bool>("x", "y");
15
Console.WriteLine(func3(4, 5));
16
Console.WriteLine(func3(2, 5));
17
Console.WriteLine(func3(4, 0));
18
Console.WriteLine(func3(2, 0));
Cached Result
<2.718281828459045; 0>
<0.5403023058681398; 0.8414709848078965>
<1.4686939399158851; 2.2873552871788423>
5.909297426825682
True
False
True
False
<0.5403023058681398; 0.8414709848078965>
<1.4686939399158851; 2.2873552871788423>
5.909297426825682
True
False
True
False