Veermata Jijabai Technical Institute, Mumbai Page 49
CalcWizard 1.0 Harshal Tushar Lehri 111080953 1 INTRODUCTION: Calculator has been a fundamental tool, whose use rose with the rising complexity in math. Mathematics in engineering requires much more than a simpler calculator and must perform much more than simpler arithmetic operations. It must be able to calculate advanced operations like graphs, integrals etc which form the basis of engineering mathematics. CalcWiard 1.0 is an attempt to solve these issues. The calculator is built to ease the calculations for all types of users by providing basic functions of a normal calculator but is particularly helpful for engineering calculations. The symbol is chosen as the Greek letter pi because it represents the beauty of math, appearing almost everywhere in nature. 2 LITERATURE SURVEY: The main source of this information for this project has been THE COMPLETE REFERENCE: JAVA 2 by Herbert Schildt and Patrick Naughton. Along with this several websites like Wikipedia, CodeProject have provided good overview of concepts like numeric integration, matrices implemented in this project. Documentation on Oracle has also been helpful to familiarize with the various classes, and their functions of the package java.awt. DATA STRUCTURES USING C by Tenanbaum has provided valuable content on the stacks and reverse polish notations. 3 HARDWARE AND SOFTWARE REQUIREMENTS: 3.1 HARDWARE: This application can be deployed on a system with an intel i3 processor, with a 1.87 GB RAM . The application is also of 56 kb so this much space is required. PROGRAMMING LAB MANUAL [2013]
Veermata Jijabai Technical Institute, Mumbai Page 50
3.2 SOFTWARE: To run the application the system requires a JDK, the latest one being 1.7. The application is built on awt so the application can also work on systems with older version of jdk. It can be deployed on Windows XP, 7, Linux Ubuntu (debian) and also on Mac OS. The appropriate jdk can be installed from oracle website. 4 TECHNOLOGY USED: The application was developed on Linux Ubuntu 12.04 LTS system, in a 64-bit environment. The application was developed using JDK 1.7 IcedTea. The code was written using gedit text editior, part of GNOME GUI. The standard terminal was also use for testing, launching and debugging the code. 5 FUNCTIONALITY: 5.1 EASY GUI BASED INPUT: Numbers and operators can be entered using a simple GUI based input using buttons and text fields. Inputs can also be taken via keyboard. The calculator also provides facilities to input float, decimals and operators like +, -, /, *, ( , ) , ^ . It also has inbuilt constants pi and e, two frequently used constants in engineering. It also provides facilities to input variables X and Y. Facilities to clear ad reset input field is also provided. 5.2 FAST EVALUATION OF EXPRESSION: The calculator evaluates using the reverse polish expression rather than the traditional approach. Thus the calculator first converts the infix expression to a postfix expression. Then it uses a stack and according to the precedence evaluates the expression. This is much more efficient than finding the symbols of highest precedence one by one and evaluating the expression. The expression also allows float numbers and negative numbers to be represented starting with -. However they must be enclosed within brackets. PROGRAMMING LAB MANUAL [2013]
Veermata Jijabai Technical Institute, Mumbai Page 51
5.3 SIMPLE INTERCONVERSION BETWEEN HEX, BINARY AND DECIMAL NUMBER FORMATS: Engineering calculations may require numbers to be in formats other than the standard decimal. CalcWizard 1.0 provides the facility to interconvert between various number formats by a simple click of a button. However the input number must be of proper format like 0x for hex numbers and terminating with B for binary numbers otherwise the numbers will be taken as decimal itself. 5.4 SOLVING QUADRATIC EQUATIONS: CalcWizard 1.0 determines the roots of a quadratic equation (of the form numX^2+ numX+ num), easily. It provides ease to determine the roots of equations which cannot be solved easily by hand. It also has facilities to display imaginary roots if there are any. 5.5 CALCULATING TRIGNOMETRIC VALUES: CalcWizard 1.0 provides a simple keyboard with trigonometric and logarithmic functions. One can input the value in the standard textfield window and then click the appropriate function. The result will be generated in the textfield, and hence expressions like sin(sin()) can be solved easily just by clicking the appropriate function that many times. 5.6 EVALUATING INTEGRALS: Integrals are fundamental parts in engineering maths. CalcWizard 1.0 has provided the facility to calculate definite integrals. It uses Simpsons 3/8 th rule to evaluate integrals and provides nearly accurate results. The expression can be written and the range can be specified and the integral can be calculated. Thus is simplifies the task of performing integration which may be difficult to solve by hand. 5.7 SCRATCH PAD: CalcWizard 1.0 provides the facility to store temporary results. An intermediate result generated from and expression can be moved to the scratch pad via a button click. This enables the user to also do some rough work if he/she needs to. PROGRAMMING LAB MANUAL [2013]
Veermata Jijabai Technical Institute, Mumbai Page 52
5.8 MATRIX MODE: 5.8.1 INTODUCTION: Matrices are frequently used in various fields of mathematics and physics as they represent multidimensional spaces. CalcWizard 1.0 has an inbuilt Matrix Mode which can be entered by pressing a button on the main window. This opens a new Window where matrix calculations can be performed. 5.8.2 EASY INPUT OF MATRIX: CalcWizard 1.0 provides easy input and storing of matrices. A text area is provided to input a matrix of any order. The matrix can be saved using a click of a button. A default name starting from A is stored in the matrix list. The matrix information in provided by clicking it and it displayed in the result window. Deletion of a matrix can also be performed easily. 5.8.3 EVALUATING MATRIX EXPRESSION: CalcWizard 1.0 can calculate matrix expressions. The result can be copied to input text area and hence the result can be stored in the matrix list. For evaluation of the expression it uses reverse polish notations. 5.8.4 CALCULATING INVERSE , DETERMINANT AND TRANSPOSE OF A MATRIX: CalcWizard has inbuilt functions to compute inverse of a matrix and its determinant. Indication of divide by zero is also shown in the result. 5.9 APPROXIMATE GRAPH PLOTTER: Sometimes it is necessary to have a rough idea of the equation one is solving of what the equation represents. CalcWizard 1.0 provides a Graph plotter which plots the approximate graphs of a given equation. The equation can be of the form f(Y)=f(X). PROGRAMMING LAB MANUAL [2013]
Veermata Jijabai Technical Institute, Mumbai Page 53
6 SCREENSHOTS: 6.1 BASIC LAYOUT OF CALCULATOR:
PROGRAMMING LAB MANUAL [2013]
Veermata Jijabai Technical Institute, Mumbai Page 54
6.2 CONVERTING TO HEX, BINARY
PROGRAMMING LAB MANUAL [2013]
Veermata Jijabai Technical Institute, Mumbai Page 55
6.3 USING THE SCIENTIFIC MODE:
PROGRAMMING LAB MANUAL [2013]
Veermata Jijabai Technical Institute, Mumbai Page 56
6.4 USING INTEGRATES:
6.5 FINDING ROOTS OF EQUATION:
PROGRAMMING LAB MANUAL [2013]
Veermata Jijabai Technical Institute, Mumbai Page 57
6.6 USING GRAPH MODE:
PROGRAMMING LAB MANUAL [2013]
Veermata Jijabai Technical Institute, Mumbai Page 58
6.7 USING MATRIX MODE: 6.7.1 DETERMINANT OF A MATRIX:
6.7.2 EVALUATING EXPRESSIONS:
PROGRAMMING LAB MANUAL [2013]
Veermata Jijabai Technical Institute, Mumbai Page 59
7 FUTURE SCOPE: CalcWizard 1.0 has a lot of future scope in terms of more advanced features. 7.1 A BETTER GRAPH PLOTTER: The current graph plotter plots the approximate graph. A more accurate graph plotter will be more beneficial and will lead to better approximation. 7.2 VOICE ENABLED INPUT: Java has introduced new javax.speech API. This API can be used to construct voice recognition patterns and can be particularly helpful for those with impaired vision. Sphinx is also a particularly helpful software for voice recognition. 7.3 BETTER GUI: AWT has its limits and the project can see a lot of improvement in terms of GUI. 7.4 FACILITY TO DIFFERENTIATE: Differentiation is another math operation common in engineering math. But unlike integration it is more easily solvable applying certain operations. However its building requires time as one must first store all the basic differentials, and then using rules one can recursively find the differential. 7.5 COMPATIBLE FOR MOBILE ENVIRONMENT: With the advent of smartphones, one can easily deploy such small applications on the phones advanced OS. Perhaps the android SDK is closely related to java, however may require some time because of some of its different syntax, like xml, manifest files. 7.6 STATISTICS MODE AND ECO MODE: While the CalcWizard 1.0 mainly aimed towards engineering applications, future scopes could include features to calculate statistical graphs, ogives and calculating and analyzing simple economic and accounting data easily. 8 CONCLUSION: Thus an advanced calculator was implemented using java which aims to simplify calculation of various complexities and suited for various users. PROGRAMMING LAB MANUAL [2013]
Veermata Jijabai Technical Institute, Mumbai Page 60
Name of the Assessing Faculty: Asst Prof. Ashwini Potnis