eng-calc / README.md
frankthtank's picture
Update README.md
9ad4750 verified
---
title: Eng Calc
emoji: 🏒
colorFrom: indigo
colorTo: green
sdk: gradio
sdk_version: 5.36.2
app_file: app.py
pinned: false
license: agpl-3.0
short_description: engineering calculator
---
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
# Engineering Calculator
A comprehensive Gradio-based web application providing multiple calculator modes for engineering, scientific, and programming calculations.
## Features
### Calculator Modes
- **Standard Calculator**: Basic arithmetic with infinite precision
- **Scientific Calculator**: Trigonometric functions, logarithms, and advanced mathematical operations
- **Programming Calculator**: Base conversions and bitwise operations
- **Engineering Calculator**: Specialized engineering calculations including 3-phase impedance analysis
### Key Capabilities
- **Infinite Precision Arithmetic**: No precision loss for basic operations (addition, subtraction, multiplication, division)
- **Calculation History**: Track and review previous calculations
- **Memory Functions**: Store and recall values
- **AI Assistant**: Interactive chat interface for calculation help (placeholder)
- **Complex Number Support**: Full support for complex numbers with j notation for electrical engineering
## Installation
1. Clone the repository:
```bash
git clone <repository-url>
cd calculator
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Run the application:
```bash
python app.py
```
The application will start on `http://localhost:7860`
## Engineering Functions
### 3-Phase Impedance Calculator
Calculate equivalent impedance matrices for 5-wire power systems (A, B, C, N, PE) using:
- Modified Carson's equations for earth return effects
- Kron reduction technique for system simplification
- IEEE standard electrical engineering practices
**Input Parameters:**
- Conductor coordinates (feet)
- Conductor electrical parameters (resistance in Ξ©/mile, GMR in feet)
**Output:**
- 5Γ—5 primitive impedance matrix
- 3Γ—3 reduced phase impedance matrix
- Distance calculations between conductors
- Matrix analysis and properties
## Project Structure
```
calculator/
β”œβ”€β”€ app.py # Main Gradio application
β”œβ”€β”€ requirements.txt # Python dependencies
β”œβ”€β”€ README.md # This file
β”œβ”€β”€ CLAUDE.md # Development guidance
β”œβ”€β”€ calculator/ # Core calculator modules
β”‚ β”œβ”€β”€ __init__.py
β”‚ └── core.py # Calculator classes
β”œβ”€β”€ engineering/ # Engineering calculations
β”‚ β”œβ”€β”€ __init__.py
β”‚ └── impedance.py # 3-phase impedance calculator
β”œβ”€β”€ tests/ # Test files (to be implemented)
└── static/ # CSS and JavaScript assets
```
## Usage Examples
### Standard Calculator
- Basic arithmetic operations with button interface
- Memory functions (MS, MR, MC)
- Calculation history tracking
### Scientific Calculator
- Trigonometric functions (sin, cos, tan, etc.)
- Inverse trigonometric functions (asin, acos, atan)
- Logarithmic functions (log, ln)
- Angle mode selection (degrees/radians)
### Programming Calculator
- Base conversions between decimal, binary, hexadecimal, and octal
- Support for various input formats
### Engineering Calculator
- Load test data for quick verification
- Input conductor coordinates and electrical parameters
- Calculate comprehensive impedance analysis
## Development
### Running Tests
```bash
python -m pytest tests/ # When test suite is implemented
```
### Adding New Engineering Functions
1. Implement the calculation logic in the `engineering/` module
2. Add the function to the dropdown in `app.py`
3. Create the corresponding input interface
4. Update this README with usage instructions
## Dependencies
- **Gradio**: Web interface framework
- **NumPy**: Numerical computations and matrix operations
- **Pandas**: Data analysis and manipulation
- **Matplotlib**: Plotting and visualization
- **Seaborn**: Statistical visualization
## License
[Add license information here]
## Contributing
[Add contributing guidelines here]