Problems working with lists

Hello! I am trying to create a visualization for the pythagorean theorem.

This actually has no CL elements yet, I’m just attempting to build the graph portion.

I am attempting to create 1 unit squared squares, which isn’t trivial in the square built from the hypotenuse. I have created a variable which will calculate the unit x vector so that I can use that to place points along a diagonal line 1 unit from each other.

However, I am having a trouble automatically generating a list with this.

I would LIKE the list to do something like [a, a + deltaX, … , b] where a and b are the x coordinates of the points on either end of the segment. However, when I try to do this, the last element of my list is often GREATER than I expect - it’s like there’s an extra element.

I do not understand the behavior of the lists, because in another case, it does work as expected.

That’s where I’m at. Notice that the light purple segments create a “row” of squares that is not quite 1 unit squared - behavior I expect and want.
The black segments go past the bounds of my purple square.

Suggestions? Thoughts on how to approach this differently?

Thank you so much!

There’s probably a better way to do it, but I made it have the behavior that I wanted.

(2nd slide)

When graphing the lines, I just stuck a conditional in the equation before the x-coordinate list.

1 Like

I have to admire that beautiful graph. Well done.

Thanks! …and padding for character limit… :smiley: