# Chemical purity and enantiomeric composition
All mixtures are hypothetical, not experimental measurements. Calculations were executed in the session's Python notebook using NumPy, pandas and Matplotlib. The exported Python script reproduces the calculations and figure with standard Matplotlib styling.

## Basis and definitions
Every mixture contains **100 mol total**: L mol of one enantiomer, R mol of its mirror image, and I mol of an unrelated achiral impurity. L/R are teaching labels, not formal R/S configurations or signs of optical rotation. All percentages use moles; no mass-percent or chromatographic area-percent equivalence is assumed.

In this report, **chemical purity = 100(L+R)/(L+R+I)**. Both enantiomers count as the target chemical. Enantiomeric ratio is L:R, excluding I. Enantiomeric excess is **ee = 100|L-R|/(L+R)**, with the majority enantiomer stated separately. Signed ee, positive for L and negative for R, is also included in the CSV data.

A specification for a single enantiomer may instead count the other enantiomer as an impurity. On this same mole basis, an L-specific total-mixture content would be **100L/(L+R+I)**. It is not the chemical-purity definition used for the horizontal line below. Real specifications must state the analyte, denominator, assay method and reporting basis.

## Hand-checkable examples
| Mixture | L (mol) | R (mol) | I (mol) | Chemical purity | L:R within target | ee |
|---|---:|---:|---:|---:|---|---|
| A | 49.5 | 49.5 | 1 | 99% | 50:50 | 0% |
| B | 74.25 | 24.75 | 1 | 99% | 75:25 | 50% L |
| C | 89.1 | 9.9 | 1 | 99% | 90:10 | 80% L |
| D | 9.9 | 89.1 | 1 | 99% | 10:90 | 80% R |
| E | 99 | 0 | 1 | 99% | 100:0 | 100% L |
| F | 72 | 8 | 20 | 80% | 90:10 | 80% L |
| G: 99% L within target | 98.01 | 0.99 | 1 | 99% | 99:1 | 98% L |
| H: 99% ee favoring L | 98.505 | 0.495 | 1 | 99% | 99.5:0.5 | 99% L |

For C, chemical purity = 100(89.1+9.9)/100 = 99%; L:R = 9:1; ee = 100(89.1-9.9)/99 = 80% favoring L. C and F have identical ratio and ee but different chemical purity.

**99% L is not 99% ee.** For G, ee = 100(98.01-0.99)/99 = 98%. For H, 99% ee means the L fraction is (1+0.99)/2 = 0.995, or 99.5%. The respective L contents of the whole mixture are 98.01% and 98.505%.

## Sweep with chemical purity held at 99%
Let f = L/(L+R), between 0 and 1. Then:
- L = 99f mol; R = 99(1-f) mol; I = 1 mol.
- Chemical purity = 99%.
- L:R = f:(1-f).
- ee = 100|2f-1|%; signed ee = 100(2f-1)%.
- L as a percentage of the whole mixture = 99f%.

![Chemical purity stays at 99%, ee follows a V shape, and L content increases linearly.](purity_and_enantiomers.png)

**Figure.** Deterministic hypothetical sweep over 1,001 equally spaced L fractions (0.1 percentage-point increments); these are calculated grid points, not replicates. Chemical purity counts L+R and stays at 99%. The ee magnitude falls from 100% R at 0% L to zero at 50% L, then rises to 100% L at 100% L. The orange line uses the whole-mixture denominator and shows L-specific content. No experimental uncertainty is modeled.

Purity cannot determine enantiomeric composition. Enantiomeric ratio and ee *with majority identity* are interconvertible, but neither supplies chemical purity. Unsigned ee alone cannot distinguish L-majority from R-majority mixtures.

## Files and checks
- hypothetical_mixtures.csv: eight examples with amounts and calculated metrics.
- purity_99_sweep.csv: 1,001 sweep points with both ee magnitude and signed ee.
- enantiomer_calculations.py: reproducible calculations, assertions and plotting code; requires NumPy, pandas and Matplotlib.
- purity_and_enantiomers.png: exported figure.

Checks passed for 100 mol balance, the sweep ee formula, and the 99% L/99% ee cases. Figure text overlap and boundary checks passed, and the saved image was visually inspected.
