Algorithm optimization

34 Views Asked by At

Let x $\in {R^{n\times1}}$ so that $x=(x_1,x_2,\dots,x_n)^T$

and $\textbf{diffmax} $ represents the absolute difference between two consecutive numbers , $\textbf{diffmax>=max\{$|x_i - x_{i+1}|,1\leq i <n $\}}$

now let $ x^0=(x^0_1,x^0_2,\dots,x⁰_n)^T$ a given a vector and $ x^j=(x^j_1,x^j_2,\dots,x^j_n)^T$ the new vector so that $x^j_1=x^0_1 , x^j_i=x^{j-1}_{i-1}+x^{j-1}_{i+1},x^j_n=x^0_n$

i have to find the minimun number of iterations so that $|x^j_i -x^j_{i+1}| \leq diffmax , $ for $ 1 \leq i<n $

my idea was that i can find the new x vector using matrix-vector multiplication and Dot product but something in betweem went wrong.

here is my idea :

Let x^0 $\in {R^{4\times1}}$ so that $x^0=(x⁰_1,x⁰_2,x⁰_3,x^0_4)^T$ and A $\in {R^{4\times 4}}$ matrix.

$$A= \begin{bmatrix} 1 & 0 & 0 & 0 \\ \frac{1}{2} & 0 & \frac{1}{2} & 0 \\ 0 & \frac{1}{2} & 0 & \frac{1}{2} \\ 0 & 0& 0& 1 \\ \end{bmatrix}$$

so now we can do this ,$ A*x^0 =x^1 \Rightarrow A^j *x^0=x^j$

$$\left\lVert A^k*x\right\rVert \leq \left\lVert A^k\right\rVert * \left\lVert x^0\right\rVert \leq {\left\lVert A\right\rVert}^k * \left\lVert x\right\rVert \leq (4+1)*( diffmax^2 +{ max\{|x^0_i|,1 \leq i<5\}}^2)$$

and because diffmax and $x^0$ are given i can then extract my number of iteration by applying the log function and do simple maths , but when i applied my idea to a concrete example i got a wrong number of iteration , which were too smaller than it should be .

I have tried to find an other approixmation, so please where have i made the mistake

let $y=A^k*x^0$

$${\left\lVert A^k*x\right\rVert}^2_2={\left\lVert y\right\rVert}^2_2=\sum_{i=1}^{n} y^2_i$$ $$|y_i -y_{i+1}|<diffmax \Leftrightarrow (y_i -y_{i+1})^2<diffmax^2 \Rightarrow y^2_i +y^2_{i+1}<diffmax^2 +2|y_i|*|y_{i+1}| \Rightarrow y^2_i +y^2_{i+1}<diffmax^2 +2*{\left\lVert x^0\right\rVert}^2_{1} $$ $${\left\lVert A^k*x\right\rVert}^2_2={\left\lVert y\right\rVert}^2_2=\sum_{i=1}^{n} y^2_i \leq 6*(diffmax^2 +2*{\left\lVert x^0\right\rVert}^2_{1})$$

so any good suggestion ?