1. Tablet Weight Variation Testing & IP/USP Compliance Script
The Indian Pharmacopoeia (IP) mandates that for solid oral dosage forms (tablets/capsules), 20 individual units must be weighed randomly from a batch. The mean weight is calculated, and individual weights are compared against permissible percentage deviations. To pass the IP test: not more than 2 individual tablets may deviate from the average weight by more than the percentage limit, and no tablet may deviate by more than twice that percentage.
Evaluating 20 sample Paracetamol 500mg tablets (average weight ~650mg) against IP standards.
import numpy as np
# Sample weights of 20 tablets in milligrams
sample_tablets = np.array([
648, 652, 645, 655, 649, 651, 650, 647, 658, 642,
650, 653, 646, 654, 649, 651, 655, 644, 650, 652
], dtype=float)
avg_wt = np.mean(sample_tablets)
# Determine IP percentage tolerance limit based on average weight
if avg_wt <= 80.0:
limit_pct = 10.0
elif avg_wt < 250.0:
limit_pct = 7.5
else:
limit_pct = 5.0 # For tablets >= 250 mg
dev_1x = avg_wt * (limit_pct / 100.0)
dev_2x = avg_wt * ((limit_pct * 2.0) / 100.0)
deviations = np.abs(sample_tablets - avg_wt)
count_out_1x = np.sum(deviations > dev_1x)
count_out_2x = np.sum(deviations > dev_2x)
passes_ip = (count_out_1x <= 2) and (count_out_2x == 0)
print(f"Average Tablet Weight: {avg_wt:.2f} mg")
print(f"IP Tolerance (±{limit_pct}%): ±{dev_1x:.2f} mg | Double Limit: ±{dev_2x:.2f} mg")
print(f"Tablets outside ±{limit_pct}%: {count_out_1x} (Max allowed: 2)")
print(f"Tablets outside ±{limit_pct*2}%: {count_out_2x} (Max allowed: 0)")
print(f"IP WEIGHT VARIATION RESULT: {'PASSED' if passes_ip else 'FAILED'}")| IP Average Tablet Weight | Permissible Deviation (%) | Max Allowed Outside Limit (out of 20) | Max Allowed Outside Double Limit |
|---|---|---|---|
| 80 mg or less | ± 10.0% | 2 tablets | 0 tablets |
| More than 80 mg and less than 250 mg | ± 7.5% | 2 tablets | 0 tablets |
| 250 mg or more | ± 5.0% | 2 tablets | 0 tablets |
- IP Weight Limits: $\le 80\text{ mg} \rightarrow \pm 10\%$; $80\text{ mg to } 250\text{ mg} \rightarrow \pm 7.5\%$; $\ge 250\text{ mg} \rightarrow \pm 5.0\%$.
- USP Limits follow identical three-tier weight thresholds.
- Relative Standard Deviation (%RSD): $\%RSD = \frac{\text{Standard Deviation}}{\text{Mean}} \times 100$ (Must generally be $< 2.0\%$ for tablet weight uniformity).
आईपी के नियमानुसार 20 गोलियों का औसत वजन निकालकर देखा जाता है कि 2 से अधिक गोलियां तय प्रतिशत सीमा से बाहर न हों और कोई भी गोली दोगुनी सीमा से बाहर न हो।