Math 151 Lab 11/5/09 Michael Pelsmajer & Jiarui YangThree demonstrations Run the following. The resulting list is a bunch of special commands, including NewtonsMethod, AntiderivativeTutor, and more.with(plots);with(Student[Calculus1]);After running that, all those commands are available to be used. (Change semicolons to colons if you don't want to see all that.)1. Using Maple to get intuition about antiderivatives.f := x -> x^2+5*x-x^5/300;Maple will find you an antiderivative,AntiderivativePlot(f(x), output = antiderivative);Maple can plot a function together with an antiderivative, or with several antiderivatives (on an interval).AntiderivativePlot(f(x), x=-8..8);
AntiderivativePlot(f(x), x=-8..8, showclass);You can select the antiderivative that passes through a particular point, say through LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYmLUkjbWlHRiQ2I1EhRictSShtZmVuY2VkR0YkNiQtRiM2Jy1JI21uR0YkNiRRIjJGJy8lLG1hdGh2YXJpYW50R1Enbm9ybWFsRictSSNtb0dGJDYtUSIsRidGOC8lJmZlbmNlR1EmZmFsc2VGJy8lKnNlcGFyYXRvckdRJXRydWVGJy8lKXN0cmV0Y2h5R0ZBLyUqc3ltbWV0cmljR0ZBLyUobGFyZ2VvcEdGQS8lLm1vdmFibGVsaW1pdHNHRkEvJSdhY2NlbnRHRkEvJSdsc3BhY2VHUSYwLjBlbUYnLyUncnNwYWNlR1EsMC4zMzMzMzMzZW1GJy1GPDYtUSomdW1pbnVzMDtGJ0Y4Rj8vRkNGQUZFRkdGSUZLRk0vRlBRLDAuMjIyMjIyMmVtRicvRlNGWi1GNTYkUSQxMDBGJ0Y4RjhGOEYrRjg=.AntiderivativePlot(f(x), x=-8..8, value = [2,-100]);Note: We can't control the y-range - at least, not at first.However, if you right-click on the plot, then select Axes -> Plot... -> Vertical, you can see what the y-range is.For example, on the previous plot, it is [-303.092,147.149].You can also change the y-range.1.a. What is the exact y-range shown in the first plot in this assignment?1.b. Once you've finished 1.a, change the first plot so that the y-range is [-500,500].Maple can also plot the slope field (or "direction field"): the hash mark at the pointLUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYmLUkjbWlHRiQ2I1EhRictSShtZmVuY2VkR0YkNiQtRiM2Ji1GLDYlUSJ4RicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUkjbW9HRiQ2LVEiLEYnL0Y7USdub3JtYWxGJy8lJmZlbmNlR1EmZmFsc2VGJy8lKnNlcGFyYXRvckdGOS8lKXN0cmV0Y2h5R0ZFLyUqc3ltbWV0cmljR0ZFLyUobGFyZ2VvcEdGRS8lLm1vdmFibGVsaW1pdHNHRkUvJSdhY2NlbnRHRkUvJSdsc3BhY2VHUSYwLjBlbUYnLyUncnNwYWNlR1EsMC4zMzMzMzMzZW1GJy1GLDYlUSJ5RidGN0Y6RkFGQUYrRkE= has slope LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYlLUkjbWlHRiQ2JVEiZkYnLyUnaXRhbGljR1EldHJ1ZUYnLyUsbWF0aHZhcmlhbnRHUSdpdGFsaWNGJy1JKG1mZW5jZWRHRiQ2JC1GIzYkLUYsNiVRInhGJ0YvRjIvRjNRJ25vcm1hbEYnRj1GPQ==.We can choose the y-range, and I choose it so that it agrees with the previous plot.fieldplot([1,f(x)], x=-8..8, y=-303.092..147.149, arrows=LINE, fieldstrength = fixed);We can also combine a fieldplot with an antiderivative plot, as long as we know the y-range of the antiderivative plot, and choose the y-range of the fieldplot so that it matches.A := AntiderivativePlot(f(x), x=-8..8, value = [2,-100]):
B := fieldplot([1,f(x)], x=-8..8, y=-303.092..147.149, arrows=LINE, fieldstrength = fixed):
display(A,B);In the plot, you can see that the tangent slopes on the antiderivative really does correspond to the slope field.1.c. Make a plot that has the first plot in this assignment together with a slope field. 1.d. Make a plot with several antiderivatives of a function of your choice, on the domain LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYmLUkjbWlHRiQ2I1EhRictSShtZmVuY2VkR0YkNiQtRiM2Jy1JI21vR0YkNi1RKiZ1bWludXMwO0YnLyUsbWF0aHZhcmlhbnRHUSdub3JtYWxGJy8lJmZlbmNlR1EmZmFsc2VGJy8lKnNlcGFyYXRvckdGPS8lKXN0cmV0Y2h5R0Y9LyUqc3ltbWV0cmljR0Y9LyUobGFyZ2VvcEdGPS8lLm1vdmFibGVsaW1pdHNHRj0vJSdhY2NlbnRHRj0vJSdsc3BhY2VHUSwwLjIyMjIyMjJlbUYnLyUncnNwYWNlR0ZMLUkjbW5HRiQ2JFEiMUYnRjgtRjU2LVEiLEYnRjhGOy9GP1EldHJ1ZUYnRkBGQkZERkZGSC9GS1EmMC4wZW1GJy9GTlEsMC4zMzMzMzMzZW1GJ0ZPRjhGOEYrRjg=. I ask that you choose a function that is (1) continuous on LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYmLUkjbWlHRiQ2I1EhRictSShtZmVuY2VkR0YkNiQtRiM2Jy1JI21vR0YkNi1RKiZ1bWludXMwO0YnLyUsbWF0aHZhcmlhbnRHUSdub3JtYWxGJy8lJmZlbmNlR1EmZmFsc2VGJy8lKnNlcGFyYXRvckdGPS8lKXN0cmV0Y2h5R0Y9LyUqc3ltbWV0cmljR0Y9LyUobGFyZ2VvcEdGPS8lLm1vdmFibGVsaW1pdHNHRj0vJSdhY2NlbnRHRj0vJSdsc3BhY2VHUSwwLjIyMjIyMjJlbUYnLyUncnNwYWNlR0ZMLUkjbW5HRiQ2JFEiMUYnRjgtRjU2LVEiLEYnRjhGOy9GP1EldHJ1ZUYnRkBGQkZERkZGSC9GS1EmMC4wZW1GJy9GTlEsMC4zMzMzMzMzZW1GJ0ZPRjhGOEYrRjg=, and (2) has a reasonably interesting looking antiderivative.1.e. Make a plot that combines the previous plot (from 1.d) with a direction field.Perhaps the easiest way to generate examples of antiderivatives is this:AntiderivativeTutor(x^2);1.f. Try it, and try changing some parameters. For example, try "Show class of antiderivatives" button (use "Display" to see the effect), and try changing the function.(For this one, there's nothing for you to hand in.)2. Using Maple to get intuition about approximating area by rectangles (Riemann Sums)Another one of the special commands is RiemannSum.RiemannSum(x^2, -5..6, method=right, partition=4, output=plot); 2.a. What is the total area of the rectangles? (It's written there.) What is a ? What is b ? What is \316\224x ? What is n ?2.b. Do the same Maple command, but with lefthand approximations. What is the the total area of the rectangles?2.c. Do it now choosing points at "random", rather than left or right. Run this one several times, and each time, note the total area of the rectangles. Write down data as a list (of the various total areas you found).3.a, 3.b, 3.c. Redo parts 2.a, 2.b, and 2.c with a function of your choice, with a domain of your choice. However, the function must be non-negative (i.e., it can never go below the x-axis). Also, this time, make it so the rectangles are very thin.4. Try this:ApproximateIntTutor(x*cos(x));You should see a plot of a function, with rectangles representing a Riemann Sum.
"Area (Approximate Integral)" is the Riemann Sum: the sum of the signed area of the rectangles.4.a. Try changing n, a, b, one at a time. After each, click "Display" to see what happens. Try changing it to "Random", and click Display several times, while seeing how the picture and the sum changes. Try "Animate", and see how the approximation is better as the rectangles get thinner.(For this one, there's nothing for you to hand in.) 5. Using Maple to gain intuition about Newton's MethodTry this:f2 := x-> x^3-x;NewtonsMethod(f2(x), x=2, iterations = 5, output=plot);NewtonsMethod(f2(x), x=2, iterations = 5, output=sequence);Ignore for the moment the fact that Newton's Method sometimes fails (like on the cube-root of x).More iterations gives better accuracy. But how many iterations do you need to become "accurate enough". I never really answered that during class. How fast do the approximations in Newton's Method approach the root? In short, the answer is "Very Fast!". It'a quadratic rate of convergence (whatever that means). Wikipedia claims that intuitively, the number of digits accuracy doubles every iteration (at least - it could be better). While the theory justifying that is beyond the scope of this course, we can see this in action, experimentally. 5.a. What is the root that is being approached above? 5.b. Modify it so that we see 10 iterations. Then, list the error for each of the 10 approximations. (Error is the absolute value of the difference between the approximation and the actual root.) Discuss whether Wikipedia seems to be (more or less) correct.