Home

Symbolic Polynomial Lab

image

Contents

1. deletePoly this method should delete the chosen polynomial addPoly this method should compute and display the sum i e a B of any two polynomials selected by the user The original a and 6 polynomials are to be left unaltered After calculation the user should be given the option to name and save the resultant polynomial or to discard it subtractPoly this method should compute and display the difference 1 e a B of any two polynomials selected by the user The original a and B polynomials are to be left unaltered After calculation the user should be given the option to name and save the resultant polynomial or to discard it evalPoly this method should evaluate the selected polynomial for the given real values x y and z supplied by the user Is Horner s rule useful exitPoly a function used to close the system down at the end of the day No backup of the polynonial data structure is required Note For BONUS credit 15 points each you may choose to implement any or all of the following additional functionality i storePoly used to store the contents of the polynomial data structure to a disk file for later use by the loadPoly function described below ii loadPoly used to restore the polynomial data structure at the beginning of the day iii multiplyPoly this method should compute and display the product 1 e a B of
2. gt sets the specified polynomial s link field to p kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk xx Protocol for PolyNodeInterface author James Comer public interface PolyNodeInterface Method signatures public public public public public public public public public public int getCoeff void setCoeff int c int getXPower void setXPower int ix int getYPower void setYPower int iy int getZPower void setZPower int iz PolyNode getPtr void setPtr PolyNode p CoSc 20803 Lab 1 September 9 2015 page 9
3. linked list is most easily constructed if the incoming exponents A B C are read in decreasing order Feel free to develop your program with this understanding of course you are not required to make this restriction The data structure representation shown below is an example of what is REQUIRED of all software submitted for this assignment CoSc 20803 Lab 1 September 9 2015 page 4 polysList a eli See els z Peh lolo iehl kehi For Example Assume the following two multivariate polynomials ABC 3x y 5x y z 5x y z XYZ 4x y z 5x y z Given the above two polynomials as input your program should construct the following data structure Your GUI should be intuitive and must support a variety of operations e g enter new polynomial add two polynomials subtract two polynomials display a polynomial evaluate a polynomial given values for x y and z delete a polynomial etc In this regard you are free to design an interface that will allow the user to input any information necessary to perform these operations JLists JCheckboxes JComboBoxes etc Obviously your grade will depend substantially on the esthetics of your GUI and its functionality as well as on whether the program produces correct output for the various operations CoSc 20803 Lab 1 September 9 2015 page 5 Data Interface Requirements With regard t
4. Due Date Language Lab Value Purpose Documentation Problem CoSc 20803 Fall 2015 Lab 1 GUI code Thursday Sept 24 2015 all files including a runnable JAR file related to your Lab1 project zipped together and submitted with TURNIN Finished Project Thursday Oct 8 2015 all files including a runnable JAR file related to your Lab1 project zipped together and submitted with TURNIN hardcopy printout of User s Manual turned in at my office by noon on Friday morning Oct 9 2015 not accepted late On the Friday morning following the due date for the final project you will be required to provide a short User s Manual detailing the proper procedures to follow in order to use your program Be sure to include any information that will be needed in order to test your code include statements about any features that you failed to implement This MUST be turned in at my office TUC 208 or the secretary s office TUC 207 by 12 00 noon Failure to do so will result in a substantial reduction in your lab grade for the assignment Java This assignment is worth 250 points total it constitutes roughly 38 of the lab grade You should use good OOP techniques in developing your lab solution You were taught the MVC programming architectural pattern in COSC10403 and probably in COSC 20203 You are welcome to copy that design pattern To exercise your knowledge of
5. any two polynomials selected by the user The original a and B CoSc 20803 Lab 1 September 9 2015 page 7 polynomials are to be left unaltered After calculation the user should be given the option to name and save the resultant polynomial or to discard it Requirements Two Java interfaces are provided below Your Lab solution should implement both of these interfaces The following two Java interfaces MUST be included and compiled along with your program Interface 1 PolyNameNodeInterface PolyNameNode interface should be included as a part of your Labl project kkkkkkkkkkkkkkkkkkPUBLIC OPERATIONS KKK KK KKK KK KKK KKK KEK KK KKK KKK KK KK KKK KKK public public public public public public String getPolyName gt returns the name of the polynomial being pointed to void setPolyName String s gt sets the name of this polynomial to s PolyNameNode getDownPtr gt returns the value of the down ptr for the specified PolyListNode void setDownPtr PolyNameNode p gt sets the down ptr of the specified node to p PolyNode getRightPtr gt returns the value of the right ptr for the specified PolyNameNode void setRightPtr PolyNode p gt sets the right ptr of the specified node to p kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk Xx Protocol for PolyNameNodeInterfac
6. circular linked lists You are expected to thoroughly document your program to the extent discussed in class Your program should contain preamble documentation like that taught in CoSc 10403 and CoSc 20203 AND internal documentation consistent with that expected of experienced programmers If you don t know what that means ASK See the CoSc 10403 Documentation Standard for a very simple example you will need to do better Feel free to use JavaDoc The history of mathematics science and technology has a long tradition of discoveries These discoveries in recent years have been enhanced by the creation of new computational technologies that support integrated symbolic computation for applications ranging from mathematics to chemistry to geometry to finance Over the past several years various computer algebra systems have evolved Powerful tools CoSc 20803 Lab 1 September 9 2015 page 1 For Example such as Wolfram Research s Mathematica and Maplesoft s Maple13 and MapleSim and MatLab are examples One of the classical problems in computer science is to perform symbolic manipulation of polynomials with integral coefficients Note a polynomial is a mathematical expression involving a sum of powers multiplied by coefficients A polynomial expressed in one variable is known as a univariate polynomial while one expressed in more than one variable is known as a multivariate polynomial Note also t
7. e author James Comer public interface PolyNameNodeInterface Method signatures public public public public public public String getPolyName void setPolyName String s PolyNameNode getDownPtr void setDownPtr PolyNameNode p PolyNode getRightPtr void setRightPtr PolyNode p CoSc 20803 Lab 1 September 9 2015 page 8 Interface 2 PolyNodeInterface PolyNode interface should be included as a part of your Labl project kkkkkkkkkkkkkkkkkkPUBLIC OPERATIONS k k kk kk k kk kk kk kk k k k k k k k k k k k k k k k kk kk k k k k public public public public public public public public public public int getCoeff gt returns the coeff of a specified polynomial term void setCoeff int c gt sets the coeff of the specified polynomial s term to c int getXPower gt returns the specified polynomial s x power void setXPower int ix gt sets the specified polynomial s x power to ix int getYPower gt returns the specified polynomial s y power void setYPower int iy gt sets the specified polynomial s y power to iy int getZPower gt returns the specified polynomial s z power void setZPower int iz gt sets the specified polynomial s z power to iz PolyNode getPtr gt returns the value of the specified polynomial s link field void setPtr PolyNode p
8. hat constants are considered to be multiplied by a variable raised to the zero power For this assignment you will be developing a Java stand alone application not an applet with associated GUI to manipulate polynomials based on the basic list processing methods outlined below Your program will need to support operations on multivariate polynomials in three variables xX Y and Z with constant non negative whole number exponents and coefficients Three variable polynomials are of the following form p x y z ey y z Cx yz where the C are non zero coefficients and the A B C represent each variable s exponent An important issue when working with symbolic representations of polynomials involves maintaining the order of the variables For example it is necessary that the term x yZ be recognized as identical to yx Z The easiest way to achieve this is to always keep the variable names in a consistent order The most obvious way to do this is alphabetically Thus no matter what order the user enters the term x Y Z whether it be as x yZ oras yx Z oras x Zy or any other permutation it will always be stored as x yz Another idea would involve storing the individual polynomial terms such that the exponents A B C are arranged as For the current assignment 9 63 455 p x y z 6x yZ 5x z 3 is a valid multivariate polynomial while py 6x y 4 x 7x is not because its second ter
9. ld be displayed in an appropriate form Example 5x might be displayed as 5 x 4 y 0 z 0 For this assignment you must develop a Java stand alone application not an applet that employees an easy to use intuitive GUI that will allow the user to input any information necessary to perform the operations outlined below you should use the Java swing classes as they provide a richer appearing interface Active widgets JButtons JTextFields etc should be employed whenever possible to make your program easier to use you will want to use the methods setVisible setEnabled requestFocus etc Your software should provide at a minimum the basic functionality listed below You are free to implement other methods besides these CoSc 20803 Lab 1 September 9 2015 page 6 1 createPoly reads in a multivariate polynomial from the user converts the polynomial into a circular linked list according to the representation specified earlier and returns the address of the Head node The following methods should probably employ either a TComboBox or JList widget in order for the user to select polynomials that need to be operated on 2 3 4 5 6 7 displayPoly should allow the user to click and select a polynomial to be displayed The chosen trinomial should be displayed in an appropriate form Example 5x might be displayed as 5 xA4 yh0 7ZA0
10. m involves division by the variable X thus making it a negative exponent and also because its third term contains an exponent that is not a whole number CoSc 20803 Lab 1 September 9 2015 page 2 Operations Data Structure Given the following multivariate polynomials A 3x 5xy 8y 4x 3y 12 B x 6y 15x 11 C 2x 3y 5 A B x 3x 5xy 2y 11x 3y 23 A B x 3x 5xy 14y 19x 3y 1 C D 2x 5xy 12y 3x 23y 5 Adding or subtracting polynomials is just a matter of searching for terms with the same exponent and adding or subtracting their coefficients Multiplication and division are just a matter of properly modifying exponents Notice however that dividing a single PolyTerm by another single PolyTerm might cause negative exponents to appear which stretches our mathematical definition of polynomial Further division of two polynomials each of multiple terms only succeeds if the division results in no remainder Thus Division is the most complicated arithmetic operation on multivariate polynomials and the result is in general not a polynomial For this assignment you will be asked to develop a system that will support addition and subtraction of multivariate polynomials and multiplication for Bonus credit We will skip division For this program you are required to maintain a circular linked list of multivariate PolyNa
11. me nodes each of which has a rightLink pointing to the head node for its respective polynomial and a downlink pointing to the next PolyName node NOTE You may NOT use arrays vectors nor any of the builtin Java classes other than those swing classes necessary for the GUI CoSc 20803 Lab 1 September 9 2015 page 3 p x y Z The node formats for terms in this linked list are ae ae ll eb downLink to next rightLink to Head node Poly Namebist Healer PolyName node of the named volvnomial PolyiNawe node PolynomialName rightLink For your program each term of the multivariate polynomial will be represented by a separate node in a circular linked list Each node will be of fixed size having fields which represent the coefficient and X Y and Z exponents of a given term plus a pointer to the next lower term You may assume that all coefficients and exponents are integer and that exponents are non negative Your PolyNode structure should correspond to the following format PolyNode Header PolyNode standard term node coef AL BIC tink Thus the polynomial 6x y z 5x7 3 shown earlier will be represented internally with Head node as Note that the nodes are organized within the list such that 963 the ABC exponents for node 1 precede the 2 node which has ABC exponents 405 Your algorithms will be greatly simplified by so doing A multivariate polynomial
12. o reading an equation in polynomial form from the user you are free to design your program to accept that input in any form i e you may allow a user to type the full equation into a JTextArea or JTextField in polynomial form similar to the following Alpha 6 xA9 yA6 ZA3 S xA4 yA0 ZAS5 3 x 0 y 0 Zz 0 where A means exponentiation Your program can then parse the input string into coefficient and exponent pairs in order to build up the circular linked list for the named polynomial The Java StringTokenizer class will be helpful Alternatively you might prompt the user for one term of the polynomial add that term to the linked list and prompt for the next term terminating whenever the last term is entered This is entirely up to you You should develop your own test suite to determine the correctness of your program You should be careful to do your testing completely I will use my own test suite to determine the accuracy of your program Your program will be enhanced by providing a user feedback area to supply operational feedback to the user informing him her of what operation was just performed e g a new polynomial was CREATED two polynomials were added or subtracted or multiplied if attempting the Bonus credit and the resulting polynomials is etc This same area may be used to produce a nicely formatted polynomial for output when asked to do so by the user Note polynomials shou

Download Pdf Manuals

image

Related Search

Related Contents

広報いくの2月号(5面)  DYNAPAC CA121/141 CONDUITE  Télécharger  Groensteen, Thierry. La bande dessinée. Mode d`emploi. Liège : Les  i3TOUCH V-SENSE  5月号(子育ての夢と現実)    

Copyright © All rights reserved.
Failed to retrieve file