Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var read  = new Cmd();
            var write = new Printer();

            while (read != Cmd.Quit)
            {
                write.Line(Out.Ready);

                switch (Parser.GetCmd(Console.ReadLine()))
                {
                case Cmd.Help: Help.EnumerateCmds(); break;

                case Cmd.Scales: MajorScales.Go(); break;

                case Cmd.Ascii: ASCII85Utility.Go(); break;

                case Cmd.Polynomials: Polynomials.Go(); break;

                case Cmd.Webclient: WebClient.Go(); break;

                case Cmd.Boxes: StackingBoxes.Go(); break;

                case Cmd.Balance: Balance.Go(); break;
                }
            }
        }
Exemplo n.º 2
0
        public Task(Random rng, int paragraph, int tasks, int id)
        {
            task     = Task.tasks[paragraph - 1, id];
            this.rng = rng;
            for (int i = 0; i < tasks; i++)
            {
                switch (paragraph)
                {
                case 1:
                    Polynomials.Add(Task1(id));
                    break;

                case 2:
                    Polynomials.Add(Task2(id));
                    break;

                case 3:
                    Polynomials.Add(Task3(id));
                    break;

                case 4:
                    Polynomials.Add(Task4(id));
                    break;
                }
            }
        }
Exemplo n.º 3
0
        // Method to handle delete operation
        public static void DeletePolynomial(Polynomials p)
        {
            if (p.Count() == 0)
            {
                System.Console.WriteLine("Cannot perform operation with zero items in the list");
                return;
            }

            // Variable to store user input
            // Note that it is equal to list size + 1, for because we need to seed the loop for index validation
            int index = p.Count() + 1;

            // Prompt the user to input the index
            System.Console.WriteLine("Please, input the index of polynomial you wish to delete:");

            // Start 'index in bounds' validation loop
            while (index > p.Count() || index < 1)
            {
                index = GetUserInputInt(System.Console.ReadLine());

                if (index <= p.Count() && index > 0)
                {
                    break;
                }

                System.Console.WriteLine("Index out of bounds, please try again:");
            }

            // Delete the polynomial from the list
            p.Delete(index);
        }
Exemplo n.º 4
0
    public static void DeletePolynomial(Polynomials P)
    {
        string aInput  = null;
        int    aOutput = 0;

        if (P.Polycount == 0)
        {
            Console.WriteLine("No polynomials!");
        }
        else
        {
            do
            {
                Console.Write("Please input the index of the polynomial which you would like to delete. >> ");
                aInput = Console.ReadLine();
                while (!Int32.TryParse(aInput, out aOutput))
                {
                    Console.Write("Invalid input. Please enter an integer greater than 0. >> ");
                    aInput = Console.ReadLine();
                }
            } while (aOutput <= 0 || aOutput > P.Polycount);

            P.Delete(aOutput);
        }
    }
Exemplo n.º 5
0
    public static void EvaluatePolynomial(Polynomials P)
    {
        string aInput, bInput = null;
        int    aOutput;
        double bOutput;

        if (P.Polycount == 0)
        {
            Console.WriteLine("No polynomials!");
        }
        else
        {
            do
            {
                Console.Write("Please input the polynomial's index. >> ");
                aInput = Console.ReadLine();
                while (!Int32.TryParse(aInput, out aOutput))
                {
                    Console.Write("Input invalid. Please enter an integer greater than 0. >> ");
                    aInput = Console.ReadLine();
                }
            } while (aOutput <= 0 || aOutput > P.Polycount);

            Console.Write("Please input the value for x. >> ");
            bInput = Console.ReadLine();
            while (!double.TryParse(bInput, out bOutput))
            {
                Console.Write("Input invalid. Please enter a double. >> ");
                bInput = Console.ReadLine();
            }

            Console.WriteLine("The polynomial evaluates to: {0}", P.Retrieve(aOutput).Evaluate(bOutput));
        }
    }
