# madagra/basic-pinn architecture

> Architecture diagram of the GitHub repository madagra/basic-pinn, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/madagra/basic-pinn
- Repository: https://github.com/madagra/basic-pinn

## Overview

Basic PINN is an educational Python package for approximating solutions to differential equations. Users run either the logistic ODE or vibrating-string wave-equation example; each defines its equation loss and sampling procedure, trains a neural network, then plots or animates the result. Shared code provides the network and derivative functions, functional-optimizer training, and visualizations. The examples’ imports and calls are visible in the excerpts; the README documents how users launch them. No storage or external service is part of the runtime architecture.

Main entry points: [`basic_pinn/logistic_equation_1d.py`](https://github.com/madagra/basic-pinn/blob/main/basic_pinn/logistic_equation_1d.py) (Logistic solver), [`basic_pinn/wave_equation_1d.py`](https://github.com/madagra/basic-pinn/blob/main/basic_pinn/wave_equation_1d.py) (Wave solver), [`basic_pinn/pinn.py`](https://github.com/madagra/basic-pinn/blob/main/basic_pinn/pinn.py) (Neural network), [`basic_pinn/training.py`](https://github.com/madagra/basic-pinn/blob/main/basic_pinn/training.py) (PINN training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_examples["Equation examples"]
  node_logistic["Logistic solver"]
  node_wave["Wave solver"]
end

subgraph group_core["PINN core"]
  node_network["Neural network<br/>[pinn.py]"]
  node_derivatives["Derivative functions<br/>[pinn.py]"]
  node_training["PINN training<br/>[training.py]"]
end

subgraph group_results["Visualization"]
  node_plots["Solution plots<br/>[plotting.py]"]
end

node_user(("User"))

node_user -->|"runs example"| node_logistic
node_user -->|"runs example"| node_wave
node_logistic -->|"creates model"| node_network
node_logistic -->|"builds derivatives"| node_derivatives
node_logistic -->|"trains model"| node_training
node_logistic -->|"plots solution"| node_plots
node_wave -->|"creates model"| node_network
node_wave -->|"builds derivatives"| node_derivatives
node_wave -->|"trains model"| node_training
node_wave -->|"animates solution"| node_plots

click node_logistic "https://github.com/madagra/basic-pinn/blob/main/basic_pinn/logistic_equation_1d.py"
click node_wave "https://github.com/madagra/basic-pinn/blob/main/basic_pinn/wave_equation_1d.py"
click node_network "https://github.com/madagra/basic-pinn/blob/main/basic_pinn/pinn.py"
click node_derivatives "https://github.com/madagra/basic-pinn/blob/main/basic_pinn/pinn.py"
click node_training "https://github.com/madagra/basic-pinn/blob/main/basic_pinn/training.py"
click node_plots "https://github.com/madagra/basic-pinn/blob/main/basic_pinn/plotting.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_logistic,node_wave,node_user toneBlue
class node_network,node_derivatives,node_training toneAmber
class node_plots toneMint
```

## Components

### Equation examples

- [Logistic solver](https://github.com/madagra/basic-pinn/blob/main/basic_pinn/logistic_equation_1d.py): `basic_pinn/logistic_equation_1d.py`
- [Wave solver](https://github.com/madagra/basic-pinn/blob/main/basic_pinn/wave_equation_1d.py): `basic_pinn/wave_equation_1d.py`

### PINN core

- [Neural network](https://github.com/madagra/basic-pinn/blob/main/basic_pinn/pinn.py): `basic_pinn/pinn.py`
- [Derivative functions](https://github.com/madagra/basic-pinn/blob/main/basic_pinn/pinn.py): `basic_pinn/pinn.py`
- [PINN training](https://github.com/madagra/basic-pinn/blob/main/basic_pinn/training.py): `basic_pinn/training.py`

### Visualization

- [Solution plots](https://github.com/madagra/basic-pinn/blob/main/basic_pinn/plotting.py): `basic_pinn/plotting.py`

### Other components

- **User**

## Connections

- User → Logistic solver: runs example (evidence: `README.md`)
- User → Wave solver: runs example (evidence: `README.md`)
- Logistic solver → Neural network: creates model (evidence: `basic_pinn/logistic_equation_1d.py`)
- Logistic solver → Derivative functions: builds derivatives (evidence: `basic_pinn/logistic_equation_1d.py`)
- Logistic solver → PINN training: trains model (evidence: `basic_pinn/logistic_equation_1d.py`)
- Logistic solver → Solution plots: plots solution (evidence: `basic_pinn/logistic_equation_1d.py`)
- Wave solver → Neural network: creates model (evidence: `basic_pinn/wave_equation_1d.py`)
- Wave solver → Derivative functions: builds derivatives (evidence: `basic_pinn/wave_equation_1d.py`)
- Wave solver → PINN training: trains model (evidence: `basic_pinn/wave_equation_1d.py`)
- Wave solver → Solution plots: animates solution (evidence: `basic_pinn/wave_equation_1d.py`)
