A Flask-based backend system that provides interactive calculators for Trigonometry and Compound Interest problems, integrated with beautiful frontend templates.
- Calculate Sec C + Cot A for any right triangle
- Works with both Pythagorean triplets and non-integer hypotenuses
- Interactive triangle diagram with dynamic dimensions
- Step-by-step solution display
- Fraction-based calculations for precise results
- Automatic hypotenuse calculation using Pythagorean theorem
- Find interest rates from principal, amount, and time
- Calculate compound amounts for any time period
- Detailed step-by-step calculations
- Fraction simplification for rate factors
- Professional mathematical layout
-
Clone or download the project
cd /home/rajan/Downloads/Backend/project
-
Install dependencies
pip install -r requirements.txt
-
Run the application
python app.py
-
Access the application
- Open your browser and go to:
http://localhost:5000
- Or access directly:
http://0.0.0.0:5000
- Open your browser and go to:
- POST
/trigonometry
- Input:
{"perpendicular": 7, "base": 24}
- Output: Complete trigonometry calculations with fractions
- Input:
-
POST
/interest/rate
- Input:
{"principal": 12000, "amount": 20736, "time": 3}
- Output: Interest rate calculation with steps
- Input:
-
POST
/interest/amount
- Input:
{"principal": 12000, "rate": 20, "time": 2}
- Output: Compound amount calculation
- Input:
- Go to
http://localhost:5000/template1
- Enter perpendicular and base values
- Get instant calculation of Sec C + Cot A
- View step-by-step solution with triangle diagram
- Go to
http://localhost:5000/template2
- Enter principal, amount, and time values
- Specify calculation time period
- Get complete solution with rate finding and amount calculation
project/
├── app.py # Main Flask application
├── requirements.txt # Python dependencies
├── templates/ # HTML templates
│ ├── index.html # Main landing page
│ ├── template1.html # Trigonometry calculator
│ └── template2.html # Compound interest calculator
├── static/ # Static assets
│ ├── arrow.png # Arrow image for templates
│ └── interesticon.png # Interest calculator icon
└── README.md # This file
- Flask Framework: Lightweight and flexible web framework
- CORS Support: Cross-origin resource sharing enabled
- Fraction Calculations: Precise mathematical calculations using Python's fractions module
- Input Validation: Comprehensive error handling and validation
- RESTful API: Clean API design for frontend integration
- Responsive Design: Works on desktop and mobile devices
- Interactive Forms: Real-time input validation
- Dynamic Updates: Live calculation updates without page refresh
- Professional Layout: Maintains original template styling
- Error Handling: User-friendly error messages
- Pythagorean Triplets: Automatic verification of right triangle properties
- Fraction Arithmetic: Exact calculations without floating-point errors
- Compound Interest: Precise rate calculations using nth root methods
- Step-by-Step Solutions: Detailed mathematical breakdowns
- Input: Perpendicular = 7, Base = 24
- Output: Sec C + Cot A = 4/3
- Verification: 7, 24, 25 is a Pythagorean triplet
Non-Pythagorean Example:
- Input: Perpendicular = 5, Base = 6
- Output: Sec C + Cot A = 1834/859 ≈ 2.135
- Hypotenuse: √61 ≈ 7.81 (automatically calculated)
- Input: Principal = ₹12,000, Amount = ₹20,736, Time = 3 years
- Output: Rate = 20%, Amount in 2 years = ₹17,280
To extend the system:
- Add new calculation types: Extend the calculator classes in
app.py
- Create new templates: Add HTML files in the
templates/
directory - Add new endpoints: Create new routes in the Flask application
- Enhance frontend: Modify JavaScript functions in the templates
- Port already in use: Change the port in
app.py
(line:app.run(port=5001)
) - Missing dependencies: Run
pip install -r requirements.txt
- Images not loading: Ensure images are in the
static/
directory - CORS errors: The application includes CORS support by default
- "Not a valid right triangle": The entered dimensions don't form a Pythagorean triplet
- "Amount must be greater than principal": Invalid compound interest input
- "All values must be positive": Negative or zero values entered
This project is created for educational and demonstration purposes.