Exemplo n.º 6
0
        public Operand Simplify(Polynomials p, Numbers n, Trigonometry t, Dictionary <char, Operand> dict)
        {
            os = new Simplifier(p, n, t, dict);

            Print.Log("formatting");
            Operand ans = os.Simplify(this);

            if (os.CanFactor)
            {
                PossibleForms[Polynomials.Factored] = true;
            }
            if (os.CanExpand)
            {
                PossibleForms[Polynomials.Expanded] = true;
            }

            if (os.ts.HasExactForm)
            {
                PossibleForms[Numbers.Exact] = true;
            }

            HasTrig = os.ts.tfs.HasTrig;

            return(ans);
        }
Exemplo n.º 7
0
    static void Main()
    {
        int[] a = { 11, 0, 5, 6 };
        int[] b = { 5, 7 };

        int[] sum = Polynomials.Sum(a, b);
        Polynomials.Print(sum);
    }
Exemplo n.º 8
0
        // Method to handle create operation
        public static void Create(Polynomials p)
        {
            // Variable for stop code
            const string CODE_STOP = "STOP";
            // New polynomial to be added to a list
            Polynomial polynomial = new Polynomial();

            // Variables for user input
            string userInput = "";
            double coefficient;
            byte   exponent;

            // Declare a stop code
            System.Console.WriteLine("Use '{0}' command to stop accepting new entries", CODE_STOP);

            while (userInput.ToUpper() != CODE_STOP)
            {
                // Prompt the user to input coefficient
                System.Console.WriteLine("Please, input the coefficient of the term:");
                userInput = System.Console.ReadLine();

                // Check for stop command
                if (userInput.ToUpper() == CODE_STOP)
                {
                    break;
                }

                coefficient = GetUserInputDouble(userInput);

                // Prompt the user to input exponent
                System.Console.WriteLine("Please, input the exponent of the term:");

                userInput = System.Console.ReadLine();

                // Check for stop command
                if (userInput.ToUpper() == CODE_STOP)
                {
                    break;
                }

                exponent = GetUserInputByte(userInput);

                // Add a term to the polynomial
                polynomial.AddTerm(new Term(coefficient, exponent));
            }

            // Remove all zero-coefficient terms
            polynomial.Trim();

            // Print out the resultant polynomial
            System.Console.WriteLine("Resultant polynomial is:");
            polynomial.Print();

            p.Insert(polynomial);
        }
Exemplo n.º 9
0
    static void Main()
    {
        int[] a = { 11, 0, 5, 6 };
        int[] b = { 5, 7 };

        int[] subtraction = Polynomials.Subtraction(a, b);
        Polynomials.Print(subtraction);

        int[] multiplication = Polynomials.Multiplication(a, b);
        Polynomials.Print(multiplication);
    }
Exemplo n.º 10
0
        // Method to handle add operation
        public static void AddPolynomials(Polynomials p)
        {
            if (p.Count() == 0)
            {
                System.Console.WriteLine("Cannot perform operation with zero items in the list");
                return;
            }

            // Variables to store user input
            // Note that they are equal to list size + 1, because we need to seed the loop for index validation
            int index1 = p.Count() + 1, index2 = p.Count() + 1;

            // Prompt the user to input first index
            System.Console.WriteLine("Please, input the index of the first polynomial to add:");

            // Start 'index in bounds' validation loop
            while (index1 > p.Count() || index1 < 1)
            {
                index1 = GetUserInputInt(System.Console.ReadLine());

                if (index1 <= p.Count() && index1 > 0)
                {
                    break;
                }

                System.Console.WriteLine("Index out of bounds, please try again:");
            }

            // Prompt the user to input second index
            System.Console.WriteLine("Please, input the index of the second polynomial to add:");

            while (index2 > p.Count() || index2 < 1)
            {
                index2 = GetUserInputInt(System.Console.ReadLine());

                if (index2 <= p.Count() && index2 > 0)
                {
                    break;
                }

                System.Console.WriteLine("Index out of bounds, please try again:");
            }

            // Add two polynomials and trim the result
            Polynomial result = p.Retrieve(index1) + p.Retrieve(index2);

            result.Trim();

            // Output the result
            System.Console.WriteLine("The resultant polynomial is:");
            result.Print();

            p.Insert(result);
        }
