Enhancing Geometric Learning: Python Applications for Teaching High School Students, Including those with Visual Impairments

Introduction:

Back in my high school, I had a lot of trouble with math. The teacher would come, write equations on the blackboard, and I would sit clueless in the class. I would take extra tutoring outside of the class, but even there I would not find much help. Things did not improve much in the final year of high school either, as geometry was heavily involved in the course in that year.

As a result, despite my aspirations to get computer science in my college years, I had to drop math in my secondary high school. So when I got to the college, they had two excuses ready for me to not admit me in the cs course: You are blind, and you don't know math because you did not have it in your secondary high school.

Why did that happen? Because my school was not willing to adapt to my needs. This is nothing new. Ask any blind person or any disabled person. We all have similar stories. And while it is easier to say that you should argue with the administration, it is not easy for a child to do alone all the time on every single issue.

But when I started to learn programming outside of my college, with C being my first language, Within the first day it was clear to me that there is potential here to combine these two skills. What do I mean by that?

Simple. Combine programming and math, and teach both of those things. It is common to have a programming class in schools now, and should your school allow it, you can combine the knowledge of programming to learn math. While it may not do a lot in terms of pen-and-paper problem solving, it will do one thing that is also important for math: getting you used to reading and writing the equations. Because make no mistake. That code is not doing any magic. It is using the same equations as you would use in math to solve the same problems, with very few modifications for the code.

For this purpose, I have chosen Python to demonstrate my point. I will show you how you can use Python to solve geometrical problems. You don't need a deep knowledge of computers or coding to do this task. Just the understanding of a few concepts is enough. Those are boolean (true, false), tuples and lists, how to write functions, math operators, and operator precedence. And that is it. With this very little knowledge; you are ready to solve math problems with programming. Sure, you can dig deeper if you have some complex problems, but for the school level at least, that is enough.

Having said that, let me be clear. I will not provide you with an example of every single problem or concept that you might encounter in geometry. My geometry notes are 1800 lines long, and it is not possible to cover all the concepts in just one article. I do not have the capacity, nor the incentive to cover everything in such a deep level. My goal here is to give you an idea of how you can use Python to understand and solve geometrical formulas, and then develop and use this understanding later to solve these problems better.

I would like to thank Open Stax and its authors for their wonderful math books. If you are looking for good math books that you can find online for free, I recommend you check them out here.

If only I had these resources back in my school days, maybe I could be one of the toppers then. Oh well, no point in crying about that.

Now, let us start with the first concept of the geometry.

Angles:

An angle represents the space between two intersecting lines or planes, often visualized as the corner where two walls meet in a building or the corner of a page in a book.

When measuring angles, their total sum always equals 180 degrees. To illustrate this concept in code, consider the function below:

def supplimentary_or_not(angle1, angle2):
    return angle1 + angle2 == 180

This function checks if the sum of two angle measurements equals 180 degrees. If so, it returns True; otherwise, it returns False. For instance:

print(supplimentary_or_not(140, 40)) # True

print(supplimentary_or_not(155, 25)) # True

print(supplimentary_or_not(103, 77)) # True

print(supplimentary_or_not(60, 70)) # False

The function returns True for the first three inputs since their sum equals 180, and False for the last one as its sum is different.

Now, to find the supplement of an angle (the angle that, when added to the original angle, equals 180 degrees), we can subtract the known angle from 180. This is demonstrated in the function:

def find_supplement(angle):
    return 180 - angle

For example:

print(find_supplement(40)) # 140
print(find_supplement(25)) # 155
print(find_supplement(77)) # 103

This function calculates the supplement angle by subtracting the known measurement from 180, yielding the unknown measurement. This process complements our understanding of angles and their measurements.

The next concept we will cover is the compliments. If the sum of two angles is equal to 90 degrees, then they are complements. Once again, we can check whether these angles are complimentary or not by running the function below.

def complementary_or_not(angle1, angle2):
    return (angle1 + angle2) == 90

Here's how the function behaves when run:

print(complementary_or_not(50, 40)) # True

print(complementary_or_not()) # True

