## Acid Library

### Code Examples

##### Parsing Functions

ParseSimpleReal- Addition, Subtraction, Multiplication, Division & Brackets

- Addition, Subtraction, Multiplication, Division & Brackets
- Trigonometric Functions & Special Functions

- Addition, Subtraction, Multiplication, Division & Brackets

- Imaginary & Complex Numbers

ParseAdvancedComplex

- Addition, Subtraction, Multiplication, Division & Brackets

- Trigonometric Functions & Special Functions
- Imaginary & Complex Numbers

ParseCustomReal

- Addition, Subtraction, Multiplication, Division & Brackets
- Trigonometric Functions & Special Function
- User-defined equations

ParseCustomComplex

- Addition, Subtraction, Multiplication, Division & Brackets
- Trigonometric Functions & Special Function
- Imaginary & Complex Numbers
- User-defined equations

##### Evaluation Functions

- Addition, Subtraction, Multiplication, Division & Brackets
- Evaluation signs: =, !=, <, >, <=, =>

EvaluateAdvancedReal

- Addition, Subtraction, Multiplication, Division & Brackets
- Trigonometric Functions & Special Functions
- Evaluation signs: =, !=, <, >, <=, =>

- Addition, Subtraction, Multiplication, Division & Brackets

- Imaginary & Complex Numbers
- Evaluation signs: =, !=, <, >, <=, =>

EvaluateAdvancedComplex

- Addition, Subtraction, Multiplication, Division & Brackets

- Trigonometric Functions & Special Functions
- Imaginary & Complex Numbers
- Evaluation signs: =, !=, <, >, <=, =>

EvaluateCustomReal

- Addition, Subtraction, Multiplication, Division & Brackets
- Trigonometric Functions & Special Function
- User-defined equations
- Evaluation signs: =, !=, <, >, <=, =>

EvaluateCustomComplex

- Addition, Subtraction, Multiplication, Division & Brackets
- Trigonometric Functions & Special Function
- Imaginary & Complex Numbers
- User-defined equations
- Evaluation signs: =, !=, <,
>, <=, =>

##### CSharp.Net

After adding a reference to the Acid Library, the following C# Code will calculate any simple mathematical formula, with brackets, addition, subtraction, multiplication and division:

using Acid_Library; ... string formula, result; AcidParser MyParser = new AcidParser("User", "Serial"); formula = "8-(2+2)*(20-2)"; result = MyParser.ParseSimple(formula); |

The following C# Code will calculate advanced expressions as well with both imaginary and complex numbers, including functions such as cosine, sine, tan, log etc...

using Acid_Library; ... string formula, result; AcidParser MyParser = new AcidParser("User", "Serial"); formula = "sin(2+i3)*cos(i3+5)/pi"; result = MyParser.ParseAdvancedComplex(formula); |

The following C# Code will create a custom function named "wow" to calculate the Euclidean Distance between a point(x,y) and the center:

using Acid_Library; ... string formula, result; string nfunction = "wow"; string [] pfunction = new string[2]{"x", "y"}; string efunction = "(x^2+y^2)^0.5"; AcidParser MyParser = new AcidParser("User", "Serial"); MyParser.AddCustomFunction(nfunction,pfunction,efunction); formula = "wow(51;32)"; result = MyParser.ParseCustomReal(formula); |

The following C# Code will evaluate a given expression of
advanced functions and complex numbers to be either true or false.
Supported evaluation operators include =, !=, <, >,
<=, =>
etc..:

using Acid_Library; ... string formula; bool result; AcidParser MyParser = new AcidParser("User", "Serial"); formula = "sin(2+i3)*cos(i3+5)/pi<=cos(i32+3)*3"; result = MyParser.EvaulateAdvancedComplex(formula); |

Download complete CSharp Code Examples.

##### Visual Basic.Net

After adding a reference to the Acid Library, the following VB.Net Code will calculate any simple mathematical formula, with brackets, addition, subtraction, multiplication and division:

Imports Acid_Library ... Dim MyParser As New AcidParser("User", "Serial") Dim formula, result As String formula = "8-(2+2)*(20-2)" result = MyParser.ParseSimple(formula) |

The following VB.Net Code will calculate advanced expressions as well, including cosine, sine, tan, log etc...

Imports Acid_Library ... Dim MyParser As New AcidParser("User", "Serial") Dim formula, result As String formula = "sin(10)*cos(10) / pi" result = MyParser.ParseAdvanced(formula) |

The following VB.Net Code will create a custom function named "wow" to calculate the Euclidean Distance between a point(x,y) and the center:

Imports Acid_Library ... Dim formula, nfunction, efunction As String Dim result As Boolean Dim pfunction(2) As String nfunction = "wow" pfunction(0) = "x" pfunction(1) = "y" efunction = "(x^2+y^2)^0.5" Dim MyParser As New AcidParser("User", "Serial") MyParser.AddCustomFunction(nfunction,pfunction,efunction) formula = "wow(51;32)" result = MyParser.ParseCustomReal(formula) |

The following C# Code will evaluate a given expression of
advanced functions and complex numbers to be either true or false.
Supported evaluation operators include =, !=, <, >,
<=, =>
etc..:

Imports Acid_Library ... Dim formula As String Dim result As Boolean Dim MyParser As New AcidParser("User", "Serial") formula = "sin(2+i3)*cos(i3+5)/pi<=cos(i32+3)*3" result = MyParser.EvaulateAdvancedComplex(formula) |

Download complete Visual Basic.Net Code Examples.

##### Boo.Net

The Acid Library also integrates easily with the Boo Language. Add a reference to the Acid Library, and use the following code to calculate simple mathematical formulas, with brackets, addition, subtraction, multiplication and division:

import Acid_Library ... formula as string = "8-(2+2)*(20-2)" result as string MyParser as AcidParser = AcidParser("User", "Serial") result = MyParser.ParseSimple(formula) |

The following code will be able to run advanced mathematical expressions as well, including cosine, sine, tan, log etc...

import Acid_Library ... formula as string = "sin(10)*cos(10) / pi" result as string MyParser as AcidParser = AcidParser("User", "Serial") result = MyParser.ParseAdvanced(formula) |

The following Boo.Net Code will create a custom function named "wow" to calculate the Euclidean Distance between a point(x,y) and the center:

import Acid_Library ... formula, nfunction, efunction as string result as bool pfunction(2) as string nfunction = "wow" pfunction(0) = "x" pfunction(1) = "y" efunction = "(x^2+y^2)^0.5" MyParser as AcidParser = AcidParser("User", "Serial") MyParser.AddCustomFunction(nfunction,pfunction,efunction) formula = "wow(51;32)" result = MyParser.ParseCustomReal(formula) |

The following C# Code will evaluate a given expression of
advanced functions and complex numbers to be either true or false.
Supported evaluation operators include =, !=, <, >,
<=, =>
etc..:

import Acid_Library ... formula as string Dim result As bool MyParser as AcidParser = AcidParser("User", "Serial") formula = "sin(2+i3)*cos(i3+5)/pi<=cos(i32+3)*3" result = MyParser.EvaulateAdvancedComplex(formula) |

Download complete Boo.Net Code Examples.

##### Additional Information

If you're searching for more information or code examples please view The Math Parser Manual or email our support team.