Exemplo n.º 11
0
        /// <summary>
        /// creates a new basis
        /// </summary>
        /// <param name="grd">the <see cref="GridData"/> that stores grid information</param>
        /// <param name="degree">highest polynomial degree of basis polynomials</param>
        public Basis(IGridData grd, int degree)
        {
            this.m_GridDat = grd;
            var PolyList = grd.ChefBasis.GetOrthonormalPolynomials(degree);

            this.Polynomials   = PolyList.ToList <PolynomialList>().AsReadOnly();
            this.IsOrthonormal = true;

            this.MinimalLength = Polynomials.Min(pl => pl.Count);
            this.MaximalLength = Polynomials.Max(pl => pl.Count);
            this.Degree        = this.Polynomials.Max(pl => pl.MaxAbsoluteDegree);
        }
Exemplo n.º 12
0
        public void DoSomething()
        {
            var timer = new Stopwatch();

            timer.Start();
            Polynomials.Add(new HashSet <int[]>());
            for (var i = 1; i < N; i++)
            {
                if (File.Exists(@"Polynomials\" + i + ".txt"))
                {
                    var polynomials = File.ReadAllLines(@"Polynomials\" + i + ".txt");
                    Polynomials.Add(new HashSet <int[]>());
                    foreach (var polynomial in polynomials)
                    {
                        Polynomials[i].Add(polynomial.Select(x => int.Parse(x.ToString())).ToArray());
                    }
                }
                else
                {
                    DegreeCalculated = i;
                    break;
                }
            }
            if (DegreeCalculated == 0)
            {
                return;
            }

            for (var i = DegreeCalculated > 0 ? DegreeCalculated : 1; i <= N; i++)
            {
                var polynomial = new int[i + 1];

                ///У неприводимого многочлена младший коэффициент
                ///не может быть 0.
                for (int k = 1; k < field; ++k)
                {
                    polynomial[0] = k;
                    polynomial[polynomial.Length - 1] = 1;
                    Polynomials.Add(new HashSet <int[]>());
                    FindPolinomials(polynomial, 1);
                }
                var str = new StringBuilder();
                foreach (var irreducible in Polynomials[polynomial.Length - 1])
                {
                    str.Append(string.Join("", irreducible) + Environment.NewLine);
                }
                File.WriteAllText(@"Polynomials\" + i + ".txt", str.ToString());
                Console.WriteLine("Degree " + i + " calculated at " + DateTime.Now + " in "
                                  + timer.Elapsed + ". " + Polynomials[i].Count + " irreducible polynomials was found");
                timer.Restart();
            }
        }
Exemplo n.º 13
0
    public static void AddPolynomials(Polynomials P)
    {
        string aInput, bInput = null;
        int    aOutput, bOutput = 0;

        if (P.Polycount == 0)
        {
            Console.WriteLine("No polynomials!");
        }
        else
        {
            Polynomial newPoly = new Polynomial();

            do
            {
                Console.Write("Please input the first polynomial's index. >> ");
                aInput = Console.ReadLine();

                while (!Int32.TryParse(aInput, out aOutput))
                {
                    Console.Write("Invalid input, please enter an appropriate index. >> ");
                    aInput = Console.ReadLine();
                }
            } while (aOutput <= 0 || aOutput > P.Polycount);

            do
            {
                Console.Write("Please input the second polynomial's index. >> ");
                bInput = Console.ReadLine();
                while (!Int32.TryParse(bInput, out bOutput))
                {
                    Console.Write("Invalid input, please enter an int greater than 0. >> ");
                    bInput = Console.ReadLine();
                }
            } while (bOutput <= 0 || bOutput > P.Polycount);

            newPoly = P.Retrieve(aOutput) + P.Retrieve(bOutput);
            P.Insert(newPoly);
        }
    }
Exemplo n.º 14
0
        // Method to handle evaluate operation
        public static void EvaluatePolynomial(Polynomials p)
        {
            if (p.Count() == 0)
            {
                System.Console.WriteLine("Cannot perform operation with zero items in the list");
                return;
            }

            // Variables to store user input
            // Note that index is equal to list size + 1, for because we need to seed the loop for index validation
            int    index = p.Count() + 1;
            double value;

            // Prompt the user to input the index
            System.Console.WriteLine("Please, input the index of polynomial you wish to evaluate:");

            // Start 'index in bounds' validation loop
            while (index > p.Count() || index < 1)
            {
                index = GetUserInputInt(System.Console.ReadLine());

                if (index <= p.Count() && index > 0)
                {
                    break;
                }

                System.Console.WriteLine("Index out of bounds, please try again:");
            }

            // Prompt the user to input the value for x
            System.Console.WriteLine("Please, input the value of x:");
            value = GetUserInputDouble(System.Console.ReadLine());

            // Output the result
            System.Console.WriteLine("The result is {0}", p.Retrieve(index).Evaluate(value));
        }
Exemplo n.º 15
0
        static void Main(string[] args)
        {
            try
            {
                //Creates a new list, S, of Polynomials
                Polynomials S = new Polynomials();

                //Data members
                double coef;
                int    count = 0;

                //Data members for deciding what the program will do the make sure it's a number
                int pick;
                int exp;

                //Will continue the program until the user inputs "6"
                do
                {
                    //Detailing all the options the user has
                    Console.WriteLine("Welcome to the Polynomial program, please read all the options before entering an input");
                    Console.WriteLine("Here is the list of polynomials");
                    S.Print(); // prints the list so the user knows what is already in the list
                    Console.WriteLine("Press 1 if you would like to insert a polynomial into the list printed above");
                    Console.WriteLine("Press 2 if you would like to add two polynomials together and insert them into the list");
                    Console.WriteLine("Press 3 if you would like to multiply two polynomials together and insert it into the list");
                    Console.WriteLine("Press 4 if you would like to delete any polynomials from the list above");
                    Console.WriteLine("Press 5 if you would like to evaluate a polynomial from the list, provided that you enter x");
                    Console.WriteLine("Press 6 if you would like to close this console");
                    pick = Convert.ToInt32(Console.ReadLine());

                    //If the user tries to enter a letter instead of a number, it gets an error
                    if (pick < 1 || pick > 6)
                    {
                        Console.WriteLine("Sorry, you must pick an option between 1 and 6");
                        Console.WriteLine("");
                    }


                    //If the  user picks the 1st option, it does this
                    if (pick == 1)
                    {
                        //creates a new list to keep track of what the user has entered
                        Polynomial b = new Polynomial();

                        int hMany;
                        int i = 0;

                        //asks the user how many terms they want to enter
                        Console.WriteLine("How many terms do you want to add to?");
                        hMany = Convert.ToInt32(Console.ReadLine());

                        //Asks the user what they want the coefficient and exponent to be until i reaches hMany
                        while (i < hMany)
                        {
                            Console.WriteLine("Please enter the coefficient");
                            coef = Convert.ToDouble(Console.ReadLine());

                            Console.WriteLine("Please enther the exponent");
                            exp = Convert.ToInt32(Console.ReadLine());

                            //takes the coefficient and exponents, adds them to the term
                            Term t = new Term(coef, exp);
                            b.AddTerm(t);

                            i++;
                            count++;
                        }
                        //Inserts the newly added polynomials into S
                        S.Insert(b);
                    }
                    //Tells the program what to do if the user enters 2
                    else if (pick == 2)
                    {
                        //Checks to see if there are any polynomials to add together in the first place
                        if (count < 2)
                        {
                            Console.WriteLine("There are no polynomials in the list");
                            Console.WriteLine("");
                        }
                        //Asks the user which polynomails he wants to use, then it adds them together and inserts it in to the list
                        else
                        {
                            Console.WriteLine("Here is the list of Polynomials");
                            S.Print();

                            int Ret1, Ret2;


                            Console.WriteLine("Please enter the index of the first polynomial you would like to use ");
                            Ret1 = Convert.ToInt32(Console.ReadLine());

                            Console.WriteLine("Please enter the index of the second polynomial you would like to use");
                            Ret2 = Convert.ToInt32(Console.ReadLine());


                            Polynomial answer = S.Retrieve(Ret1) + S.Retrieve(Ret2);


                            Console.WriteLine("Your new polynomial is:");
                            answer.Print();
                            Console.WriteLine("");


                            S.Insert(answer);
                        }
                    }
                    //Tells the program what to do if the user wants to multiply
                    else if (pick == 3)
                    {
                        //Checks to see if there are polynomials to multiply together
                        if (count < 2)
                        {
                            Console.WriteLine("There are no polynomials in the list");
                            Console.WriteLine("");
                        }
                        //Asks the user for which polynomials it wants to multiply together and then inserts it
                        else
                        {
                            Console.WriteLine("Here is the list of Polynomials");
                            S.Print();

                            int Mul1, Mul2;

                            Console.WriteLine("Please enter the index of the first polynomial you would like to use ");
                            Mul1 = Convert.ToInt32(Console.ReadLine());

                            Console.WriteLine("Please enter the index of the second polynomial you would like to use");
                            Mul2 = Convert.ToInt32(Console.ReadLine());


                            //inserts the newly multiplied together polynomial
                            Polynomial result = S.Retrieve(Mul1) * S.Retrieve(Mul2);
                            Console.WriteLine("Your new polynomial is:");
                            result.Print();
                            Console.WriteLine("");
                            S.Insert(result);
                        }
                    }
                    //Tells the program what to do if the user wants to delete polynomials
                    else if (pick == 4)
                    {
                        //checks to see there are any polynomials to add together
                        if (count == 0)
                        {
                            Console.WriteLine("There are no polynomials in the list");
                            Console.WriteLine("");
                        }
                        //Asks the user which polynomial they want to delete and then deletes it
                        else
                        {
                            int del;

                            Console.WriteLine("Here is the list of Polynomials");
                            S.Print();

                            Console.WriteLine("Please enter the index of the polynomial you would like to delete");
                            del = Convert.ToInt32(Console.ReadLine());

                            S.Delete(del);

                            Console.WriteLine("Deleted");
                            Console.WriteLine("");
                        }
                    }
                    //Tells the program what to do if the user wants to evaluate a term
                    else if (pick == 5)
                    {
                        //Checks to see if there are any polynomials to evaluate
                        if (count == 0)
                        {
                            Console.WriteLine("There are no polynomials in the list");
                            Console.WriteLine();
                        }
                        //Asks the user which polynomial they want to evaluate, what value for x and then answers them
                        else
                        {
                            int    Ret;
                            double x;

                            Console.WriteLine("Please enter the index of the polynomial you would like to evaluate");
                            Ret = Convert.ToInt32(Console.ReadLine());

                            Console.WriteLine("Please enter the x value you would like to use");
                            x = Convert.ToInt32(Console.ReadLine());

                            double answer;
                            answer = S.Retrieve(Ret).Evaluate(x);

                            Console.WriteLine("Your answer is:");
                            Console.WriteLine(answer);
                            Console.WriteLine("");
                        }
                    }
                } while (pick != 6);
            }
            catch (ArgumentException e) { Console.WriteLine(e.Message); }
        }
Exemplo n.º 16
0
    public static Polynomials CreatePolynomial(Polynomials P)
    {
        string coefficientInput, exponentInput = null;
        string userInput  = null;
        char   userOutput = 'F';
        double newCoefficient;
        byte   newExponent;

        Polynomial newPoly = new Polynomial();

        do
        {
            Console.WriteLine("'A'dd a term to the polynomial. \n 'F'inish the polynomial.");
            Console.Write("Please enter an action. >> ");
            userInput = Console.ReadLine();

            while (!char.TryParse(userInput, out userOutput))
            {
                Console.Write("Invalid input. Please enter a single character. >> ");
                userInput = Console.ReadLine();
            }

            switch (char.ToUpper(userOutput))
            {
            case 'A':
            {
                Console.Write("Enter a value for the coefficient. >> ");
                coefficientInput = Console.ReadLine();

                while (!double.TryParse(coefficientInput, out newCoefficient))
                {
                    Console.Write("Input invalid. Please enter a double. >> ");
                    coefficientInput = Console.ReadLine();
                }

                Console.Write("Enter a value for the exponent. >> ");
                exponentInput = Console.ReadLine();

                while (!byte.TryParse(exponentInput, out newExponent))
                {
                    Console.Write("Input invalid. Please enter a number between 0 and 255. >> ");
                    exponentInput = Console.ReadLine();
                }

                Term newTerm = new Term(newCoefficient, newExponent);
                newPoly.AddTerm(newTerm);
                break;
            }

            case 'F':
            {
                P.Insert(newPoly);
                return(P);
            }

            default:
            {
                Console.WriteLine("Error, please input a valid command.");
                Console.WriteLine();
                break;
            }
            }
        } while (char.ToUpper(userOutput) != 'F');
        return(P);
    }
Exemplo n.º 17
0
    public static void Main()
    {
        Polynomials P         = new Polynomials();
        string      userInput = null;
        char        userOutput;

        do
        {
            Console.WriteLine("Please select an action. You may: \n 'C'reate a polynomial and insert it into the list. \n 'A'dd two polynomials and insert the sum into the list. " +
                              "\n 'M'ultiply two polynomials and insert the product into the list. \n 'D'elete a polynomial. \n 'E'valuate a polynomial. \n 'Q'uit the program.");

            Console.WriteLine("\n Current Polynomials: ");
            P.Print();
            Console.WriteLine();
            Console.Write("Enter action. >> ");

            userInput = Console.ReadLine();
            while (!char.TryParse(userInput, out userOutput))
            {
                Console.Write("Please enter a single character. >> ");
                userInput = Console.ReadLine();
            }

            switch (Char.ToUpper(userOutput))
            {
            case 'C':
            {
                P = CreatePolynomial(P);
                P.Print();
                Console.WriteLine();
                break;
            }

            case 'A':
            {
                AddPolynomials(P);
                Console.WriteLine();
                break;
            }

            case 'M':
            {
                MultiplyPolynomials(P);
                Console.WriteLine();
                break;
            }

            case 'D':
            {
                DeletePolynomial(P);
                Console.WriteLine();
                break;
            }

            case 'E':
            {
                EvaluatePolynomial(P);
                Console.WriteLine();
                break;
            }

            case 'Q':
            {
                Console.WriteLine("Exiting Program.");
                Console.ReadLine();
                break;
            }

            default:
            {
                Console.WriteLine("Error. Please input a valid command.");
                Console.WriteLine();
                break;
            }
            }
        } while (char.ToUpper(userOutput) != 'Q');
    }
Exemplo n.º 18
0
 public override int GetHashCode()
 {
     return(Polynomials?.GetHashCode() ?? 0);
 }
Exemplo n.º 19
0
 /// <summary>
 /// Constructs a polynomial from a list of monomials.
 /// </summary>
 public DecimalPolynomial(IEnumerable <DecimalMonomial> coefficients) : this()
 {
     Polynomials.AddRange(coefficients);
     this.Normalize();
     this.TrimLeadingZeroMonomials();
 }
Exemplo n.º 20
0
        // Main program method - initialized with start of a program
        public static void Main()
        {
            // Variables for operation letter codes
            const char CODE_CREATE   = 'C';
            const char CODE_ADD      = 'A';
            const char CODE_MULTIPLY = 'M';
            const char CODE_DELETE   = 'D';
            const char CODE_EVALUATE = 'E';
            const char CODE_QUIT     = 'Q';
            // Variable to store the user's input
            char userInput;
            // List of polynomials
            Polynomials list = new Polynomials();

            // Program introduction
            System.Console.WriteLine("Hello! And welcome to UPLM! (univariable polynomial list manipulator)\n");
            System.Console.WriteLine("There are several commands available for you,");
            System.Console.WriteLine("and they are accessible by letter codes.\n");

            // Letter codes declaration
            System.Console.WriteLine("Use '{0}' to create and add a polynomial to the list", CODE_CREATE);
            System.Console.WriteLine("Use '{0}' to add two polynomials in the list and insert the result into the list",
                                     CODE_ADD);
            System.Console.WriteLine("Use '{0}' to multiply two polynomials in the list and insert the result into the list",
                                     CODE_MULTIPLY);
            System.Console.WriteLine("Use '{0}' to delete a polynomial at a certain position in the list", CODE_DELETE);
            System.Console.WriteLine("Use '{0}' to evaluate a certain polynomial with a given x", CODE_EVALUATE);
            System.Console.WriteLine("Use '{0}' to quit the program\n", CODE_QUIT);

            // Prompt the user to input the first command
            System.Console.WriteLine("Please, choose the first command:");
            userInput = GetUserInputChar(System.Console.ReadLine());

            // Start the loop
            while (userInput != 'Q')
            {
                // Output the empty line for easy-to-read formatting
                System.Console.WriteLine();

                // Start a method corresponding to the operation
                switch (userInput)
                {
                case CODE_CREATE:
                    Create(list);
                    break;

                case CODE_ADD:
                    AddPolynomials(list);
                    break;

                case CODE_MULTIPLY:
                    MultiplyPolynomials(list);
                    break;

                case CODE_DELETE:
                    DeletePolynomial(list);
                    break;

                case CODE_EVALUATE:
                    EvaluatePolynomial(list);
                    break;

                default:
                    System.Console.WriteLine("Wrong code provided");
                    break;
                }

                // Output the current list
                System.Console.WriteLine("\nCurrently, the list is:");
                list.Print();
                System.Console.WriteLine("\n");

                // Prompt the user to input the next command
                System.Console.WriteLine("Please, choose the next command:");
                userInput = char.ToUpper(GetUserInputChar(System.Console.ReadLine()));
            }

            System.Console.WriteLine("Thank you for using our program!");
            System.Console.WriteLine("Press 'Enter' to close the program");
            System.Console.ReadLine();
        }
Exemplo n.º 21
0
 public Form(Polynomials polynomialForm, Numbers numberForm, Trigonometry trigonometryForm)
 {
     PolynomialForm   = polynomialForm;
     NumberForm       = numberForm;
     TrigonometryForm = trigonometryForm;
 }
Exemplo n.º 22
0
 internal Simplifier(Term.Simplifier ts, Polynomials p)
 {
     this.ts = ts;
     this.p  = p;
 }
Exemplo n.º 23
0
 public Simplifier(Polynomials p, Numbers n, Trigonometry t, Dictionary <char, Operand> dict)
 {
     this.ts = new Term.Simplifier(new Variable.Simplifier(this, dict, n), new TrigFunction.Simplifier(t, this), this, n);
     this.p  = p;
 }