Extra Credit 3

Due: Friday, February 15, 2019
Points: 40


  1. (40 points) This program asks you to plot four functions over specified intervals. To plot these, begin at the starting point of the interval, and advance 0.01 until you reach the end.

    The four functions are in the file “funcs.py” available in the assignment area. The intervals they are to be plotted over are:

    function intervals on x axis
    f1 [-7, -3); (-1, 1); (3, 7]
    f2 [-7, -4); (4, 7]
    f3 [-4, 4]
    f4 [-3, -1); (1, 3]
    You do not need to draw the axes. Also, set the speed of the turtle (pen) to 10; otherwise, drawing the picture will take a long time.

    What picture does this draw?

    Please call your program “plotting.py”.

    Hint: If you don’t scale the x and y co-ordinates of the plot, the figure will probably be too small to see it well. I used a scale factor of 25—that is, when I plotted or moved to point (x, y), I multiplied both x and y by 25 before plotting or moving to it. Also, you will need to import the square root function for the functions to work:

    from math import sqrt
    or
    from math import sqrt


UC Davis seal
Matt Bishop
Office: 2209 Watershed Science
Phone: +1 (530) 752-8060
Email: mabishop@ucdavis.edu
You can also obtain a PDF version of this.
Version of February 6, 2019 at 12:24AM