Incomplete easy-to-use math solver and PDF generator.

Overview

Math Expert

Let me do your work

Preview

preview.mp4

Introduction

Math Expert is our (@salastro, @younis-tarek, @marawn-mogeb) math high school graduation project. The project tackles the problem of generating beautiful, quick, and useful mathematics. While most software can either only generate beautiful formatted PDF (i.e. LaTeX) or sufficiently solve mathematical problems (e.g. Wolfram|Alpha). There may be, however, alternatives to these tools, yet they can not fully grasp the potential of either of them or are slow and hard to use. Therefore, this project tries to do what others failed.

Inner Workings

Our approach was to create an easy-to-use graphical user interface (GUI) that uses different components to reach our goal. LaTeX is the main PDF generation backend due to its indubitable abilities and speed; it is the universal standard for mathematical notation. However, it is reasonably hard to use making it difficult to use in a short-term practical context. This makes the application even more useful. It was mainly interacted with through PyLaTeX; it provides a usable set of commands that make use of LaTeX's capabilities. The standard article document class with numbered math alignment environment and TikZ drawings was used.

Although both SymPy and NumPy were used, the focus was on SymPy due to its nature of symbolic manipulation and its alignment with the goals of the project. The latter is powerful in mathematical evaluations, which — although supported — is not the focus of this project. The results of all functions, other than Evaluate, are performed through SymPy. It provides more than one function to perform some of the operations at hand, but the one that proves to be the most effective is used. For example, there are integrate and manualintegrate, and although the latter can show steps (non-human-readable), the former was chosen for its wide variety of solutions.

Unlike the previous two, the choice of a GUI framework was not a straightforward decision. Kivy was a serious candidate, but due to its own unique syntax for designing being its bedrock and lack of some convenient Python capabilities use, it was not feasible. Another option was Tkinter, which is considered the main framework for Python. However, it is very lacking some modern UI design features and is not plain sailing in some considerable aspects. The final option was PyQt5, which is a Python binding for the Qt cross-platform framework. Basically utilizing all of the powerful aspects of the Qt framework, which avoids the aforementioned limitations, while maintaining a usable toolkit. A highly programmable interface that is easily integrable into other environments was the product of this decision.

Philosophy

Although the infamous it just works are spread throughout the codebase, which is not ideal for a structured project, the goal of our is to define a great code that follows best practices (e.g. PEP 8) to have a readable, maintainable, and legacy-free codebase to stand in the way of passing time for the longest. As such, a minimal amount of code is necessary to avoid using breakable functions; a suitable modus operandi is the suckless philosophy. On the other hand, extensibility and customizability are as important. Unix philosophy is the one method that is well-regarded as the jewel in the crown.

Object orientation was used due to its inheritance, encapsulation, and other proprieties; some of which can not be achieved through modularity alone resulting in a more complex codebase. In addition, the structural way PyLaTeX handles documents would make it even harder to avoid object-oriented programming, despite its known disadvantages. However, parts of SymPy and NumPy code were written more procedurally.

Codebase

As mentioned above, the goals of the code are minimalism, functionality, extensibility, and customizability. The program is divided into 3 separate files: gui.py for all of the UI elements, func.py for all the operations on documents, and main.py for the main program and linking of the two. This was to ease the switching of undesired modules and separate development based on the working context.

func.py was mainly structured as one class (MathDoc) with multiple methods for document manipulation (e.g. Inte, Diff, etc). The class is instantiated and used in main.py in the __name__ == "__main__" if statement after the imports outside the conditional; on every button click the corresponding method is called. In contrast, explicit mentions of gui.py are rare (besides the linkage ones) since all of its handlings is in the file itself.

Properties

Advantages

  • Easy-to-use
  • Fast
  • Accurate
  • Concise Formatting
  • Extensible
  • Programmable

Disadvantages

  • poor error handling
  • limited syntax input
  • limited operations
  • no-preview before add
  • undoable actions

Neutral

  • Unappealing UI
  • No indication when unsolvable

Future plans

See issues

Usage

Although the interface is obvious, some clarifications may need to be made.

  • First text input is the file name without extension
  • Second text input is the document title
  • Third text input is the author(s) title
  • Fourth (and last) text input is the mathematical expression to be operated on
    • Euler's number should be written as exp(x) instead of e^(x)
    • log is the natural logarithm.
    • Multiplication should be written in the form 2*x
  • After defining all the previous inputs, click Generate PDF
  • Choose the type of operation you want to perform, then click Generate PDF again

