Part II
Summer Semester, 2003

(Styles, structure: 10 points)

Prepare nice notebook with styles. Do clear sectioning.

(15 points)

Consider a function f((Subscript[x, 1]),...,(Subscript[x, n])). Create a general Mathematica function that calculates second derivative matrix  ((∂_((Subscript[x, i]),(Subscript[x, j])))f((Subscript[x, 1]),...,(Subscript[x, n]))) if the variables are given in the list var={x1,x2,...,xn}. Give an example.

(15 points)

Create a Mathematica function that calculates the approximate value of the integral (∫_a^b)f(x)dx of the function f(x) over the interval [a,b] by the trapezoid formula:

h (0.5 f((Subscript[x, 0]))+f((Subscript[x, 1]))+...+f((Subscript[x, n-1])) +0.5f((Subscript[x, n])))

where (Subscript[x, i])=a+i h, and h=((b-a)/n). Apply it to the case (∫_(-2)^2) (e^(-(x^2)))dx with  n=1,...,10.

(40 points)

Create a laser show:

Take the points (Subscript[P, 1]), (Subscript[P, 2]), ..., (Subscript[P, n])   (n ∈ N) (light sources) in  the 2D space with different colors. Choose randomly one (Subscript[P, i]), and draw a light ray from it to a randomly chosen another point (Subscript[P, j]) with the color of the source point. It activates the light source point (Subscript[P, j]), from which the previous process is repeated, and so on. Write Mathematica functions for one step and the iteration.

(Styles, structure: 10 points)

Prepare nice notebook with styles. Do clear sectioning.

(15 points)

Consider the matrix  ((Subscript[x, i,k])), i=1,...,n, k=1,...,m,. Create a general Mathematica function that calculates the value (max_k)((∑_i)|(Subscript[x, i,k])|),  i.e., the maximum of the sum of the elements' absolute value in columns.

(15 points)

Solve numerically the scalar differential equation x'=f(t,x) with the initial condition x((Subscript[t, 0]))=(Subscript[x, 0]) using the Euler's method on the interval [(Subscript[t, 0]),T]. Divide the interval [(Subscript[t, 0]),T] into n equal part, let (Subscript[t, 0]), (Subscript[t, 1]), ...,(Subscript[t, n])=T be the divison points (h=(Subscript[t, i+1])-(Subscript[t, i])=((T-(Subscript[t, 0]))/n)). Approximate the solution on the interval [(Subscript[t, 0]),(Subscript[t, 1])] by its tangent line x=(Subscript[x, 0])+f((Subscript[t, 0]),(Subscript[x, 0]))(t-(Subscript[t, 0])), and hence let (Subscript[x, 1])=(Subscript[x, 0])+f((Subscript[t, 0]),(Subscript[x, 0]))h. In general, let (Subscript[x, i+1])=(Subscript[x, i])+f((Subscript[t, i]),(Subscript[x, i]))h. 
Create a Mathematica function that accepts the right-hand side of the differential equation,   x, t,(Subscript[t, 0]),T and n, and it yields the list {{(Subscript[t, n]),(Subscript[x, n])},...,{(Subscript[t, n]),(Subscript[x, n])}}.

(40 points)

Write a program in Mathematica to visualize the following iteration. Take a triangle with the vertices (Subscript[p, 1]),(Subscript[p, 2]),(Subscript[p, 3]) and an arbitrary point (Subscript[q, 0]) inside. Choose randomly one of the vertices (let it be (Subscript[p, i])) and let (Subscript[q, 1]) the middle point of the line-segment ((Subscript[q, 0]),(Subscript[p, i])). Then, iterate this algorithm: apply it to (Subscript[q, 1]), and so on...