print(complementary_or_not(77, 13)) # True

print(complementary_or_not(40, 20)) # False

The function adds up the two angles and then compares the sum to check whether it is equal to 90 or not. It returns True if the sum is equal to 90, False otherwise.

We can also find the unknown compliment value if one value is known to us. The process is simple: subtract the known value from 90, and then you will have the unknown value. The function below does exactly that.

def find_complement(angle):
    return 90 - angle

Here's how the function performs:

print(find_complement(40)) # 50
print(find_complement(25)) # 65
print(find_complement(77)) # 13

You will also encounter problems like this one in geometry:

Two angles are supplementary. The larger angle is 30 degrees more than the smaller angle. Find the measure of both angles.

In this case, we only know that one angle is 30 degrees larger than the other angle. We don't know anything else. But we can use an algebraic equation to solve this problem. I will demonstrate how this equation will look like in code in the function below:

def find_supplimentary_angles(number):
    result = (180 - number) / 2
    second_angle = result + number
    return (result, second_angle)

The example run of the function will look like this:

print(find_supplimentary_angles(30)) # 75, 105
print(find_supplimentary_angles(100)) # 40, 140

The function takes a number as an argument. This is the value that is known to us, this being how large one angle is compared to the other angle.

Inside of the function, we have a variable called "result", where we save our calculation after subtracting the number passed to the function from 180, and dividing the result by 2. This way, we find one of the angles.

Next, the function adds up this newly found angle with the number that was passed to the function and saves the result in a variable called "second_angle". The function then returns a tuple by executing this statement:

return (result, second_angle)

This way, we can return both of the angles from this one function, since that is what we have to do to solve this problem.

Same thing with the complimentary angles. The only change is that the value is 90 degrees, instead of 180 degrees. The function is given below. The implementation is identical, apart from the change I've just mentioned.

def find_complementary_angles(number):
    result = (90 - number) / 2
    second_angle = result + number
    return (result, second_angle)

Example:

print(find_complementary_angles(40)) # 25, 65

That concludes the angle. Now we will move on to triangles.

triangles:

Similar to the concept of angles we have covered above, when all three angles of a triangle are added, their sum is equal to 180. In geometry, you will encounter problems where you have two angles, but you need to find the third side. The function below does exactly that. It accomplishes this task by subtracting the sum of the two angles passed to it, and the result is the value of the third angle of a triangle.

def find_third_angle(angle1, angle2):
    result = 180 - (angle1 + angle2)
    return result

Example run of the function:

print(find_third_angle(55, 82)) # 43
print(find_third_angle(31, 128)) # 21
print(find_third_angle(49, 75)) # 56

A right triangle is a triangle where one of the angles measures 90 degrees. We can use the same function described above to find the third angle. One of the arguments will be 90, rest of the operation is going to be the same.

Here is the example run:

print(find_third_angle(90, 56)) # 34
print(find_third_angle(90, 45)) # 45

I could have modified the function to handle the right triangle, but there is no need for it. We know one of the angles is 90 degrees in a right triangle, and one value is already given. This information is enough to find the third angle, and the process to find the third angle is the same as before.

Similar to the angle problems we have in the previous section, you will also encounter situations when you don't know the measurements of the triangles. The only information you will have is one of the angles is larger than others. The function below helps you in finding the values of all three angles in such situations. It then returns the tuple of all three angles.

def find_3_angles(number):
    angle1 = (180 - (90 + number)) / 2
    angle2 = number + angle1
    return (angle1, angle2, 90)

Example run of the function:

print(find_3_angles(20)) # 35, 55, 90
print(find_3_angles(50)) # 20, 70, 90
print(find_3_angles(30)) # 30, 60, 90

As you will observe, all the triangles have 90 in one of the angles. That means all the angles are right triangles.

Pythagorean Theorem

The Pythagorean Theorem is a special property of right triangles that has been used since ancient times. It is named after the Greek philosopher and mathematician Pythagoras who lived around 500 BCE. Remember that a right triangle has a 90-degree angle, which we usually mark with a small square in the corner. The side of the triangle opposite the 90-degree angle is called the hypotenuse, and the other two sides are called the legs.

