/// <summary> /// Intepreting real values of func as X, /// imaginary as Y we iterate on range [from; to] /// </summary> /// <param name="func"></param> /// <param name="from"></param> /// <param name="to"></param> public void PlotIterativeComplex(FastExpression func, ComplexNumber from, ComplexNumber to) { Func <int, double> X = it => func.Call(((from + to) / (pointCount - 1) * it).AsComplex()).Real; Func <int, double> Y = it => func.Call(((from + to) / (pointCount - 1) * it).AsComplex()).Imaginary; BuildData(X, Y); destination.plt.PlotScatter(dataX, dataY); }
/// <summary>Intepreting real values of func as X, imaginary as Y we iterate on range [from; to]</summary> public void PlotIterativeComplex(FastExpression func, Entity.Number.Complex from, Entity.Number.Complex to) { double X(int it) => func.Call(((from + to) / (pointCount - 1) * it).ToNumerics()).Real; double Y(int it) => func.Call(((from + to) / (pointCount - 1) * it).ToNumerics()).Imaginary; BuildData(X, Y); destination.plt.PlotScatter(dataX, dataY); }
/// <summary> /// Plots from an expression over variable x /// </summary> /// <param name="expr"> /// Expression to build /// </param> /// <param name="from"> /// Low bound /// </param> /// <param name="to"> /// High bound /// </param> public void PlotScatter(FastExpression func, ComplexNumber from, ComplexNumber to) { Func <int, double> inner = it => ((to - from) / (pointCount - 1) * it).Real; Clear(); BuildData(inner, it => func.Call(new Complex((double)inner(it), 0)).Real); destination.plt.PlotScatter(dataX, dataY); destination.Render(); }
/// <summary>Plots from an expression over variable x</summary> /// <param name="expr">Expression to build</param> /// <param name="from">Low bound</param> /// <param name="to">High bound</param> public void PlotScatter(FastExpression func, Entity.Number.Complex from, Entity.Number.Complex to) { double inner(int it) => ((to - from) / (pointCount - 1) * it).RealPart.EDecimal.ToDouble(); Clear(); BuildData(inner, it => func.Call(new Complex((double)inner(it), 0)).Real); destination.plt.PlotScatter(dataX, dataY); destination.Render(); }
[Benchmark] public Complex MyCompiled() => complexFunc.Call(ComToSub);
public void RunHard() => toRunHard.Call(toSub);
public void RunMedium() => toRunMedium.Call(toSub);
public void RunEasy() => toRunEasy.Call(toSub);
public void MultiFunc() => multiFunc.Call(3);
[Benchmark] public void MultiFunc() => multiFunc.Call(CToSub);
public void MultiFunc() => multiFunc.Call(CToSub);
public ComplexNumber MyCompiled() => complexFunc.Call(3);