Ejemplo n.º 1
0
 static void _Main(string[] args)
 {
     while (true)
     {
         System.Console.Write("Wpisz no działanie: ");
         Calc.Equation eq = new Calc.Equation(System.Console.ReadLine());
         System.Console.WriteLine(eq.Calculate());
         System.Console.WriteLine(eq.Integrate("var", -2, 2, 0.00001, Calc.Equation.IntegrationMode.Rectangle));
         System.Console.WriteLine(eq.Integrate("var", -2, 2, 0.00001, Calc.Equation.IntegrationMode.Trapezoid));
         //System.Console.WriteLine("Rect: " + eq.Integrate("var", 0, 1, 0.0001));
         //System.Console.WriteLine("Trap: " + eq.Integrate("var", 0, 1, 0.0001, Calc.Equation.IntegrationMode.Trapezoid));
     }
     System.Console.ReadKey(true);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Calculates equation represented on the equationString.
        /// </summary>
        /// <param name="equationString">Represents the equation to calculate.</param>
        /// <returns></returns>
        public static double Calculate(string equationString)
        {
            Equation equation = new Equation(equationString);

            return(equation.Calculate());
        }