Skip to content

[RFC]: build symbolic math library #147

Closed
@AlyAbdelmoneim

Description

@AlyAbdelmoneim

Full name

Aly Abdelmoneim

University status

Yes, I am currently a student.

University name

German International University, Cairo

University program

Bachelor of Science in Computer Science

Expected graduation

2027

Short biography

Hello everyone, I'm Aly Abdelmoneim, a sophomore CS student at the German International University in Egypt. I have a strong passion for both programming and mathematics, with practical experience in Java, C++, and JavaScript. Throughout my academic journey, I've completed various courses including Calculus I & II, Linear Algebra, Number Theory, and Statistics, which sparked my interest in applying mathematical concepts to programming. Over the past few months, I've been diving deeper into the intersection of programming and math, focusing on solving mathematical problems and implementing computational solutions. I am particularly fascinated by how we can leverage symbolic computation and automata theory in building powerful, mathematical applications.

Timezone

UTC +2:00

Contact details

Platform

Mac

Editor

  • VSCode: A lightweight and highly customizable text editor. I use it for everyday development because of its speed and ease of use.
  • Neovim: A text editor for geeks, where I dive deep into configuring my environment to suit my needs. It's great for getting hands-on experience with OS-level tools, compilers, and linters.

Programming experience

My programming experience is mostly in Java, where I’ve developed games, chat applications, and some operating system simulators. I’ve also worked on several projects in C++, especially in competitive programming and problem-solving. Recently, I started learning JavaScript for web development and completed a few projects using the MERN stack (MongoDB, Express, React, Node.js). Additionally, I have some experience with Rust, which I explored while studying system programming and low-level programming concepts.

JavaScript experience

I've been learning JavaScript recently, mostly for university assignments. One of my favorite features of JavaScript is that functions are first-class citizens, which I didn't encounter in previous languages like Java. However, my least favorite feature is dynamic typing, as coming from Java, I find it challenging to work without explicit type definitions.

Node.js experience

I’ve been working with Node.js for web development for the past 2-3 months, and this is my first serious exposure to it. I have used it to create full-stack applications and explore various JavaScript tools and libraries.

C/Fortran experience

I have limited experience with C while studying Operating Systems, but I have no experience with Fortran.

Interest in stdlib

I'm interested in stdlib because it offers a collection of useful, well-documented tools for everyday programming tasks. It’s an excellent resource for extending the functionality of JavaScript with minimal effort. I’m particularly drawn to the math utilities provided by stdlib—they help with complex computations and save time by offering optimized solutions. This aligns with my interest in mathematical computation and practical coding.

Version control

Yes, I use Git for version control in almost all of my projects, from simple scripts to large-scale applications. I’m familiar with GitHub for managing repositories and collaborating with others.

Contributions to stdlib

I have contributed to stdlib by fixing linting errors and other minor issues in the repository. I also developed the “nanminmaxabs” module, which is still under development.

stdlib showcase

Symbolic math basics - simplification and evaluation for first-degree equations

Goals

My goal for this project is to implement a symbolic computation module for stdlib, similar to SymPy in Python. The core features will include:

  • Parsing mathematical expressions.
  • Simplifying them.
  • Manipulating algebraic structures such as factoring, expansion, and solving basic equations.

The MVP will focus on building a formal Abstract Syntax Tree (AST), implementing basic simplification, and symbolic arithmetic. This foundation will allow for future development in areas like calculus and advanced equation solving.

Why this project?

I have a strong passion for mathematics and love the idea of making symbolic computation accessible to JavaScript developers. Additionally, I am fascinated by the field of compilers’ design and theoretical computer science, especially in how we can transform strings into complex expressions using parsing tools, automata theory, and compilers. This project aligns perfectly with my interests, and I’m eager to tackle the challenge of implementing it.

Qualifications

I’ve completed several university-level math courses, such as Calculus I & II, Linear Algebra, Number Theory, and Statistics, which have provided me with a solid foundation in mathematical problem-solving. In terms of programming, I have taken courses in Data Structures & Algorithms, Theoretical Computer Science, and JavaScript (Software Engineering course). Additionally, I’ve spent some time reading books on compiler design, such as Introduction to Compilers and Language Design, which gave me a deeper understanding of parsing and language processing.

Prior art

The main reference for this project is the SymPy library in Python. I have studied its features and explored its codebase. Another excellent reference is the repository equation-parser, which provides a structure for parsing mathematical equations and could serve as inspiration for our symbolic computation library.

Commitment

I have a completely free summer, with no major commitments from July to September. Before this period, specifically between 10th june and 25th june, I will be focused on my final exams for the spring semester,but that should not effect my availability, I will be available to start contributing as soon as the community bonding period begins.

Schedule

  • Community Bonding Period:

    • Set up the local development environment.
    • Familiarize myself with the stdlib codebase and contribution process.
    • Finalize the feature plan and milestones.
    • Engage with maintainers to understand coding conventions.
  • Week 1:

    • Implement the basic symbolic expression system (AST nodes like Add, Mul, Pow, Symbol).
    • Add basic pretty-printing and string representation.
  • Week 2:

    • Implement a string parser to convert expressions like "2 * (x + 1)" into an AST.
    • Write tests for expression creation and parsing.
  • Week 3:

    • Implement simplification rules: x + 0 → x, x * 1 → x, x - x → 0, etc.
    • Add a simplification function and test cases.
  • Week 4:

    • Implement a substitution engine: replace variables or sub-expressions.
    • Example: x^2 + 2x + 1 with x = 3 → 16.
    • Write tests for common cases.
  • Week 5:

    • Add support for basic evaluation (numeric): sin(pi) → 0, log(e) → 1.
    • Add math constants (e.g., pi, e) and common functions (sin, cos, log).
  • Week 6 (Midterm):

    • MVP features complete:
      • Expression representation.
      • Parser.
      • Simplification.
      • Substitution.
      • Evaluation.
    • Submit midterm evaluation.
  • Week 7:

    • Add differentiation: d/dx(x^2) → 2x, d/dx(sin(x)) → cos(x).
    • Chain rule, product rule support.
  • Week 8:

    • Improve simplification of derivatives.
    • Add symbolic differentiation tests.
    • Add support for higher-order derivatives.
  • Week 9:

    • Add support for basic integrals: ∫x dx → x^2/2.
    • Implement integration rules and common patterns.
  • Week 10:

    • Add support for expression equality testing.
    • Add identity simplification: sin(x)^2 + cos(x)^2 → 1.
    • Improve simplifier.
  • Week 11:

    • Code freeze: focus on test coverage, edge cases.
    • Improve documentation and examples.
    • Benchmark basic performance.
  • Week 12:

    • Polish code and docs.
    • Write blog post or usage guide.
    • Final submission prep.
  • Final Week:

    • Submit final project report.

Related issues

Issue #25

Checklist

  • I have read and understood the Code of Conduct.
  • I have read and understood the application materials found in this repository.
  • I understand that plagiarism will not be tolerated, and I have authored this application in my own words.
  • I have read and understood the patch requirement which is necessary for my application to be considered for acceptance.
  • I have read and understood the [stdlib

Metadata

Metadata

Assignees

No one assigned

    Labels

    20252025 GSoC proposal.received feedbackA proposal which has received feedback.rfcProject proposal.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions