Assignment 2, Computer part, due Friday, Sept. 3, 1999.

Write your name here!!!

Some programming.

\(
Needs["Graphics`Colors`"]
\)\(plot1\  := \ 
      Plot[fprime[x], \ {x, \ \(-2\), \ 2}, 
	
        PlotStyle\  -> {AbsoluteThickness[1], Blue}, 
		
        DisplayFunction\  -> Identity]; 

    plot2\  := \ \ 
      Plot[g[x], \ {x, \ \(-2\), \ 2}, 
	
        PlotStyle\  -> {AbsoluteThickness[1], Green}, 
		
        DisplayFunction\  -> Identity]; 

    showboth\  := \ 
      Show[{plot1, \ plot2}, \ 
		DisplayFunction\  -> \ $DisplayFunction]
        




\)

Exercise 0.

Exercise 1.

\(\(
H\  = \ Table[\  .1^n, \ {n, 1, 10}]; 

    TableForm[Map[\ {#, \ \((Cos[#] - 1)\)/#}&, \ H]]

\)\)

\(\(
H\  = \ Table[\  .1^n, \ {n, 1, 10}]; 

    TableForm[Map[\ {#, \ \((Sin[#])\)/#}&, \ H]]

\)\)

Exercise 2.

\(Clear[f, \ a]; 


f[x_]\  := \ x^3\  - \ 2  x^2\)\(a\  = \ 3.5; 



    For[n = 1, n ≤ 8, \(n++\), 
	h =  .1\^n; 
	
      Print[\(f[a + h] - f[a]\)\/h]]\)

Exercise 3.

Clear[f,  fprime]\(f[x_]\  := x^4\  - \ 2  x^2\  + \ 3  x\  - 4
\)

\(\(fprime[x_]\  = \ \(f'\)[x]
\)\)

\(\(h\  = \  .5; 
g[x_]\  := \ \ \(f[x + h]\  - \ f[x]\)\/h
\)\)

\(\(
\(showboth; \)\)\)

\(h\  = \  .1; 
g[x_]\  := \ \ \(f[x + h]\  - \ f[x]\)\/h\)showboth;

\(h\  = \  .01; 
g[x_]\  := \ \ \(f[x + h]\  - \ f[x]\)\/h\)showboth;