Double Integrals I

Load the plotting package:

<< Graphics`

Part 1. Review of Numerical Methods for One-Variable Integrals

Enter the integrand as a function of one variable:

g[t_] = Exp[-(1/2) (t^2)]

The following commands calculate a Riemann sum approximation to the definite integral \(TraditionalForm
      \`∫\+\(-1\)\%3\( g(t)\) dt\).  Exlplain why.  [Note:  The Mathematica name deltat is used here to stand for the mathematical name Δt.]

\(n = 10; 
deltat = 4/n; 
t[i_] = \(-1\) + i*deltat; 

    approx := Sum[g[t[i]]*deltat, {i, n}]; 
N[approx]\)

Record the approximating sums for n = 10,  n = 20,  n = 100,  n = 200, and n = 1000 terms.  Then give your estimate for the value of the integral.

Approximating sums:
	n = 10:
	n = 20:
	n = 100:
	n = 200:
	n = 1000:

Estimate the value of the integral:

Explain why the next calculation gives a Trapezoidal Rule approximation.

\(n = 10; 
deltat = 4/n; 
t[i_] = \(-1\) + i*deltat; 

    trap := Sum[\((\((g[t[i]] + g[t[i - 1]])\)/2)\)*deltat, {i, n}]; 

    N[trap]\)

Calculate this approximation for n = 10,  20, and 40 terms and record your results.

Trapezoidal Rule Approximations:
	n = 10 : 
	n = 20 : 
	n = 40 :

Explain why the next calculation gives a Midpoint Rule approximation.

\(n = 10; 
deltat = 4/n; 
t[i_] = \(-1\) + i*deltat; 

    mid := Sum[g[\((t[i] + t[i - 1])\)/2]*deltat, {i, n}]; 
N[mid]\)

Calculate this approximation for n = 10,  20, and 40 terms and record your results.

Midpoint Rule Approximations:
	n = 10 : 
	n = 20 : 
	n = 40 :

Based on your calculations with the Trapezoidal and Midpoint Rules, what is your estimate of the value of the definite integral?
	Estimate:

Simpson's Rule is a weighted sum of the Trapezoidal Rule and Midpoint Rule approximations, as indicated in the following calculation.  What are the weights?

\(n = 20; 
deltat = 4/n; 
t[i_] = \(-1\) + i*deltat; 

    trap := Sum[\((\((g[t[i]] + g[t[i - 1]])\)/2)\)*deltat, {i, n}]; 

    mid := Sum[g[\((t[i] + t[i - 1])\)/2]*deltat, {i, n}]; 

    simp := 2/3*mid + 1/3*trap; 
N[simp]\)

Here is Mathematica's numerical estimate of the value of the integral.

N[Integrate[g[t], {t, -1, 3}]]

Part 2. Double Integrals Over Coordinate Rectangles

Enter the integrand f as a function of two variables, and graph the function over the coordinate rectangle [-π, π] x [-π, π].

f[x_, y_] = Cos[Pi x^2]*Exp[-x^2] + x y + 1Plot3D[f[x, y], {x, -Pi, Pi}, {y, -Pi, Pi}, 
      AxesLabel -> {x, y, f}]

Explain briefly why the following sum approximates the double integral \(TraditionalForm
      \`∫\+\(-
            π\)\%π\(∫\+\(-π\)\%π\( f(x, y)\) dx\ dy
            \)\).

\(n = 10; 
deltax = 2  Pi/n; 
deltay = 2  Pi/n; 

    deltaA = deltax\ deltay; 
x[i_] = \(-Pi\) + i*deltax; 

    y[j_] = \(-Pi\) + j*deltay; 

    approx := Sum[Sum[f[x[i - 1], y[j - 1]]*deltaA, {j, n}], {i, n}]; 

    N[approx]\)

Calculate and record the approximations for n = 10,  20, 40, and 80.  Based on these calculations, give your best estimate of the value of the integral.

Approximating sums:
	n = 10:
	n = 20:
	n = 40:
	n = 80:

Estimated value of the integral:

Now define a better approximation method for the double integral \(TraditionalForm
      \`∫\+\(-
            π\)\%π\(∫\+\(-π\)\%π\( f(x, y)\) dx\ dy
            \)\).  Carry out your approximation for n = 10 and n = 20.

#  Enter your own evaluation method here.

Use this space to describe your method and record your results.

Use hand calculation to reduce the evaluation of the double integral to the calculation of a single one-variable definite integral.  Use Mathematica's numerical integration routine to evaluate that integral, and compare the result to your approximation.

#  Enter your own evaluation method here.

If you need to do further calculations to resolve any differences, do them here.

Part 3: Double Integrals over More General Regions

Enter the integrand h below as a function of two variables.  Plot this function over the coordinate rectangle [0, 1] x [0, 1].

h[x_, y_] = x (y^2) + x - yPlot3D[h[x, y], {x, 0, 1}, {y, 0, 1}, AxesLabel -> {x, y, h}, 
      ViewPoint -> {-2.4, -1.3, 2}]

Enter the definition of the function H, which agrees with h on the domain of the integral and is 0 outside that domain.

H[x_, y_] = If[y >= (x^2)  &&  y <= (Sqrt[x]), h[x, y], 0]

Here is the plot of the extended function H.

Plot3D[H[x, y], {x, 0, 1}, {y, 0, 1}, AxesLabel -> {x, y, H}, 
      PlotPoints -> 51, ViewPoint -> {-2.4, -1.3, 2}, 
      PlotRange -> {-1, 1}]

Enter your commands here to estimate the value of the double integral of h over D by using the extended function H and the definition of the double integral.

# Estimations of the integral from the definition.

Record your results for estimates from the definition with n = 10,  20, and 40.

Approximating sums:
	n = 10:
	n = 20:
	n = 40:

Enter your commands here to approximate the integral of H over [0, 1] x [0, 1].

# Numerical Estimation.

Compare your numerical estimation with the exact hand calculation.

Part 4: Summary

Enter your responses to the summary questions here.