Much thanks to the Open Stax, and the authors of the Prealgebra textbook. I could have not described the concept any better myself. Ignoring the nasty flashbacks from the school, Let us explore the problems through code.

One problem that you will encounter in the Pythagorean theorem is to find the length of the hypotenuse. The formula for doing that is the c = square root of (a ^ 2 + b ^ 2).

You can look at the function below to see what it looks like when implemented in code.

import math


def length_hypotenusee(leg1, leg2):
    result = math.sqrt(leg1**2 + leg2**2)
    return result

We import the math module because we will need the function to find the square root. Python does not have an operator to find a square root, but it does have an exponent operator ("**"). Other languages may not have this, but they usually have a pow() method to calculate exponents. This method will be provided in the standard library, and it will be located in the mathematical module of your respective language. You may need to consult the documentation to find more information.

Here is one example run of the function:

print(length_hypotenuse(3, 4)) # 5
print(length_hypotenuse(6, 8)) # 10
print(length_hypotenuse(15, 8)) # 17

Another problem that you will encounter is to find the length of the longer leg. Once again, I will show you the function to solve this problem, and then we will see the example run of that function.

import math


def longer_leg(hyp, leg):
    result = abs(hyp**2 - leg**2)
    return math.sqrt(result)

Example run of the function:

print(longer_leg(13, 5)) # 12
print(longer_leg(17, 15)) # 8
print(longer_leg(15, 9)) # 12

On a side note, even if I have studied geometry online, the problem has always turned out to be the images. At least Open Stax provides captions for their images, but even there, they need to change certain things. For example, they provide one example solution before exercises. But those solutions are always in images, and those images are not labeled with captions. So I had to look at other places. But this is part and parcel of a blind person's life, and if you are looking to learn math, you have to get used to it.

Next, we will look at circles.

circles:

A circular sandbox has a radius of 2.5 feet. Find the ⓐ circumference and ⓑ area of the sandbox.

First, we will look at a function that finds the circumference

def circumference(radius):
    c = round(2 * 3.14 * radius, 3)
    return c
```.

Now, the example run of this function:

print(circumference(2.5)) # 15.70 print(circumference(5)) # 31.40 print(circumference(4.5)) # 28.26


Now, the function to find the area of a circle:

def area(radius): area = 3.14 (radius*2) return area


Example:

print(area(2.5)) # 19.625 print(area(5)) # 78.50 print(area(4.5)) # 63.585 ```

Now, I must caution you against a problematic part of computer math while handling decimals. You will notice in the output I have provided in the comments that certain results go up to at least three digits after the decimal points. I was able to achieve this only after using the round() function, to round out the result to the three digits after the decimal point. Otherwise, the result was quite large, and all my tests kept failing. You can explore this further by dividing various values in the Python interpreter. Try to do that with repetitive and nonrepetitive values, and then you will understand the problem.

This is why I have to use round in the first function. Otherwise, the result wouldn't be the same. Also, you will notice that when I used pi, I only used 3.14, instead of something like 3.14159. This is also because the examples in the Prealgebra textbook, do the same. If I used a larger pi value, the result would not be the same. So be careful of that.

conclusion:

I believe this is more than enough to make my case for using Python to teach geometrical formulas. I could provide more examples, but it would just increase the padding of my word count, rather than make my case stronger. I am not here to write a full-fledged reference guide of geometrical code. My goal here is to demonstrate that Python can be used to teach these concepts, and you should leverage this knowledge if you are a blind student, trying to learn and understand these concepts. It certainly helped me in developing my understanding, and I am certain that it will do the same for you.

If you are a teacher, then maybe try to demonstrate this in your class. And if you have a blind student, then you can work with them to help them out better. Python is not a difficult language to learn, and you will also notice that I have not used anything complex to solve the problems described in the previous sections.

So, I hope you find this article useful. You can check out my other non-technical blog here, and my web serial here. See you next time!

Did you find this article valuable?

Support Tanish Shrivastava by becoming a sponsor. Any amount is appreciated!