c/c++代写 CS 33400 Assignment 1: Algebraic Scalar Field Evaluation

CS 33400 Assignment 1:

Algebraic Scalar Field Evaluation

Assigned on August 26, 2018
Due September 2, 2018, at 11:58pm Eastern

Problem to address:

Evaluate and draw the zero‐set of an algebraic scalar field in the plane.

The field domain is assumed to be the square 􏰀􏰁1 􏰂 􏰃, 􏰄 􏰂 1􏰅, the scalar value of point 􏰆􏰃, 􏰄􏰇 is the value of a polynomial 􏰈􏰆􏰃, 􏰄􏰇, chosen by the user. To evaluate the zero set, you use a regular sampling whose density is given by a positive integer N, also chosen by the user. Given 􏰉, the points of the first quadrant of the sampling can be generated as

             for (j=0; j<=N; j++) {
                x = (double j)/N;
                for (k=0; k<=N; k++) {
                   y = (double k)/N;
                   // (x,y) is next point
                }

You need to read the polynomial from the console per user’s request. Permissible syntax elements are the symbols x and y, float coefficients, exponents that are positive integers; operations are ‘+’, ‘‐‘, ‘*’, ‘^’; plus parentheses. You will be provided with the method to translate the polynomial into postfix notation for repeated evaluation.

The user interface is presented as a menu tree bound to Mouse‐Right. Use this structure:

The underlined elements are submenus, the others are menu entries. This will be discussed in class.

There are a number of example polynomials. As shown, the polynomials each occupy a menu entry. If ‘read polynomial’ is chosen, then the user has to type in a polynomial.

Here are the sample polynomials and their names

               "x^2+y^2‐0.8",
               "x^2+4*y^2‐0.5",
               "x^2‐4*y^2‐0.09",
               "y^2‐x^3",
               "y^2‐x^2‐x^3",
               "y^2‐x^4‐y^4",
               "y^2‐x^6‐y^6",
               "(x^2+y^2)^2‐(x^2‐y^2)",
               "8*x^4‐6*1.1*x^2*y+1.21*y^2‐4*1.331*y^3+4*1.21*1.21*y^4",
               "x^4 + y^2*(x^2‐x+1)*1.44 ‐2*y*x^2*1.2",
               "(x^2+y^2)^2+3*x^2*y‐y^3",
               "(x^2+y^2)^3‐4*x^2*y^2"
               "circle",
               "ellipse",
               "hyperbola",
               "semicubic parabola",
               "alpha curve",
               "touching tacnode",
               "crossing tacnode",
               "Lemniscate",
               "rabbit ears",
               "curved lobe",
               "trefoil",
               "clover leaf"

To find the curve, or part thereof, we let the user repeatedly pick two domain samples. If the samples have opposite signs, the curve must cut through the connecting line. Once a curve component has been found, you should evaluate that curve component.

Since we do not have a convenient GUI builder, we resort to menus for just about everything. If something is to be input, such as the N for specifying the sampling grid, the quantity is typed into the console window.