Part A: Python as a calculator

Exercises

Some of the following questions require you to look up operations that we did not cover in the lab notes.

The goal here is to learn how to locate information about Python and its packages.

  1. Familiarize yourself with using the iPython shell and the Python interpreter. (Nothing to turn in here.)
  2. Try out simple arithmetic expressions using the operations given in the tutorial.
    1. Evaluate the function sin(x) / x at x = 3.3, 1.2, and .1.
    2. Evaluate this function at x = 0.0. How does the interpreter react to errors?
    3. Can you calculate the angle whose tangent is 1/3 with the function atan(1/3)? Why or why not?
    4. What is the modulus of the complex number 3.5 + 5j?
    (Submit a screen capture of the text of your iPython session for these.)
  3. Make sure you can run the example program given in the lab notes. Modify it to include printing:
    1. the triangle's center of mass;
    2. the triangle's three angles; and
    3. the normal vector of the plane defined by the triangle.
    (Submit this as either a single program or three separate programs.)

Table of Contents