project
Final Project: Mathmatical Writing Conventions
A. Goals:
(1)this project allows students to combine techniques learned in this course to solve a real-world problem
(2) Allow students to proctice team work
(3) Allow students to search for relevent references to apply to project development
B. Problem specifications: when a mathmatician submits his/her paper manuscript to a journal for publication, the first thing the journal will do is to check if the author composes the paper by following mathmatical writing conventions. In this project you are asked to develop a utility program in Java that scans a paper manuscript written in Tex to detect non-conventional math expressions, then recommend an reformatting that follows the math writig conventions. Each mathmatical expression is enclosed in \$..\$ or \$\$ ..\$\$. The following is a typical set of conventions
(a) Fraction preferrence: preferring fractions to decimal point numbers: Non-conventional Recommended Conventional $2.5$ $\frac{5}{2}$ (b) Multiple-character identifiers: although it is common to use multiple-character variables in programs, it is discouraged to use multiple-character variables in math writing because it has been a long-time convention to simplify $x \cdot y$ to $x y$. Therefore, we need to detect possible multiple-character variables and separate the letters to force author to change them. Non-conventional Recommended Conventional xy x y A\alpha A \alpha (c) Fraction format: As an exponent, a fraction should appear in the short format. In other cases, a fraction should always be presented in the tall format. Non-conventional Recommended Conventional $e^{\frac{x^2}{2}}$ $e^{x^2/2}$ $(x+y)/2$ $\frac{x+y}{2}$ (d) Balanced fraction: If a denaminator is very short, say, containing a single letter, but the numerator is very long, it should use a short fraction Non-conventional Recommended Conventional $\frac{A + x + \alpha + 213}{2}$ $\frac{1}{2}(A + x + \alpha + 213)$ (e) In a sum of multiple terms, long terms go before simple short terms, both kinds go before numbers Non-conventional Recommended Conventional $2 + {x \over y}$ ${x \over y} + 2$ $C + \int f(x)dx$ $\int f(x)dx + C$ (f) In a sum of multiple terms of single letters, captial letters go before lowercases, English letters go before Greek letters, and all of them go before numbers. Non-conventional Recommended Conventional $2 + \alpha + A +b$ $A + b + \alpha + 2$ $\delta + 2 + \Delta + b +Z$ $Z + b + \Delta + \delta + 2$ (g) In a product of multiple factors, the short ones go before longer ones. Non-conventional Recommended Conventional $ \int f(x) dx 2 $ $2 \int f(x) dx$ $(x+y) 2$ $2 (x+y)$ (h) In a product of multiple factors, absolute numbers, including $\pi$ and$e$, go before other letters Non-conventional Recommended Conventional $ \int f(x) dx 100 $ $100 \int f(x) dx$ $(x+y) \pi$ $\pi (x+y)$ (i) In an integral, absolute numbers, including $\pi$ and$e$, if serving as factors in the integration function, should be moved to outside of the integral Non-conventional Recommended Conventional $ \int 2 \pi f(x) dx 2 $ $2 \pi \int f(x) dx$ C. Program setting: your Java program should take a manuscript.tex file as input and output a list of recommended math expressions that follow the writing conventions. Each item is led by an ordering number and ends with two new line characters. For example, for mypaper1.tex:
Some plain text. then $2.5$ Some other plain text, then $xy$ $A\alpha$ more plain text, then $e^{\frac{x^2}{2}}$ $(x+y)/2$ more plain text, then $\frac{A + x + \alpha + 213}{2}$ more plain text, then $2 + {x \over y}$ $C + \int f(x)dx$ more plain text, then $2 + \alpha + A +b$ $\delta + 2 + \Delta + b +Z$ more plain text, then $ \int f(x) dx 2 $ $(x+y) 2$ more plain text, then $ \int f(x) dx 100 $ $(x+y) \pi$ more plain text, then $ \int 2 \pi f(x) dx 2 $
The output should be
1. $\frac{5}{2}$ 2. $x y$ 3. $A \alpha$ 4. $e^{x^2/2}$ 5. $\frac{x+y}{2}$ 6. $\frac{1}{2}(A + x + \alpha + 213)$ 7. ${x \over y} + 2$ 8. $\int f(x)dx + C$ 9. $A + b + \alpha + 2$ 10. $Z + b + \Delta + \delta + 2$ 11. $2 \int f(x) dx$
D. How to submit: by the due date, your have to enter your program codes below and click the Test button from the tool bar (the Test button will not be avaiable until the due date). Your program will be sent to server to compile and execute against a random manuscript.tex file. The manuscript.tex file will be similar to the above and simulates a manuscipt file submitted by math research author. The outputs will be graded right on the server.
E. Grading policy: if your program does not compile or contains infinite loops, your grade will be zero. Therefore, you should test your program thoroghly on your own computer against more testing files before your submit. The random manuscript file will contain 20 math expressions, each worthing 5%.
F. Teamwork: Each team consists of two students
G. Hint: the following techniques, but limited to these, will be possibly needed: (1) String class (2) loops (3) finite state machine (4) parsing file (5) array and array list (6) customized sorting of Arrays.sort