geometry · MIT License
Overview
Solve a lattice polygon's area, interior-point count, or boundary-point count with Pick's theorem.
- Tested on a TI calculator
- Downloaded 45 times
- Version 1.0.0
- 5044 bytes
- No imports
Tried it? Did this program work on your calculator?
Before you run it
- TI-84 Plus CE Python · tested on OS 5.8.3, Python App 5.8.3.0048
- TI Connect CE .py conversion to a Python AppVar in RAM; owner physically verified the supplied program.
- The polygon is a lattice polygon and Pick's theorem applies.
- The TI program validates nonnegative or positive whole-number point counts.
- Non-lattice or inapplicable polygons produce an incorrect interpretation.
Try the DuckieDai calculator screen
This browser preview calculates area from interior and boundary point counts. The TI program also solves the inverse counts.
TI-84 Plus CE Python · screen preview
Learn the math
How Pick's theorem works
The idea
If a polygon's corners all sit on grid points, you can find its area just by counting dots: the grid points inside it and the grid points on its edge.
The formula
A = i + b/2 - 1
A- area in square grid units
i- grid points strictly inside the polygon
b- grid points on the boundary, corners included
Using the program
- 1 finds the area. 2 finds the interior count. 3 finds the boundary count.
- Enter whole numbers for the counts.
Worked example
A polygon on a grid has 4 points inside and 6 on its boundary. Choose 1 and enter 4 and 6.
A = 4 + 6/2 - 1
The program shows Area = 6.0 square units.
Tips and common mistakes
- Every corner must be on a grid point or the theorem does not apply.
- Boundary points include the corners and any grid points along the sides.
- The polygon must not have holes or cross itself.
Where this comes up
It appears in geometry enrichment units and math competitions, and it is a quick check for area problems drawn on grid paper.
Exact reviewed bytes
Source code
"""DuckieDai Pick's Theorem for TI-84 Plus CE Python."""def duckiedai_intro(program_name, wait=True):"""Show the reusable DuckieDai program opening."""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 whole_number(prompt):"""Require a nonnegative whole number."""while True:try:value = int(input(prompt))if value >= 0:return valueexcept ValueError:passprint("Enter a whole number")print("0 or greater.")def positive_whole(prompt):"""Require a positive whole number."""while True:try:value = int(input(prompt))if value > 0:return valueexcept ValueError:passprint("Enter a whole number")print("above 0.")def positive_number(prompt):"""Require a positive number."""while True:try:value = float(input(prompt))if value > 0 and value < 1e100:return valueexcept ValueError:passprint("Enter a number above 0.")def main():duckiedai_intro("PICKS THEOREM")print("PICK'S THEOREM")print()print("A = i + b/2 - 1")print()print("i = interior points")print("b = boundary points")print()print("What do you need?")print()print("1. Area")print("2. Interior points")print("3. Boundary points")print()choice = input("Choose 1-3: ")print()# ==========================================# 1. SOLVE AREA## A = i + b/2 - 1# ==========================================if choice == "1":i = whole_number("Interior points: ")b = positive_whole("Boundary points: ")area = (i +b / 2 -1)print()print("Using:")print("A = i + b/2 - 1")print()print("A = " + str(i))print("+ " + str(b) + "/2")print("- 1")print()print("ANSWER")print("Area = " + str(area))print("square units")# ==========================================# 2. SOLVE INTERIOR POINTS## i = A - b/2 + 1# ==========================================elif choice == "2":area = positive_number("Area: ")b = positive_whole("Boundary points: ")i = (area -b / 2 +1)print()print("Using:")print("A = i + b/2 - 1")print()print("Rearranged:")print("i = A - b/2 + 1")print()if i < 0 or i != int(i):print("INVALID RESULT")print()print("Interior points")print("must be a whole")print("number.")print()print("Check your values.")else:i = int(i)print("ANSWER")print("Interior points =")print(str(i))# ==========================================# 3. SOLVE BOUNDARY POINTS## b = 2(A - i + 1)# ==========================================elif choice == "3":area = positive_number("Area: ")i = whole_number("Interior points: ")b = (2 *(area - i + 1))print()print("Using:")print("A = i + b/2 - 1")print()print("Rearranged:")print("b = 2(A-i+1)")print()if b <= 0 or b != int(b):print("INVALID RESULT")print()print("Boundary points")print("must be a positive")print("whole number.")print()print("Check your values.")else:b = int(b)print("ANSWER")print("Boundary points =")print(str(b))else:print("Invalid choice.")print()print("DuckieDai says: done!")# TI-Python imports the selected AppVar rather than# setting __name__ to main.main()
- Filename
PICKTHE.py- Size
- 5044 bytes
- SHA-256
1714c126a432524b92b65e5458d8a81699a3015d89d725f9ebc2295a23eca18a
Usage
Inputs
- Requested unknown: area, interior points, or boundary points
- Nonnegative interior count and positive boundary count where applicable
Outputs
- Requested Pick's-theorem quantity or invalid-result warning
Units: Area is in square coordinate units; point counts are whole numbers.
Assumptions and limitations
Assumptions
- The polygon is a lattice polygon and Pick's theorem applies.
Constraints
- The TI program validates nonnegative or positive whole-number point counts.
Known failures
- Non-lattice or inapplicable polygons produce an incorrect interpretation.
Compatibility and review
- Review status
- Tested on a TI calculator
- Tested on
- TI-84 Plus CE Python; OS 5.8.3; Python App 5.8.3.0048; exact source owner-tested through TI Connect CE
- What happened
- Owner confirmed the supplied Pick's theorem program runs on the physical calculator.
- Dependencies
- No imports
- Suggested calculator name
PICKTHE— 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.
Transfer and launch
Download the .py file, send it to your calculator with TI Connect CE as PICKTHE or another name, then open the Python App and try the worked example on this page first.
Full installation and troubleshooting guide. Check your teacher's or exam's rules before using any program.
Version history
- 1.0.0 — current version, published . Download this reviewed version
Related learning
Did a DuckieDai program help with your homework? Every program here is free. If you would like to say thanks, you can leave a tip on Cash App ($duckiedai214) or read what tips pay for.
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, and so does a Yes or No answer about whether the program worked. Your browser notes that you answered; that note is never sent to the site. No entered values, source text, IP address, account, cookie, device identifier, or fingerprint is stored with these counts.