EquTranslator.Net.x86 4.1.264

dotnet add package EquTranslator.Net.x86 --version 4.1.264                
NuGet\Install-Package EquTranslator.Net.x86 -Version 4.1.264                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EquTranslator.Net.x86" Version="4.1.264" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EquTranslator.Net.x86 --version 4.1.264                
#r "nuget: EquTranslator.Net.x86, 4.1.264"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EquTranslator.Net.x86 as a Cake Addin
#addin nuget:?package=EquTranslator.Net.x86&version=4.1.264

// Install EquTranslator.Net.x86 as a Cake Tool
#tool nuget:?package=EquTranslator.Net.x86&version=4.1.264                

EquTranslator.Net is fast and compact math parser/evaluator with pre-build feature and user-friendly interface. It uses recursive descent and operator precedence rules to parse and evaluate run-time defined strings as math expressions.

Valid math expressions should consist of : � Variables should start from a letter and be no more than 32 characters long. The math expression may have unlimited number of variables. � Arithmetic operations : +, -, *, / , ^. � Functions - set of predefined functions: : abs(x), acos(x), asin(x), atan(x), ceil(x), cos(x), cosh(x), exp(x), floor(x), J0(x), J1(x), ln(x), log10(x), sin(x), sinh(x), sqrt(x), tan(x), tanh(x), Y0(x), Y1(x). Also, users can define their own function to improve performance and extend functionality.

The main characteristics of EquTranslator.Net : � Extremely fast. � Friendly interface and error handling support. � Safe Multithreading. � Supports unlimited number of variables. � Can be extended by user defined functions. � Target platform : x86 and x64.

using System;
using EMS.Math.Equ;	//Namespace to use EqTranslator

namespace Equ.Net_Demo
{
    class Program
    {
        //User defined function
        static double pow3(double x)
        {
            return x * x * x;
        }

       unsafe static void Main(string[] args)
        {
            string mathExp = "1.2e-3+x+2.3*(1-sin(y/3.14)^2)-z";
            string varList = "x,y,z";
            double[] data = new double[] { 1, 2.5, 1.7e-2 };
            double res = default(double);

            //Initialize EquTranslator algorithm first
            Translator equ = new Translator();

            try
            {
                /*************************************************************
                Evaluate math expression for a given point "data"
                Arguments:
		mathExpression – math expression as string to be evaluated.
		varList – coma separated list of named variable. For example” “x,y,z”.
		arguments – array of values for a given varList. First element in the array
		corresponds to first named variable in varList, second to second...
		Return:
		Result of evaluation.
		**************************************************************/
                res = equ.Evaluate(mathExp, varList, data);


                data[0] = 2.3; data[1] = -5;

                res = equ.Evaluate("x/y+(x^2-y^2)", "x,y", data);

                /***********************************************************************          
                Add user defined function to EquTranslator.
		Arguments:
		funcName - name of the function as string. This name must be used in math expression.
		pFunction - pointer to user defined function.
                ************************************************************************/
                equ.AddFunction("p3", pow3);


                //Calculate a set of points for one math expression
                //Build it first
                /************************************************************************
		The function prepares math expression but doesn’t evaluate it.
		It should be used when the same math expression must be evaluated 
                for a large set of points. If number of points is small (not more than 10)
                 function “Evaluate()” may work faster.
		Arguments:
		mathExpression – math expression as string to be parsed.
		varList – coma separated list of named variable. For example” “x,y,z”.
		*************************************************************************/
                equ.Build("3.14*p3(x)+sin(y)-sqrt(z+x)", "x,y,z");

                res = 0;
                for (int i = 0; i < 1000; i++)
                {
                    data[0] = data[0] + 1;
                    data[1] = i + 1;
                    data[2] = data[0] / data[1];
                    //Do calculation for a given point
                    /**********************************************************************
                    The function evaluates math expression prepared by “Build(…)” 
                    for the given values.
                    Arguments:
                    arguments – array of values for a varList in “Build(…)”.
                    ***********************************************************************/
                    res += equ.CalcFor(data);
                }

                //****************************************************
                // Memory for data must be pinned in order to use 
                // "Compile" and "Run" functions.
		// Also, the code must defined as unsafe
                double* pinData = stackalloc double[3];               
               
		/***********************************************************************
		The function prepares math expression but doesn’t evaluate it.
		This method should be used when the same math expression must be 
                evaluated for a large set of points. If number of points is small 
                function “Evaluate()” may work faster.
		Arguments:
		mathExpression – math expression as string to be parsed.
		varList – coma separated list of named variable. For example” “x,y,z”.
		arguments – array of values for a varList.
		***********************************************************************/
                equ.Compile(mathExp, varList, pinData);

                res = 0;
                for (int i = 0; i < 1000; i++)
                {
                    pinData[0] = pinData[0] + 1;
                    pinData[1] = i + 1;
                    pinData[2] = pinData[0] / data[1];
                    /**************************************************************************
                    The function evaluates math expression prepared by “Compile(…)” for the values 
		    in pinData.
                    Arguments:
                    arguments – array of values for a varList in “Build(…)”.
                    ***************************************************************************/
                    res += equ.Run();
                }

                //****************************************************
                //Negative test
                
                /**********************************************************************
		Remove user defined function from EquTranslator.
		Arguments:
		funcName - name of the function as a string.
		**********************************************************************/
                equ.RemoveFunction("p3");

                res = equ.Evaluate("3.14*p3(x)+sin(y)-sqrt(z+x)", "x,y,z", data);
            }
            catch (TranslatorException ex)
            {
                Console.WriteLine(ex.ErrorCode);
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.ErrorPosition);
            }

            return;
        }
    }
}
Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.8

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.1.264 389 2/26/2021
4.0.101 499 11/16/2019