- Write Maple functions that solves the same problem that our C program
solves. In particular, that problem is:
Given the conditions described in the link diagram, and given an angle for the
squatter's ankle joint (call this angle ), we want to determine the
X-Y position of the squatter's knee joint.
The angle is measured in degrees counterclockwise from the positive X
axis. So when the squatter is standing straight up, the ankle joint angle will
be 90 degrees.
Your Maple functions should take the value of (in degrees) as an
argument and return the X and Y position of the squatter's knee joint.
- Make a table that compares the output results of the two ``squat''
programs: the ``joints.c'' C version from this lesson and your Maple
version from the previous homework exercise. Run each program with the
following input values for the ankle joint angle:
0.0 10.0 22.5 45.0 77.5 80.0 90.0
Record the programs' numerical results exactly as they appear on
screen, character-for-character. Assemble the output into a table like this:
C Maple
+-----------+-----------+
Input 0.0 | ... | ... |
Input 10.0 | ... | ... |
Input 22.5 | ... | ... |
... | | |
+-----------+-----------+
Now compare the output of the two programs. For each input value, do the
two programs print exactly the same answers? If not, explain how and why the
programs produce different output.
- C provides exact integers, much as Maple does. (It does not support
exact rational numbers, though.) The largest possible integer in C, however,
is much smaller than in Maple.
The program integer.c in your
examples directory contains a program that repeatedly asks you to type in
an integer which it then prints back. Use this program to experimentally
determine the exact value of the largest integer it is possible to have in C.
(When you get tired of typing in integers, you can kill the program by typing
Ctrl-C from the keyboard.)
Prepare a writeup giving the value of the largest integer and explaining how
you went about finding it.
- C provides inexact floating-point numbers, much as Maple does. The
largest possible floating-point number in C, though, is much smaller than
in Maple. Furthermore, the size of the mantissa is fixed, unlike Maple where
it can be adjusted by the user.
The program float.c in your examples directory
contains a program that repeatedly asks you to type in a floating-point number
which it then prints back.
Use float.c to experimentally determine the number of digits in the
mantissa of a floating-point number. Once you have done this, experimentally
determine both the largest and the smallest positive floating-point
numbers.
Prepare a writeup giving the mantissa size, largest positive number, and
smallest positive number along with an explanation of how you went about
finding these values.