```python
from sympy import *
init_printing(use_unicode=True)
from sympy.codegen.ast import Assignment
```


```python
m, n = symbols('m n')
x = symbols('x')
theta = Symbol("theta")
```


```python
m = cos(theta)
n = sin(theta)
```

# Definition of rotation matrix $A$


```python
A = Matrix([[m**2, n**2, 2*m*n], [n**2, m**2, -2*m*n], [-m*n, m*n,m**2-n**2]])
At = simplify(A.inv())

At, simplify(A)
# The inverse of the rotation matrix in voigt notation is not the transpose
```


```python
simplify(A)
```


```python
simplify(A.subs(theta,pi/4))
```

# Definition of the Reuter Matrix $R$


```python
R = Matrix([[1, 0, 0], [0, 1, 0], [0, 0,2]])
Rt = Matrix([[1, 0, 0], [0, 1, 0], [0, 0,0.5]])
R
```

# transversely isotropic stiffness tensor $C$

$C' = A^{-1}CRAR^{-1}$


```python
C = Matrix( symarray('C', (3,3)) )
C
```


```python
C[2,0] = 0
C[2,1] = 0
C[0,2] = 0
C[1,2] = 0
C
```


```python
CTrue = simplify(At*C*R*A*Rt)
CTrue
```


```python
CTrue[2,2]
```


```python
CPrime = simplify(At*C*A)
CPrime[2,2]
```


```python
print(ccode(Assignment(x,CTrue[2,2])))
```

    x = C_2_2*pow(cos(2*theta), 2) + 0.125*(1 - cos(4*theta))*(C_0_0 - C_1_0) + 0.125*(1 - cos(4*theta))*(-C_0_1 + C_1_1);



```python
CTrue[2,2].subs(theta,0)
```


```python
simplify(CTrue[2,2].subs(theta,pi/2))
```


```python
simplify(CTrue[2,2].subs(theta,pi/4))
```


```python
(R*A*Rt).subs(theta,0)
```


```python
C
```


```python
A
```


```python
R*A*Rt
```


```python
CTrue.subs(theta,pi/2)
```


```python
v1 = Matrix([1,2,3])
v1
```


```python
C[0,0] = 1
C[1,1] = 3
C[0,1] = 2
C[1,0] = 2
```

75988d255094693f420ce83daaa6ca420ee69b72
ipynb
Jupyter Notebook
PythonCodes/Utilities/Sympy/.ipynb_checkpoints/StiffnessRotNPMblending-checkpoint.ipynb
Nicolucas/C-Scripts
2608df5c2e635ad16f422877ff440af69f98f960
MIT
2020-02-25T08:05:13.000Z
2020-02-25T08:05:13.000Z
PythonCodes/Utilities/Sympy/.ipynb_checkpoints/StiffnessRotNPMblending-checkpoint.ipynb
Nicolucas/C-Scripts
2608df5c2e635ad16f422877ff440af69f98f960
MIT
PythonCodes/Utilities/Sympy/.ipynb_checkpoints/StiffnessRotNPMblending-checkpoint.ipynb
Nicolucas/C-Scripts
2608df5c2e635ad16f422877ff440af69f98f960
MIT
Qwen/Qwen-72B
1. YES
2. YES