\(

\def\Real{\mathbb{R}}

\def\Comp{\mathbb{C}}

\def\Rat{\mathbb{Q}}

\def\Field{\mathbb{F}}

\def\Fun{\mathbf{Fun}}

\def\e{\mathbf{e}}

\def\f{\mathbf{f}}

\def\bv{\mathbf{v}}

\)

Use any language or library. The assignments are due by midnight of 3.14 (Monday).

#### 3 credits students

Consider the piecewise linear function \(f\) on \([-4,4]\)

with nodes at the integer points \(-4,-3,\ldots, 3, 4\) (it means that the function is continuous and linear on each interval \([k,k+1]\), such that \(f(k)\) is the \((k+5)\)-th digit of your UIN.

Find the polynomial

\[

p=a_o+a_1x+\ldots+a_4x^4

\]

of degree \(4\) minimizing the mean square error

\[

\int_{-4}^4 |p(x)-f(x)|^2 dx.

\]

Submit the solution in the following format:

- text file with the first line giving the coefficients of \(f\),
`[a_o a_1 a_2 a_3 a_4]`followed by

- the code and
- the execution output.
- Also attach a pdf where \(f\) and \(p\) are plotted on \([-4,4]\) simultaneously.

#### 4 credits students

Consider the spring networks: a network of points, \(p_{ij}, i=0,\ldots,10, j=0,\ldots,10,\), where two points \(p_{ij}\) and \(p_{kl}\) are connected by a spring if either \(i=k, |j-l|=1\) (horizontal neighbors) or \(|i-k|=1, j=l\) (vertical neighbors).

A configuration is a 2D placement of the network nodes, that is an assignment of two coordinates,

\[

(x_{ij}, y_{ij})

\]

to each node \(p_{ij}\).

The task is to minimize

\[

f=\frac12\left(\sum_{(i,j)\sim (k,l)}(x_{ij}-x_{kl})^2+(y_{ij}-y_{kl})^2\right),

\]

(the summation is over all neighboring pairs of nodes), subject to constraints

\[

x_{0,0}=0,y_{0,0}=0,x_{0,10}=0,y_{0,10}=10,x_{10,0}=10,y_{10,0}=0,x_{10,10}=10,y_{10,10}=10,

\]

and

\[

x_{5,5}=A_e, y_{5,5}=A_o,

\]

where \(A_e\) is the sum of digits of your UIN at even places, and \(A_o\) is the sum of digits of your UIN at odd places.

Submit the solution in the following format:

- text file with the coefficients \(x_{ij}\):
`x=[x(0,0) x(0,1) ... x(0,10); x(1,0) ... x(10,10)]`followed by coefficients \(y_{ij}\):

`y=[y(0,0) y(0,1) ... y(0,10); y(1,0) ... y(10,10)]`; - the code and
- the execution output.

When is this due? Thanks.

Due date posted.

Hello professor.

One question about the 4 credit problem. What is the set in which the assigned coordinate numbers should belong? Integer pairs in [0,10]x[0,10]?

x’s and y’s are real numbers.

Hello, professor! I wonder in the 4-credit problem, should I create the configuration table myself? If so, is there any constraints to follow? Or should it be completely random?

You have to find the optimal x’s and y’s, not random.

Hello Professor Yuliy,

I have a doubt regarding the Programming Exercise-01 -4 credits problem. Actually, I could not understand how each x and y have i,j co-ordinates. Are there 2 different planes, one plane called as X plane and the other Y-plane with A_e and A_o separately for each of them respectively. Then the springs would be along X-plane and Y-plane separately without interfering each other. It looks like a finite element topology optimization problem. Even the stiffness of the spring is not given., does that mean that I have to assume a stiffness with the co-ordinates at the 4 corners and the center fixed as per the problem constraints.

If possible can you elaborate on the problem?

x(i,j) and y(i,j) are variables indexed by i,j.

Stiffnesses of the springs are equal.

I have a question about the submission format.

It says to submit it by:

x=[x(0,0) x(0,1) … x(10,0); x(1,0) … x(10,10)]

but should this be

x=[x(0,0) x(0,1) … x(0,10); x(1,0), x(1,1), …, x(1,10); x(2,0), x(2,1), …, x(2,10); x(3, 0) … x(10,10)]

Thank you! corrected.

For credit 4 problem, we can solve x and y separately as they are independent. Am I right?

Yes.

Hi Professor, how should we submit our assignment? There seems to be no place to submit it on compass2g.

Compass has the assignment now.

Hi Professor,

Is iterative method for the 3 credits problem acceptable? Am I supposed to find a better algorithm in order to get full credits?

Yes – but you will have to indicate why you believe your solution is a good one (criteria of convergence).