diff --git a/Calculators/Beer-Lambert-Law-Calculator/README.md b/Calculators/Beer-Lambert-Law-Calculator/README.md new file mode 100644 index 000000000..d3804813a --- /dev/null +++ b/Calculators/Beer-Lambert-Law-Calculator/README.md @@ -0,0 +1,52 @@ +#

Beer Lambert Law Calculator

+ +## Description :- + +This project is a web-based calculator that implements the **Beer-Lambert Law**: + +\[ A = \varepsilon \cdot c \cdot l \] + +It allows users to calculate the absorbance (\( A \)) of a solution based on: + +- \( \varepsilon \): Molar Absorptivity (L/mol·cm) +- \( c \): Concentration (mol/L) +- \( l \): Path Length (cm) + +## Tech Stacks :- + +- HTML +- CSS +- JavaScript + +## Features :- + +- **Dynamic Formula Display**: The formula is displayed in LaTeX for clarity. +- **Real-Time Results**: Automatically calculates the absorbance when valid inputs are provided. +- **Modern UI**: A responsive design with a stylish dark blue card background. +- **Error Handling**: Ensures all inputs are valid and provides feedback for invalid data. + +## How to Use :- + +1. Enter the values for: + - Molar Absorptivity (\( \varepsilon \)) in L/mol·cm + - Concentration (\( c \)) in mol/L + - Path Length (\( l \)) in cm. +2. Click the **Calculate** button to compute the absorbance (\( A \)). +3. Click the **Clear** button to reset the inputs and results. + +### Example Calculation :- + +#### Case: +- \( \varepsilon = 5000 \, \text{L/mol·cm} \) +- \( c = 0.02 \, \text{mol/L} \) +- \( l = 1 \, \text{cm} \) + +#### Output: +- Absorbance (\( A \)): + \[ + A = \varepsilon \cdot c \cdot l = 5000 \cdot 0.02 \cdot 1 = 100 + \] + +## Screenshots :- + +![image](https://github.com/user-attachments/assets/9988db82-769e-4d6c-95f7-b2f0ed5b3b45) diff --git a/Calculators/Beer-Lambert-Law-Calculator/assets/background.webp b/Calculators/Beer-Lambert-Law-Calculator/assets/background.webp new file mode 100644 index 000000000..2c42b69cb Binary files /dev/null and b/Calculators/Beer-Lambert-Law-Calculator/assets/background.webp differ diff --git a/Calculators/Beer-Lambert-Law-Calculator/index.html b/Calculators/Beer-Lambert-Law-Calculator/index.html new file mode 100644 index 000000000..d5bdc4a94 --- /dev/null +++ b/Calculators/Beer-Lambert-Law-Calculator/index.html @@ -0,0 +1,49 @@ + + + + + + + + + + Beer Lambert Law Calculator + + + +
+

Beer-Lambert Law Calculator

+

+ Formula: + \( A = \varepsilon \cdot c \cdot l \) +

+ +

Where:

+ + + + + + + + + + + + +
+ + +
+
+
+ + + + + \ No newline at end of file diff --git a/Calculators/Beer-Lambert-Law-Calculator/script.js b/Calculators/Beer-Lambert-Law-Calculator/script.js new file mode 100644 index 000000000..12e152cd6 --- /dev/null +++ b/Calculators/Beer-Lambert-Law-Calculator/script.js @@ -0,0 +1,21 @@ +function calculateAbsorbance() { + const epsilon = parseFloat(document.getElementById('epsilon').value); + const concentration = parseFloat(document.getElementById('concentration').value); + const length = parseFloat(document.getElementById('length').value); + + if (isNaN(epsilon) || isNaN(concentration) || isNaN(length)) { + document.getElementById('result').innerText = "Please enter valid numbers for all fields."; + return; + } + + const absorbance = epsilon * concentration * length; + + document.getElementById('result').innerText = `Absorbance (A): ${absorbance.toFixed(2)}`; +} + +function clearInputs() { + document.getElementById('epsilon').value = ''; + document.getElementById('concentration').value = ''; + document.getElementById('length').value = ''; + document.getElementById('result').innerText = ''; +} \ No newline at end of file diff --git a/Calculators/Beer-Lambert-Law-Calculator/style.css b/Calculators/Beer-Lambert-Law-Calculator/style.css new file mode 100644 index 000000000..ca8fcfb8f --- /dev/null +++ b/Calculators/Beer-Lambert-Law-Calculator/style.css @@ -0,0 +1,100 @@ +body { + font-family: 'Roboto', sans-serif; + background-image: url('assets/background.webp'); + background-size: cover; + margin: 0; + padding: 0; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + color: #fff; +} + +.calculator { + background: #1565c0; + padding: 30px; + border-radius: 10px; + box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); + width: 450px; + text-align: center; +} + +h1 { + font-size: 28px; + margin-bottom: 20px; + color: #ffeb3b; +} + +.formula { + font-size: 16px; + margin-bottom: 10px; + color: #ffcc80; +} + +.constant { + font-size: 14px; + margin-bottom: 10px; + color: #bbdefb; +} + +ul { + text-align: left; + margin: 10px 0 20px; + padding-left: 20px; + color: #bbdefb; + font-size: 14px; +} + +label { + font-size: 14px; + margin: 10px 0 5px; + display: block; + text-align: left; + color: #bbdefb; +} + +input { + width: calc(100% - 20px); + padding: 10px; + margin-bottom: 15px; + font-size: 16px; + border: 1px solid #ccc; + border-radius: 5px; +} + +.buttons { + display: flex; + justify-content: space-between; +} + +button { + background-color: #29b6f6; + color: white; + padding: 12px 20px; + border: none; + border-radius: 5px; + font-size: 16px; + cursor: pointer; + margin: 5px; + flex: 1; +} + +button:hover { + background-color: #0288d1; +} + +button:last-child { + background-color: #f44336; +} + +button:last-child:hover { + background-color: #d32f2f; +} + +.result { + margin-top: 20px; + font-size: 18px; + font-weight: bold; + color: #fff; +} \ No newline at end of file diff --git a/calculators.json b/calculators.json index a8d64bebf..0adc275e4 100644 --- a/calculators.json +++ b/calculators.json @@ -233,6 +233,12 @@ "link": "./Calculators/Bayes-Theorem-Calculator/index.html", "source": "https://github.com/Rakesh9100/CalcDiverse/tree/main/Calculators/Bayes-Theorem-Calculator" }, + { + "title": "Beer Lambert Law Calculator", + "description": "Calculates absorbance, concentration, or path length using the Beer-Lambert Law.", + "link": "./Calculators/Beer-Lambert-Law-Calculator/index.html", + "source": "https://github.com/Rakesh9100/CalcDiverse/tree/main/Calculators/Beer-Lambert-Law-Calculator" + }, { "title": "Beta Function Calculator", "description": "Calculate the ß value of two numbers in a single click!",