3.016 Problem Set #4, 2010

I4-1

First express the matrix in matrix format:

matrixI41 =
{
{1,4,-2},
{4,1,2},
{-2,2,-2}};
MatrixForm[matrixI41]

Find out determinant of the matrix :

Det[matrixI41]

Note that the determinant is not zero.
Now define the rotation matrix with the rotation angle θ around x-axis:

rotationX = RotationMatrix[θ,{1,0,0}];
MatrixForm[rotationX]

Now define the rotation matrix with the rotation angle θ around z-axis:

rotationZ = RotationMatrix[θ,{0,0,1}];
MatrixForm[rotationZ]

The first operation is the first to multiply, so the second operation "left multiplies" the first operation.

firstXthenZ = rotationZ.rotationX;
MatrixForm[firstXthenZ]

The above is the overall transformation matrix for the first rotation sequence.
Now find out the final new matrix after the first rotation sequence:

newMatrixXthenZ= Simplify[Inverse[firstXthenZ].matrixI41.firstXthenZ];
MatrixForm[newMatrixXthenZ]

Check the determinant, and simplify it:

Det[newMatrixXthenZ]
Simplify[Det[newMatrixXthenZ]]

The determinant is still -10, the same as the original matrix!

Now do the rotation with a difference order, first θ around z-axis and then θ around x-axis:

firstZthenX = rotationZ.rotationZ;
MatrixForm[firstZthenX]

After getting the above transformation matrix, find out the final new matrix after the second rotation sequence:

newMatrixZthenX= Simplify[Inverse[firstZthenX].matrixI41.firstZthenX];
MatrixForm[newMatrixZthenX]

Note that after changing the sequence of rotation, the final transformed matrix is also different!
Now find out the determnant:

Det[newMatrixZthenX]
Simplify[Det[newMatrixZthenX]]

The determinants are unchanged after two different rotation sequences, the determinants are invarient.

I4-2

Here is some Mathematica code that takes a vector of numbers for red, green, and blue and draws a colored circle:

rgbCircle[{r_?NumberQ, g_?NumberQ, b_?NumberQ}] :=Module[
{maxval=Abs[ Max[{r,g,b}]], rs,bs,gs},
{rs,gs,bs} = Abs[{r,g,b}]/maxval;
 Graphics[{RGBColor[rs,gs,bs],Disk[]}]
]

rgbCircle[{12,4, 1}]

This is a red circle:

rgbCircle[{1,0, 0}]

This is a green circle:

rgbCircle[{0,1, 0}]

This is a blue circle:

rgbCircle[{0,0, 1}]

Purple is half blue and half red, Orange is half red and half green, and Cyan is half green and half blue. First define the matrix that converts a vector given as (r, g, b) to a vector given as purple, orange, cyan (p, o, c).

rgbTopoc = {
{1/2,0,1/2},
{1/2,1/2,0},
{0,1/2,1/2}
};
MatrixForm[rgbTopoc]

Det[rgbTopoc]

Determinant is not zero. Find out the inverse of the above matrix:

pocTorgb = Inverse[rgbTopoc];
MatrixForm[pocTorgb]

pocTorgb.{1,0,0}

pocCircle[{p_,o_,c_}] := rgbCircle[pocTorgb.{p,o,c}]

pocCircle[{1,0,0}]

pocCircle[{1,1,3}]

This didn't work as I expected because of the normalization that I picked, I will rewrite the function to use a unit normal for any color:

rgbCircle[{r_?NumberQ, g_?NumberQ, b_?NumberQ}] :=Module[
{rs,bs,gs},
{rs,gs,bs} = Abs[Normalize[{r,g,b}]];
 Graphics[{RGBColor[rs,gs,bs],Disk[]}]
]

rgbCircle[{1,0,0}]

pocCircle[{p_,o_,c_}] := rgbCircle[pocTorgb.{p,o,c}]

pocTorgb.{0,1,0}

pocCircle[{0,1,0}]

This still doesn't work... I think it is because everything must be mapped to the positive octant. This was a badly posed problem---my fault. Students will get credit for attempting the solution.

I4-3

First define desired function:

blotz = z Log[z] + (1-z)Log[1-z]

Plot the real part of the function:

Plot[Re[blotz],{z,-2,2}]

Plot the imaginary part of the function:

Plot[Im[blotz],{z,-2,2}]

Plot them together:

Plot[{Re[blotz],Im[blotz]},{z,-2,2}]

Function is complex outside of (0,1). Imaginary part increases or decreases linearly.

Now taking the first and second derivatives:

dblotz= D[blotz,z]

ddblotz = D[blotz,{z,2}]

Now plot the real and imaginary parts of the first derivative:

Plot[{Re[dblotz],Im[dblotz]},{z,-2,2}]

Thus, the first derivative produces three segments of constant imaginary part. Note that this function has an infinite derivative at 0 and 1, although the function itself is finite.

Now plot the real and imaginary parts of the second derivative:

Plot[{Re[ddblotz],Im[ddblotz]},{z,-2,2},PlotRange-> {-2,5}]

Thus, the second derivative produces a function that is real everywhere, except at the singularities at 0 and 1.

I4-4

First define the plotting function with a variable range...

thePlot[range_]:=Plot3D[ArcTan[x,y],{y,-range,range},{x,-range,range}]

Plot the function with different ranges:

thePlot[1]

thePlot[5]

thePlot[9]

This looks like a screw dislocation...