# Demo 4: Formal limitations of Niezgoda et al (2008)

* Author: Mauricio Fernández
* Last update: 2020-06-17

Table of contents

* [1. Counterexample w.r.t. uniqueness of solution](#1.-Counterexample-w.r.t.-uniqueness-of-solution)
* [2. Example for vanishing DFT in all phases](#2.-Example-for-vanishing-DFT-in-all-phases)

## Description
The present notebook demonstrates some formal limitations encountered by the authors while testing 2pc-equivalence with respect to the published work

* [NFK] Niezgoda, S.R., Fullwood, D.T., and Kalidindi, S.R. (2008): **Delineation of the space of 2-point correlations in a composite material system**. *Acta Materialia* 56, 5285 - 5292.

First, an explicit analytic counterexample for the uniqueness of solution based on the system of equations considered in NFK is provided. Then, a second analytic example is presented, in which DFT components of the auto-correlations vanish for all phases. This implies that the approach of NFK can not be applied to all structures, since it requires non-vanishing DFT.


```python
import sympy as sym

import src.nfk2008 as nfk
```

## 1. Counterexample w.r.t. uniqueness of solution

Structure `S`, number of phases `n` and period vector `P`


```python
S = sym.Matrix([
    [2,3,1],
    [2,2,1],
    [2,3,3],
    [2,2,3]
])
n = max(S)
P = S.shape
S
```




$\displaystyle \left[\begin{matrix}2 & 3 & 1\\2 & 2 & 1\\2 & 3 & 3\\2 & 2 & 3\end{matrix}\right]$



Compute 2PC `Cs` and DFT of 2PC `Csf` for structure. 


```python
Cs = nfk.rCs(S)
Csf = [
    [nfk.dft(Cs[a][b]).expand().simplify() for b in range(n)] 
    for a in range(n)
]
```

Display DFT of auto-correlations $C_{11}$ (DFT `Csf[0][0]`), $C_{22}$ (DFT `Csf[1][1]`) and $C_{33}$ (DFT `Csf[2][2]`).


```python
Csf[0][0]
```




$\displaystyle \left[\begin{matrix}4 & 4 & 4\\2 & 2 & 2\\0 & 0 & 0\\2 & 2 & 2\end{matrix}\right]$




```python
Csf[1][1]
```




$\displaystyle \left[\begin{matrix}36 & 20 - 8 \sqrt[3]{-1} + 8 \left(-1\right)^{\frac{2}{3}} & 20 - 8 \sqrt[3]{-1} + 8 \left(-1\right)^{\frac{2}{3}}\\0 & 0 & 0\\4 & 4 & 4\\0 & 0 & 0\end{matrix}\right]$




```python
Csf[2][2]
```




$\displaystyle \left[\begin{matrix}16 & 8 - 4 \sqrt[3]{-1} + 4 e^{\frac{2 i \pi}{3}} & 8 - 4 \sqrt[3]{-1} + 4 e^{\frac{2 i \pi}{3}}\\2 & 2 & 2\\4 & 4 & 4\\2 & 2 & 2\end{matrix}\right]$



Check if the computed DFT `Csf` fulfill the system of equations of NFK


```python
nfk.check_system(Csf)
```




    True



Perturbation in DFT space


```python
z = sym.zeros(*P)
Delta = [[z,z,z],[z,z,z],[z,z,z]]
Delta[1][1] = sym.Matrix([[0,0,0],[0,0,0],[-2,1,1],[0,0,0]])
Delta[2][2] = Delta[1][1]
Delta[1][2] = -Delta[1][1]
Delta[2][1] = Delta[1][2]
```

Perturbed DFT


```python
Csf_Delta = [
    [Csf[a][b] + Delta[a][b] for b in range(n)] 
    for a in range(n)
]
```

Check that all DFT are identical for choice $\gamma = 1$


```python
all([
    Csf[0][b]==Csf_Delta[0][b] and Csf[b][0]==Csf_Delta[b][0] 
    for b in range(n)
])
```




    True



Check that perturbed DFTs `Csf_Delta` fulfill system of equations of NFK


```python
nfk.check_system(Csf_Delta)
```




    True



In a nonlinear system $f(x,y) = 0$ with given $y$, if $x_1 \neq x_2$ fulfill $f(x_1,y) = 0$ and $f(x_2,y) = 0$, then the system is **not** uniquely solvable. In the present example $y$ corresponds to the assumed given DFTs for $\gamma = 1$ (identical for `Csf` and `Csf_Delta`). Then, $x_1$ and $x_2$ correspond to the remaining DFT of `Csf` and `Csf_Delta`, which naturally differ exactly by `Delta`, i.e., $x_1 \neq x_2$. The system $f(x,y) = 0$ corresponds to the system of equations listed in NFK, i.e., `nfk.check_system`. The system of NFK is **not** uniquely solvable, as proven by this analytic example.

## 2. Example for vanishing DFT in all phases

Structure with 3 phases


```python
S = sym.Matrix([
    [1,1,3],
    [1,2,3],
    [1,1,3],
    [3,1,2]
])
n = max(S)
```

2PC and DFT of all phases


```python
Cs = nfk.rCs(S)
Csf = [
    [nfk.dft(Cs[a][b]) for b in range(n)] 
    for a in range(n)
]
```

Vanishing DFT components in all auto-correlations $C_{11}, C_{22}$ and $C_{33}$


```python
Csf[0][0]
```




$\displaystyle \left[\begin{matrix}36 & 18 + 9 e^{- \frac{2 i \pi}{3}} + 9 e^{\frac{2 i \pi}{3}} & 18 + 9 e^{- \frac{2 i \pi}{3}} + 9 e^{\frac{2 i \pi}{3}}\\0 & 2 - e^{\frac{2 i \pi}{3}} - e^{- \frac{2 i \pi}{3}} & 2 - e^{\frac{2 i \pi}{3}} - e^{- \frac{2 i \pi}{3}}\\4 & 2 + e^{- \frac{2 i \pi}{3}} + e^{\frac{2 i \pi}{3}} & 2 + e^{- \frac{2 i \pi}{3}} + e^{\frac{2 i \pi}{3}}\\0 & 2 - e^{\frac{2 i \pi}{3}} - e^{- \frac{2 i \pi}{3}} & 2 - e^{\frac{2 i \pi}{3}} - e^{- \frac{2 i \pi}{3}}\end{matrix}\right]$




```python
Csf[0][0].as_real_imag()
```




    (Matrix([
     [36, 9, 9],
     [ 0, 3, 3],
     [ 4, 1, 1],
     [ 0, 3, 3]]),
     Matrix([
     [0, 0, 0],
     [0, 0, 0],
     [0, 0, 0],
     [0, 0, 0]]))




```python
Csf[1][1]
```




$\displaystyle \left[\begin{matrix}4 & 2 + e^{- \frac{2 i \pi}{3}} + e^{\frac{2 i \pi}{3}} & 2 + e^{- \frac{2 i \pi}{3}} + e^{\frac{2 i \pi}{3}}\\0 & 2 - e^{\frac{2 i \pi}{3}} - e^{- \frac{2 i \pi}{3}} & 2 - e^{\frac{2 i \pi}{3}} - e^{- \frac{2 i \pi}{3}}\\4 & 2 + e^{- \frac{2 i \pi}{3}} + e^{\frac{2 i \pi}{3}} & 2 + e^{- \frac{2 i \pi}{3}} + e^{\frac{2 i \pi}{3}}\\0 & 2 - e^{\frac{2 i \pi}{3}} - e^{- \frac{2 i \pi}{3}} & 2 - e^{\frac{2 i \pi}{3}} - e^{- \frac{2 i \pi}{3}}\end{matrix}\right]$




```python
Csf[1][1].as_real_imag()
```




    (Matrix([
     [4, 1, 1],
     [0, 3, 3],
     [4, 1, 1],
     [0, 3, 3]]),
     Matrix([
     [0, 0, 0],
     [0, 0, 0],
     [0, 0, 0],
     [0, 0, 0]]))




```python
Csf[2][2]
```




$\displaystyle \left[\begin{matrix}16 & 10 + 3 e^{- \frac{2 i \pi}{3}} + 3 e^{\frac{2 i \pi}{3}} & 10 + 3 e^{- \frac{2 i \pi}{3}} + 3 e^{\frac{2 i \pi}{3}}\\0 & 2 - e^{\frac{2 i \pi}{3}} - e^{- \frac{2 i \pi}{3}} & 2 - e^{\frac{2 i \pi}{3}} - e^{- \frac{2 i \pi}{3}}\\0 & 2 - e^{\frac{2 i \pi}{3}} - e^{- \frac{2 i \pi}{3}} & 2 - e^{\frac{2 i \pi}{3}} - e^{- \frac{2 i \pi}{3}}\\0 & 2 - e^{\frac{2 i \pi}{3}} - e^{- \frac{2 i \pi}{3}} & 2 - e^{\frac{2 i \pi}{3}} - e^{- \frac{2 i \pi}{3}}\end{matrix}\right]$




```python
Csf[2][2].as_real_imag()
```




    (Matrix([
     [16, 7, 7],
     [ 0, 3, 3],
     [ 0, 3, 3],
     [ 0, 3, 3]]),
     Matrix([
     [0, 0, 0],
     [0, 0, 0],
     [0, 0, 0],
     [0, 0, 0]]))



Since in all DFT (of the auto-correlations) components vanish, no choice for $\gamma$ can be found in order to use the approach of NFK.


```python

```

4f0f772a6c98bf0c3c2f8f17efce0c9a4046f833
ipynb
Jupyter Notebook
demo4_niezgoda_2008.ipynb
mauricio-fernandez-l/EQ2PC
28b409efe401ff6598c57e563fbafbb8a0eabfae
BSD-3-Clause
2021-07-09T03:53:15.000Z
2022-01-17T09:48:07.000Z
demo4_niezgoda_2008.ipynb
mauricio-fernandez-l/EQ2PC
28b409efe401ff6598c57e563fbafbb8a0eabfae
BSD-3-Clause
demo4_niezgoda_2008.ipynb
mauricio-fernandez-l/EQ2PC
28b409efe401ff6598c57e563fbafbb8a0eabfae
BSD-3-Clause
2020-02-28T09:46:50.000Z
2020-11-24T04:29:58.000Z
Qwen/Qwen-72B
1. YES
2. YES