Your Turn to Try (two problems):

1. Look up Table[] and Prime[] in the help browser.

Make a 100 element list of r[i] where
	
	r[i] = Prime[i + 1]/Prime[i]
Plot it.

2. Construct an array, MyArray, with Dimensions[] = {6,6,6} where
	
		MyArray[[i,j,k]] = Sin[((i Pi)/6)] Sin[((j Pi)/6)] Sin[((k Pi)/6)]
Write a function to generalize this last part to dimensions {N,M,P}

listprimefractions = 
      Table[Prime[i + 1]/Prime[i], {i, 1, 100}]

ListPlot[listprimefractions]

MyArray = 
      Table[ Sin[i Pi/6]  Sin[j Pi / 6] Sin[k Pi/6],  {i,  1,  
          6},  {j,  1,  6},  {k,  1,  6}]
Dimensions[MyArray]

t[n_, m_,  p_]  := 
      Table[Sin[i Pi/n] Sin[j Pi/m] Sin[k Pi/p],  {i, 1, n},  {j, 1, 
          m},  {k, 1, p}]

Dimensions[t[6, 1, 3]]

Your Turn to Try:

For a state of plane stress, the two-dimensional linear elastic stresses and strains are related by

(({{(Subscript[ϵ, xx])}, {({{(Subscript[ϵ, yy])}, {(Subscript[ϵ, xy])}})}}))=(1/E) (({{1, -ν}, {({{-ν}, {0}}), ({{1}, {0}})}})  ({{({{0}, {0}})}, {2 (1 + ν)}}))(({{(Subscript[σ, xx])}, {({{(Subscript[σ, yy])}, {(Subscript[σ, xy])}})}}))

1. Solve for the stresses ((Subscript[σ, xx]), etc) in terms of the strain.

2. Find the conditions on stress, such that all of the strains are equal

3. Look up Eigenvalues, what are the eigenvalues of the above matrix?

compliance  = 
      1/Youngs*
{
{1,  -ν, 
            0}, 
{-ν, 1,  
            0}, 
{0, 0, 
            2 (1  +  ν)}
}

strain  =  {exx,  eyy,  exy};
stress  =  {sxx, syy,  sxy};

stiffness = Simplify[Inverse[compliance]]

conditions  =  stiffness . stress  ==  {1, 1, 1}

Reduce[conditions, {sxx, syy, sxy}]

Eigenvalues[compliance]

Your Turn to Try:

Write a function SinInt(z) that calculates:
		
		SinInt(z) = (∫_0^z) sin[
            2 π x sin(2  πx)] dx
Plot Snint(z) with respect to z from z=0 to z=3.

SinInt[z_]  :=  
      NIntegrate[Sin[2 Pi x Sin[2 Pi x]], {x, 0, z}]

Plot[SinInt[z], {z, 0, 3}]

Your Turn to Try:

Consider steady-state diffusion (say of heat or a chemical species) across a finite block with diffusivity D.  This is a one-dimensional problem:

	(d/(d x))(D ((d T)/dx))  =  
        0

       
and suppose the boundary conditons are T(x=0) = 1, T(x=1) = 0

Suppose the diffusivity of the block is given by D =  1 + (e^(-10 (x^2))).

1. Calculate a closed form approximation
to T(x) by replacing D with its spatial average <D> = (∫_0^1) D (x) dx

2. Calculate a numerical approximation to T(x).

Clear[t]

dffsity  =  1  +  Exp[-10 x^2]

ODE[d_]  :=  D[d D[t[x], x], x]  ==  0

ODE[dffsity]

DSolve[{ODE[dffsity], t[0] == 1, t[1] == 0}, t[x], x]

avediff  =  Integrate[dffsity, {x, 0, 1}]

DSolve[{ODE[avediff], t[0] == 1, t[1] == 0}, t[x], x]

numsol  =  
      NDSolve[{ODE[dffsity], t[0] == 1, t[1] == 0}, 
        t[x], {x, 0, 1}]

Plot[{t[x] /. numsol[[1]], 1 - x}, {x, 0, 1}]