Dependences

Building

Running

COCOMO estimates

Using scc

───────────────────────────────────────────────────────────────────────────────
Language                 Files     Lines   Blanks  Comments     Code Complexity
───────────────────────────────────────────────────────────────────────────────
Python                       4       465       36        24      405         17
───────────────────────────────────────────────────────────────────────────────
Total                        4       465       36        24      405         17
───────────────────────────────────────────────────────────────────────────────
Estimated Cost to Develop (organic) $10,457
Estimated Schedule Effort (organic) 2.431055 months
Estimated People Required (organic) 0.382159
───────────────────────────────────────────────────────────────────────────────
Processed 19228 bytes, 0.019 megabytes (SI)
───────────────────────────────────────────────────────────────────────────────
Comments
  • Better logs

    Better logs

    They look ugly and increase loc with a lot of repetition. I am not used to using it so it will take me some time until I discover how to get around the logs.

    enhancement 
    opened by salastro 2
  • Code refactoring

    Code refactoring

    Some aspects of the code are written badly.

    For reference:

    • https://stackoverflow.com/questions/20873259/pyqt-how-to-dynamically-update-widget-property-on-outer-variable-value-change
    enhancement 
    opened by salastro 2
  • Automated tests

    Automated tests

    They basically exist in the __main__ in func.py For reference:

    • https://www.youtube.com/watch?v=DhUpxWjOhME
    • https://stackoverflow.com/questions/27954702/unittest-vs-pytest
    • https://docs.python.org/3/library/unittest.html
    • https://docs.pytest.org/
    enhancement 
    opened by salastro 1
  • Better define methods in `main.py`

    Better define methods in `main.py`

    Currently, exec is used, which is very unpythonic and inefficient. There should be a way to get all the functions in the func.py and link them accordingly.

        operations = ["inte", "diff", "lim", "fact", "sol",
                      "simp", "eval", "plot", "generate_pdf", "generate_latex"]
    
        for func in operations:
            exec(f"""
                \[email protected]()
                \ndef on_{func}_bt_clicked(self):
                \n    self.mathdoc.{func}(self.expression.toPlainText().\
                    replace(" ", ""))
            """)
    
    bug 
    opened by salastro 1
  • Show steps

    Show steps

    Since the functions that do not operate on a human level are more advanced in solving problems, it would be great if it is possible to check if the problem is solvable with human steps and then use the function that shows the results. Mainly integration and differentiation are my concern.

    enhancement 
    opened by salastro 0
  • Integration hangs

    Integration hangs

    Sometimes when integration is unsolvable (even by other more advanced calculators) it just halts.

    Possible solutions are:

    • restricting the computational resources of the process
    • adding a timeout (e.g. of 10 seconds) for the process
    • creating an external watchdog for the management of the program flow
    bug 
    opened by salastro 1
  • LaTeX dependency

    LaTeX dependency

    Tests on my machine went smoothly on both Linux and Windows. However, it was not as smooth for both @marawan-mogeb and @younis-tarek. The only unique thing in my setup on both OSs is having LaTeX (texlive-full on void Linux and MikTeX on Windows) while both do not. The size of a TeX distro is yet to be confirmed, but since there is no advanced PDF formatting (e.g. Arabic support) TinyTeX should work. @younis-tarek plans to further test this in the future.

    bug documentation 
    opened by salastro 2
Releases(0.2)
Owner
SalahDin Ahmed
A computers magician who uses simple spells.
SalahDin Ahmed
Code for STFT Transformer used in BirdCLEF 2021 competition.

STFT_Transformer Code for STFT Transformer used in BirdCLEF 2021 competition. The STFT Transformer is a new way to use Transformers similar to Vision

Jean-François Puget 69 Sep 29, 2022
Here I will explain the flow to deploy your custom deep learning models on Ultra96V2.

Xilinx_Vitis_AI This repo will help you to Deploy your Deep Learning Model on Ultra96v2 Board. Prerequisites Vitis Core Development Kit 2019.2 This co

Amin Mamandipoor 1 Feb 08, 2022
MiniHack the Planet: A Sandbox for Open-Ended Reinforcement Learning Research

MiniHack the Planet: A Sandbox for Open-Ended Reinforcement Learning Research

Facebook Research 338 Dec 29, 2022
Official implementation of ACMMM'20 paper 'Self-supervised Video Representation Learning Using Inter-intra Contrastive Framework'

