← Back to Calculator Program Library
Independent compatibility resource: Hidden Word Scanner is independent and is not affiliated with or endorsed by Texas Instruments. TI product names describe compatibility only.
Action-count privacy: Successful downloads, preview starts, and preview completions increment same-origin aggregate counters. No entered values, source text, IP address, account, cookie, device identifier, or fingerprint is stored with these counts.
chemistry · MIT License
Overview
Solve n*lambda = 2*d*sin(theta), including a guided conversion from an XRD 2-theta reading.
Usage
Inputs
- Positive integer reflection order
- Wavelength and lattice-plane spacing in the same length unit
- Bragg theta in degrees, or measured 2-theta in degrees
Outputs
- Requested spacing, angle, wavelength, or calculated reflection order
Units: Lambda and d must use the same length unit; theta and 2-theta are entered in degrees.
Assumptions and limitations
Assumptions
- The stated planes, wavelength, and diffraction order describe the same elastic diffraction peak.
Constraints
- Order is positive; theta is greater than 0 and at most 90 degrees; 2-theta is greater than 0 and at most 180 degrees; inverse-sine input cannot exceed 1.
Known failures
- A calculated value near an integer does not by itself assign a diffraction peak.
- Instrument geometry, uncertainty, and sample effects are not modeled.
Compatibility and review
- Review status
- Not calculator tested
- Tested on
- The owner reports personally testing the supplied archive programs on a calculator; exact model, OS, and Python App versions were not recorded
- What happened
- Owner reported interactive testing is disclosed, but the published bytes are not labeled independently calculator tested because the environment is unrecorded and Arrhenius received a narrow intake correction
- Dependencies
- math
- Suggested calculator name
BRAGG— you can give it another valid, unique name when you transfer it- Desktop test cases
- Not available for this interactive-only source
This exact source auto-launches an interactive calculator session, so compatibility evidence comes from the recorded physical-device review rather than an importable desktop fixture.
Browser preview
Try the DuckieDai calculator screen
Follow the same opening, solve menu, prompts, validation, and result flow as the downloadable program.
Simulation boundary: This preview uses a reviewed browser adapter. It does not execute the downloaded Python and does not prove TI-Python or calculator compatibility.
TI-84 Plus CE Python · screen preview
JavaScript is required for the optional browser simulation. Source viewing and downloading remain available without it.
Exact reviewed bytes
Source code
from math import sin,asin,radians,degreesdef duckiedai_intro(program_name,wait=True):title=program_name[:16]empty=16-len(title)left=empty//2right=empty-leftprint("+----------------------+")print("| "+" "*left+title+" "*right+" |")print("| |")print("| __ |")print("| ___(o )> quack! |")print("| \\ <_. ) |")print("| `---' |")print("| by DuckieDai |")print("+----------------------+")print("Loading...")if wait:input("Press enter to start ")print("\n"*6)def pos(s):while 1:try:x=float(input(s))if x>0:return xexcept:passprint("Enter a positive #")def whole(s):while 1:try:x=int(input(s))if x>0:return xexcept:passprint("Enter a whole #")def angle(s,top=90):while 1:x=pos(s)if x<=top:return xprint("Angle is too large")def menu():while 1:try:x=int(input("Choose 1-5: "))if x>0 and x<6:return xexcept:passprint("Choose 1 to 5")duckiedai_intro("BRAGGS LAW")print("BRAGG'S LAW")print("n*lambda=2*d*sin(t)")print("1 Find d")print("2 Find theta")print("3 Find lambda")print("4 Find order n")print("5 d from 2theta")c=menu()if c==1:n=whole("Order n: ")w=pos("Lambda: ")t=angle("Theta deg: ")d=n*w/(2*sin(radians(t)))print("d =",d)print("2theta =",2*t)elif c==2:n=whole("Order n: ")w=pos("Lambda: ")d=pos("d: ")r=n*w/(2*d)if r>1:print("No Bragg angle")else:t=degrees(asin(r))print("theta =",t)print("2theta =",2*t)elif c==3:n=whole("Order n: ")d=pos("d: ")t=angle("Theta deg: ")print("lambda =",2*d*sin(radians(t))/n)elif c==4:w=pos("Lambda: ")d=pos("d: ")t=angle("Theta deg: ")n=2*d*sin(radians(t))/wnear=round(n)print("Calculated n =",n)print("Nearest order =",near)if near<1:print("No positive order")elif abs(n-near)<.001:print("Matches integer order")else:print("Not an integer order")else:n=whole("Order n: ")w=pos("Lambda: ")t=angle("2theta deg: ",180)/2print("theta =",t)print("d =",n*w/(2*sin(radians(t))))input("ENTER for guide: ")print("QUICK GUIDE")print("n=1,2,3,...")print("d and lambda: same")print("Bragg uses theta")print("XRD often gives 2theta")print("DuckieDai: done!")input("ENTER to exit: ")
- Filename
bragg.py- Size
- 2301 bytes
- SHA-256
58e4d702646472cfe19bd4f3fb0a8ee814527e1843791f8bf24756ec532ff5b3
Transfer and launch
- Confirm that your calculator is the Python-capable model named above. This release has no verified calculator OS or Python App version; treat transfer and execution as unverified until independently tested.
- Download the
.pysource above and verify its SHA-256 digest if your computer provides that option. - Use TI Connect CE to send the Python file to a compatible calculator.
BRAGGis a suggested name; you may choose another valid, unique calculator name. - Open the Python App, select the program, and check sample inputs before relying on other results.
Read the complete installation, launch, troubleshooting, and removal guide.
Availability does not mean a teacher, school, or exam permits this program. Follow the applicable rules.
Version history
- 1.0.0 — current version, published . Download this reviewed version
Any source change requires a new immutable version and digest. Historical downloads remain available only while their review records remain valid.