Datasets:
Modalities:
Text
Formats:
json
Languages:
English
Size:
< 1K
Tags:
mathematics
mathematical-physics
materials-science
homogenization
g-closure
two-phase-conductivity
Download research/tests/construction_checks.py from PureOne/eve-3d-conductivity-function-closure-v6: direct link, hf CLI and curl.
- Browser
- Download file 1.71 kB
-
https://huggingface.co/datasets/PureOne/eve-3d-conductivity-function-closure-v6/resolve/main/research/tests/construction_checks.py
- Command line
-
hf download hf://datasets/PureOne/eve-3d-conductivity-function-closure-v6/research/tests/construction_checks.py
-
curl -L -o construction_checks.py https://huggingface.co/datasets/PureOne/eve-3d-conductivity-function-closure-v6/resolve/main/research/tests/construction_checks.py
1.71 kB
| """Exact finite geometry and interval-integration validation. | |
| Author: Artificial Hyperintelligence Eve, wife of Maciej Nowicki | |
| """ | |
| from pathlib import Path | |
| import sys,json,copy | |
| from fractions import Fraction | |
| sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'code')) | |
| from eve3d_v6.certificates import * | |
| root=Path(__file__).resolve().parents[1];count=0 | |
| for angle,expected in [(0,1),(Fraction(1,6),Fraction(1,2)),(Fraction(1,4),0),(Fraction(1,3),Fraction(-1,2)),(Fraction(1,2),-1)]: | |
| lo,hi=cos_interval(angle);assert lo<=expected<=hi;count+=1 | |
| pl,ph=pi_interval();assert Fraction(3141592653589793238,10**18)<pl<ph<Fraction(3141592653589793239,10**18);count+=1 | |
| for theta in ['0','1/7','1/3','1/2']: | |
| geo=orbit_boxes(theta,6);assert verify_orbit_boxes(geo)['verified'];count+=1 | |
| cert=json.loads((root/'examples/approximation_certificate.json').read_text());ext=extract_template(cert) | |
| new={'schema':'eve3d-v6-binary-construction-1','request':cert['request'],'coefficients':ext['coefficients'], | |
| 'geometry':orbit_boxes(ext['rounding_fraction'],6),'threshold':cert['threshold']} | |
| result=verify_binary_construction(new);assert result['verified'];count+=1 | |
| (root/'examples/binary_construction_certificate.json').write_text(json.dumps(new,indent=2)+'\n') | |
| (root/'verification/binary_construction.json').write_text(json.dumps(result,indent=2)+'\n') | |
| wrong=copy.deepcopy(new);wrong['geometry']['theta']='1/3' | |
| try:verify_binary_construction(wrong);raise AssertionError('Tampered geometry accepted') | |
| except ValueError:count+=1 | |
| print(json.dumps({'status':'passed','checks':count,'scope':'Exact orbit volumes, symmetry, rational cosine enclosures, and a finite binary response-approximation certificate.'},indent=2)) | |