Self-supervised Video Representation Learning Using Inter-intra Contrastive Framework Official code for paper, Self-supervised Video Representation Le

Li Tao 103 Dec 21, 2022
Monitora la qualità della ricezione dei segnali radio nelle province siciliane.

FMap-server Monitora la qualità della ricezione dei segnali radio nelle province siciliane. Conversion data Frequency - StationName maps are stored in

Triglie 5 May 24, 2021
Pytorch implementation of SimSiam Architecture

SimSiam-pytorch A simple pytorch implementation of Exploring Simple Siamese Representation Learning which is developed by Facebook AI Research (FAIR)

Saeed Shurrab 1 Oct 20, 2021
An University Project of Quera Web Crawling.

WebCrawlerProject An University Project of Quera Web Crawling. خزشگر اینستاگرام در این پروژه شما باید با استفاده از کتابخانه های زیر یک خزشگر اینستاگر

Mahdi 3 Aug 12, 2022
[CVPR22] Official codebase of Semantic Segmentation by Early Region Proxy.

RegionProxy Figure 2. Performance vs. GFLOPs on ADE20K val split. Semantic Segmentation by Early Region Proxy Yifan Zhang, Bo Pang, Cewu Lu CVPR 2022

Yifan 54 Nov 29, 2022
Official Implementation of "DialogLM: Pre-trained Model for Long Dialogue Understanding and Summarization."

DialogLM Code for AAAI 2022 paper: DialogLM: Pre-trained Model for Long Dialogue Understanding and Summarization. Pre-trained Models We release two ve

Microsoft 92 Dec 19, 2022
Shape Matching of Real 3D Object Data to Synthetic 3D CADs (3DV project @ ETHZ)

Real2CAD-3DV Shape Matching of Real 3D Object Data to Synthetic 3D CADs (3DV project @ ETHZ) Group Member: Yue Pan, Yuanwen Yue, Bingxin Ke, Yujie He

24 Jun 22, 2022
Official codebase for ICLR oral paper Unsupervised Vision-Language Grammar Induction with Shared Structure Modeling

CLIORA This is the official codebase for ICLR oral paper: Unsupervised Vision-Language Grammar Induction with Shared Structure Modeling. We introduce

Bo Wan 32 Dec 23, 2022
A spherical CNN for weather forecasting

DeepSphere-Weather - Deep Learning on the sphere for weather/climate applications. The code in this repository provides a scalable and flexible framew

DeepSphere 47 Dec 25, 2022
FastReID is a research platform that implements state-of-the-art re-identification algorithms.

FastReID is a research platform that implements state-of-the-art re-identification algorithms.

JDAI-CV 2.8k Jan 07, 2023
Parallel Latent Tree-Induction for Faster Sequence Encoding

FastTrees This repository contains the experimental code supporting the FastTrees paper by Bill Pung. Software Requirements Python 3.6, NLTK and PyTor

Bill Pung 4 Mar 29, 2022
Learning Off-Policy with Online Planning, CoRL 2021

LOOP: Learning Off-Policy with Online Planning Accepted in Conference of Robot Learning (CoRL) 2021. Harshit Sikchi, Wenxuan Zhou, David Held Paper In

Harshit Sikchi 24 Nov 22, 2022
Summary Explorer is a tool to visually explore the state-of-the-art in text summarization.

Summary Explorer Summary Explorer is a tool to visually inspect the summaries from several state-of-the-art neural summarization models across multipl

Webis 42 Aug 14, 2022
Unsupervised Image-to-Image Translation

UNIT: UNsupervised Image-to-image Translation Networks Imaginaire Repository We have a reimplementation of the UNIT method that is more performant. It

Ming-Yu Liu 劉洺堉 1.9k Dec 26, 2022
Back to Event Basics: SSL of Image Reconstruction for Event Cameras

Back to Event Basics: SSL of Image Reconstruction for Event Cameras Minimal code for Back to Event Basics: Self-Supervised Learning of Image Reconstru

TU Delft 42 Dec 26, 2022
This is the code of using DQN to play Sekiro .

Update for using DQN to play sekiro 2021.2.2(English Version) This is the code of using DQN to play Sekiro . I am very glad to tell that I have writen

144 Dec 25, 2022
Collects many various multi-modal transformer architectures, including image transformer, video transformer, image-language transformer, video-language transformer and related datasets

The repository collects many various multi-modal transformer architectures, including image transformer, video transformer, image-language transformer, video-language transformer and related datasets

Jun Chen 139 Dec 21, 2022