Discussion
Here are notes about what I hope
will be discussed during this meeting. Some other relevant links
follow.
Changes!!!
Following a student suggestion, the logical question round(z)=z was used in class instead of type(z,integer). I like the student suggestion
better than what we had planned. It is simpler and more related to how
most people think.
The procedures discussed
Here are the procedures used today, put on a web page so that you may
lift and copy them into a Maple screen
more easily. At the urging of Mr. Rowland who is a kind and interested
instructor, these procedures are presented with line breaks which are
supposed to help human beings understand them. Internally Maple doesn't care about presentation that
much.
Finds and prints the integers in the range from 1 to n which are squares of other integers.
squares := proc(n)
local x;
for x to n do if type(sqrt(x), integer) then print(x) end if end do
end proc;
Finds and prints all Pythagorean triples a, b, and c (solutions of
a2+b2=c2) which have a and b between
1 and n.
pythag := proc(n)
local x, y;
for x to n do for y to n do
if type(sqrt(x^2 + y^2), integer) then
print(x, y, sqrt(x^2 + y^2))
end if
end do
end do
end proc;
Prints Pythagorean triples with a and b between 1 and n and with a≤b.
pythagB := proc(n)
local x, y;
for x to n do for y from x to n do
if type(sqrt(x^2 + y^2), integer) then
print(x, y, sqrt(x^2 + y^2))
end if
end do
end do
end proc;
Prints primitive Pythagorean triples with a and b between 1 and
n and with a≤b. The word "primitive" means that a and b have
no integer common factor.
pythagC := proc(n)
local x, y;
for x to n do for y from x to n do
if type(sqrt(x^2 + y^2), integer) and igcd(x, y) = 1 then
print(x, y, sqrt(x^2 + y^2))
end if
end do
end do
end proc;
Prints all integer solutions to the equation
a2+b2=2c2 with a and b between 1 and
n with a≤b and so that a and b have no common integer factors.
pythag2 := proc(n)
local x, y;
for x to n do for y from x to n do
if type(sqrt(1/2*x^2 + 1/2*y^2), integer) and igcd(x, y) = 1
then print(x, y, sqrt(1/2*x^2 + 1/2*y^2))
end if
end do
end do
end proc;
Prints all integer solutions to the equation
a2+b2=3c2 with a and b between 1 and
n with a≤b and so that a and b have no common integer factors.
pythag3 := proc(n)
local x, y;
for x to n do for y from x to n do
if type(sqrt(1/3*x^2 + 1/3*y^2), integer) and igcd(x, y) = 1
then print(x, y, sqrt(1/3*x^2 + 1/3*y^2))
end if
end do
end do
end proc;
Maintained by greenfie@math.rutgers.edu and last modified 10/12/2008.