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 "Graph-Evolving Meta-Learning for Low-Resource Medical Dialogue Generation". [AAAI 2021]

Graph Evolving Meta-Learning for Low-resource Medical Dialogue Generation Code to be further cleaned... This repo contains the code of the following p

Shuai Lin 29 Nov 01, 2022
This project aims to explore the deployment of Swin-Transformer based on TensorRT, including the test results of FP16 and INT8.

Swin Transformer This project aims to explore the deployment of SwinTransformer based on TensorRT, including the test results of FP16 and INT8. Introd

maggiez 87 Dec 21, 2022
codes for paper Combining Dynamic Local Context Focus and Dependency Cluster Attention for Aspect-level sentiment classification

DLCF-DCA codes for paper Combining Dynamic Local Context Focus and Dependency Cluster Attention for Aspect-level sentiment classification. submitted t

15 Aug 30, 2022
Learning to See by Looking at Noise

Learning to See by Looking at Noise This is the official implementation of Learning to See by Looking at Noise. In this work, we investigate a suite o

Manel Baradad Jurjo 82 Dec 24, 2022
Implementing yolov4 target detection and tracking based on nao robot

Implementing yolov4 target detection and tracking based on nao robot

6 Apr 19, 2022
Gesture-Volume-Control - This Python program can adjust the system's volume by using hand gestures

Gesture-Volume-Control This Python program can adjust the system's volume by usi

VatsalAryanBhatanagar 1 Dec 30, 2021
Rlmm blender toolkit - A set of tools to streamline level generation in UDK straight from Blender

rlmm_blender_toolkit A set of tools to streamline level generation in UDK straig

Rocket League Mapmaking 0 Jan 15, 2022
SurvITE: Learning Heterogeneous Treatment Effects from Time-to-Event Data

SurvITE: Learning Heterogeneous Treatment Effects from Time-to-Event Data SurvITE: Learning Heterogeneous Treatment Effects from Time-to-Event Data Au

14 Nov 28, 2022
Official repository of the paper Privacy-friendly Synthetic Data for the Development of Face Morphing Attack Detectors

SMDD-Synthetic-Face-Morphing-Attack-Detection-Development-dataset Official repository of the paper Privacy-friendly Synthetic Data for the Development

10 Dec 12, 2022
This repo is the official implementation for Multi-Scale Adaptive Graph Neural Network for Multivariate Time Series Forecasting

1 MAGNN This repo is the official implementation for Multi-Scale Adaptive Graph Neural Network for Multivariate Time Series Forecasting. 1.1 The frame

SZJ 12 Nov 08, 2022
Data for "Driving the Herd: Search Engines as Content Influencers" paper

herding_data Data for "Driving the Herd: Search Engines as Content Influencers" paper Dataset description The collection contains 2250 documents, 30 i

0 Aug 17, 2021
TianyuQi 10 Dec 11, 2022
LEAP: Learning Articulated Occupancy of People

LEAP: Learning Articulated Occupancy of People Paper | Video | Project Page This is the official implementation of the CVPR 2021 submission LEAP: Lear

Neural Bodies 60 Nov 18, 2022
Bayesian optimisation library developped by Huawei Noah's Ark Library

Bayesian Optimisation Research This directory contains official implementations for Bayesian optimisation works developped by Huawei R&D, Noah's Ark L

HUAWEI Noah's Ark Lab 395 Dec 30, 2022
Collection of TensorFlow2 implementations of Generative Adversarial Network varieties presented in research papers.

TensorFlow2-GAN Collection of tf2.0 implementations of Generative Adversarial Network varieties presented in research papers. Model architectures will

41 Apr 28, 2022
EEGEyeNet is benchmark to evaluate ET prediction based on EEG measurements with an increasing level of difficulty

Introduction EEGEyeNet EEGEyeNet is a benchmark to evaluate ET prediction based on EEG measurements with an increasing level of difficulty. Overview T

Ard Kastrati 23 Dec 22, 2022
[PAMI 2020] Show, Match and Segment: Joint Weakly Supervised Learning of Semantic Matching and Object Co-segmentation

Show, Match and Segment: Joint Weakly Supervised Learning of Semantic Matching and Object Co-segmentation This repository contains the source code for

Yun-Chun Chen 60 Nov 25, 2022
People Interaction Graph

Gihan Jayatilaka*, Jameel Hassan*, Suren Sritharan*, Janith Senananayaka, Harshana Weligampola, et. al., 2021. Holistic Interpretation of Public Scenes Using Computer Vision and Temporal Graphs to Id

University of Peradeniya : COVID Research Group 1 Aug 24, 2022
JupyterLite demo deployed to GitHub Pages 🚀

JupyterLite Demo JupyterLite deployed as a static site to GitHub Pages, for demo purposes. ✨ Try it in your browser ✨ ➡️ https://jupyterlite.github.io

JupyterLite 223 Jan 04, 2023
AI Toolkit for Healthcare Imaging

Medical Open Network for AI MONAI is a PyTorch-based, open-source framework for deep learning in healthcare imaging, part of PyTorch Ecosystem. Its am

Project MONAI 3.7k Jan 07, 2023