Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim variableX = uc.DefineVariable("x") Dim userExpression = "x * 2 + 5" Dim Total = 0.0 Dim UpperBound = 1000000 '// One million '// Parse the expression just once before the loop begins. Dim parsedExpr = uc.Parse(userExpression ) For x As Double = 1 To UpperBound variableX.Value(x) Total = Total + parsedExpr.Evaluate() Next Console.Write("Sum(1, ") Console.Write(UpperBound) Console.Write(", ") Console.Write(userExpression) Console.Write(") = ") Console.Write(Total) End Sub End Module