
Sigma Notation > Python Code

Pi Notation > Python Code
Inspiration
On smellsLikeTeamSpirit, we're all very passionate about math. Many of our own individual programming projects have some mathematical application to them, like our project at last year's Hackathon, which sought to add arbitrary precision to the fundamental functions in Java such as cosine and apply that to a Mandelbrot set calculation. Over our years of experience, however, we've noticed how tedious and difficult it can be sometimes to convert mathematical formulae into real, runnable code. Our project seeks to eliminate this annoyance, and provide a tool for mathematicians to use an intuitive UI to go right from that maths notation to the programming language of his or her choice without a thought, allowing the programmer to copypaste the code generated right into projects.
What it does
Our program prompts the user to create either a sigma notation or a pi notation expression, input its upper and lower bounds, and specify the function acting on each new integer each iteration. The program will then generate valid Python code that is equivalent to this mathematical relationship that the programmer then copies into his or her program.
How I built it
We used Python for all of the string manipulation and expression parsing, and wxPython for all of the GUI. Originally the goal had been to implement a machine library as well, but time constraints did not all for this. We divided the project into two branches, one dealing with GUI, the other dealing with the expression manipulation. These two parts were designed in such a way that allows for the addition of more formulae with relative ease.
Challenges I ran into
We tried to get some sort of interpretation of user input to display expressions in a clearer format, similar to the service that _ Desmos _ provides, with fractions for instance being displayed vertically rather than in one long string with division symbols and parentheses obscuring the meaning, but this proved to be too challenging to implement in one evening. In lieu of this feature, we attempted to include a markdown interpretive window, but this too proved to be futile with platform and package limitations, so we finally were forced to settle with the function portion of the program requiring a valid Python expression.
Accomplishments that I'm proud of
We discovered an algorithm that allows a computer to pair parentheses together in a mathematical expression, which is incredibly useful for any kind of expression parsing. Our team also first struggled at dividing the project into portions for each individual, but over the course of the night our teamwork skills improved and learned to better code as a team. Finally, we deepened our understanding of the wxPython graphics library which will only streamline future projects involving GUI's
What I learned
Don't bite off more than you can chew. Strive for a minimalviable product, and then expand once you've succeeded in that. Sometimes the most elegant solution isn't the easiest to implement
What's next for Mathematical Notation Interpreter
Adding a notationrecognizing picturemachinelearning algorithm that would simplify the UI and allow the user to simply capture a picture of the notation with their phone and automatically get the code. Basic integral and derivative calculation is also a must, and support for some basic linear algebra would also be relatively easy. This is in the end only a minor improvement over the existing relationship between mathematical notation and programming languages, however; the connection between two equivalent expressions in either notation is only apparent in one direction using this tool, so in the future, programming languages will have to provide native support for directly adding and editing mathematical expressions within themselves, and this tool could be the first step into building that native support.
Built With
 python
 wxpython
Log in or sign up for Devpost to join the conversation.