Assignment #3



Today we are going to look at functions and plots of functions. Below I have given a sequence of commands that you will need to graph some functions and some examples. Try out the commands that you see below, make sure that you understand how they work and how

> with(plots); # load functions about strings
> plot(sqrt(4-x^2),x=-2..2);
> A:=plot(sqrt(4-x^2),x=-2..2);
> display(A);
> B:=plot(sqrt(.25-(x+1.5)^2),x=-2..-1);
> display(B);
> display(A,B);
> C:=plot(piecewise(x>=-1 and x<1,-sqrt(1-x^2),x>=1,sqrt(.25-(x-1.5)^2)),x=-1..2);
> display(A,B,C);


Question 1:

Given real values r1, r2, r3 >0, consider the curve of the positive part of the circle with radius r1+r2+r3 and center at the origin and three semi-circles below with radii r1, r2, r3 so that they are arranged from left to right like the semi-circles in the image in the example functions above. Plot these functions for r1=10, r2=2, r3=8 and r1=2, r2=10, r3=8.

Question 2:

Define a piecewise function of x so that the the value of the function is 0 if x<-r1-r2-r3 or if x>r1+r2+r3, it is equal to the vertical distance between the curves if -r1-r2-r3<=x<=r1+r2+r3. Numerically integrate the area under this curve on the non-zero interval and explain how the numerical answer is what you would anticipate the answer to be given that this curve is related to semi-circles.




You should open up a new worksheet and start from scratch. You will have to save your work in a file and upload that file on to the course moodle. Your solution should be a sequence of commands where it is easy to change the input string and after you execute the sequence of commands you should have the correct output string. Please add documentation to your worksheet to explain how it works. Just a few sentences is sufficient, but imagine that you were opening up the worksheet for the first time and wanted to know what it did.

Just so I am as clear as possible. I should be able to change the values of r1, r2, r3 and your program should work NOT just for the values of 10,2,8 that were given in the example.

You should finish your assignment before class Thursday, September 20, 2012.