# erickpe8/calculadora_integrales_dobles architecture

> Architecture diagram of the GitHub repository erickpe8/calculadora_integrales_dobles, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/erickpe8/calculadora_integrales_dobles
- Repository: https://github.com/erickpe8/calculadora_integrales_dobles

## Overview

##### Project type and purpose
- This is a standalone desktop application in Python that provides an interactive GUI (Tkinter) for computing and visualizing double integrals.
- The user enters a function f(x,y) and integration limits, clicks buttons to calculate the integral (via SymPy & NumPy) and to render a 3D plot (via Matplotlib).

##### File structure
- Top-level:
- README.md – project description
- main.py – application entry point and GUI wiring
- modulos/ – Python package containing core logic
– calculadora.py – parsing input and computing integrals
– graficador.py – generating 3D plots
- No separate “frontend” vs “backend” servers; all modules run in the same process.

##### Key insights from the README
- Three stages: Data input (GUI), Calculation (SymPy/NumPy), Visualization (Matplotlib).
- Dependencies: Tkinter (GUI), SymPy (symbolic math), NumPy (numerical arrays), Matplotlib (3D rendering).

##### Main components
a. User Interface (Tkinter GUI in main.py)
b. Controller/Orchestrator (main.py event handlers)
c. Calculation Module (modulos.calculadora using SymPy & NumPy)
d. Visualization Module (modulos.graficador using Matplotlib)
e. External Libraries (SymPy, NumPy, Matplotlib, Tkinter)
f. Python Runtime / OS Environment

##### Interactions and data flow
- The user enters data in the GUI →
- main.py invokes modulos.calculadora →
- calculadora parses the expression, calls SymPy for symbolic integration, NumPy for numeric evaluation →
- Result returns to main.py → displayed in GUI →
- On “Mostrar Gráfica,” main.py calls modulos.graficador →
- graficador generates a 3D Matplotlib figure → embedded or shown in a new window.

##### Architectural patterns and design principles
- Separation of concerns:
- UI layer (Tkinter) vs
- Business logic (calculation) vs
- Presentation logic (plotting).
- Single-process modular design—easy to extend (e.g., add more visualization modules).
- Dependency inversion: modules depend on abstracted external libraries without embedding them directly in UI code.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Application Code
    subgraph "Application Code"
        direction TB
        M["main.py (UI & Controller)"]:::ui
        subgraph "modulos package"
            direction TB
            Init["__init__.py"]:::core
            Calc["calculadora.py"]:::core
            Graph["graficador.py"]:::core
        end
    end

    %% External Libraries & Runtime
    subgraph "External Dependencies"
        direction TB
        Tk["Tkinter"]:::ext
        SYM["SymPy"]:::ext
        NP["NumPy"]:::ext
        MPL["Matplotlib"]:::ext
        RMD["README.md"]:::ext
    end

    PY["Python Runtime / OS"]:::ext

    %% User
    U["User"]:::ext

    %% Data Flow
    U -->|"input function & limits"| M
    M -->|"calls calculadora.parse_and_compute()"| Calc
    Calc -->|"uses SymPy for symbolic integration"| SYM
    Calc -->|"uses NumPy for numeric evaluation"| NP
    Calc -->|"returns integral result"| M
    M -->|"display result"| U
    M -->|"calls graficador.plot_3D()"| Graph
    Graph -->|"generates 3D plot"| MPL
    Graph -->|"returns plot object"| M
    M -->|"show plot"| U

    %% Dependencies
    M -->|"imports Tkinter"| Tk
    M -->|"imports calculadora, graficador"| Init
    Graph -->|"imports Matplotlib"| MPL

    %% Runtime
    M --> PY
    Calc --> PY
    Graph --> PY

    %% Click Events
    click M "https://github.com/erickpe8/calculadora_integrales_dobles/blob/main/main.py"
    click Calc "https://github.com/erickpe8/calculadora_integrales_dobles/blob/main/modulos/calculadora.py"
    click Graph "https://github.com/erickpe8/calculadora_integrales_dobles/blob/main/modulos/graficador.py"
    click Init "https://github.com/erickpe8/calculadora_integrales_dobles/blob/main/modulos/__init__.py"
    click RMD "https://github.com/erickpe8/calculadora_integrales_dobles/blob/main/README.md"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef core fill:#90EE90,stroke:#333,stroke-width:1px
    classDef ext fill:#D3D3D3,stroke:#333,stroke-width:1px
```
