```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.subs(theta,0))
```

# 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
gamma = symbols('\gamma')
C[2,0] = 0
C[2,1] = 0
C[0,2] = 0
C[1,2] = 0
C[1,1] = C[0,0]
C[1,0] = C[0,1]
C[2,2] = 0.5 *(C[0,0] - C[1,0])
#C[2,2] = gamma
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 = 0.5*C_0_0 - 0.5*C_0_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([4,5,6])
v1
```


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


```python
CTrue = simplify(At*C*R*A*Rt)
(CTrue*v1).subs(theta, pi/4)
```


```python
-9/2
```


```python
x, n, delta = symbols('x n \delta')

```


```python
Weight = (1 - 2*abs(x))
Weight
```


```python
plot(Weight, (x, -0.5, .5), ylim=[0,1])
```


```python
Weight = ((n+1.0)/(n-1.0))*(1.0 - n * (abs(2.0 * x))**( n - 1.0) + (n - 1.0) * (abs(2.0*x))**(n))
Weight
```


```python
plot(Weight.subs(n,100), (x, -0.5, .5),ylim=[0,2])
```


```python

```


```python

```


```python

```

0e0d9c06fdc66b83c326a7b5e35596ba5a3cc858
ipynb
Jupyter Notebook
PythonCodes/Utilities/Sympy/StiffnessRotNPMblending.ipynb
Nicolucas/TEAR
bbeb599cf2bab70fd7a82041336a1a918e8727f2
MIT
2020-02-25T08:05:13.000Z
2020-02-25T08:05:13.000Z
PythonCodes/Utilities/Sympy/StiffnessRotNPMblending.ipynb
Nicolucas/TEAR
bbeb599cf2bab70fd7a82041336a1a918e8727f2
MIT
PythonCodes/Utilities/Sympy/StiffnessRotNPMblending.ipynb
Nicolucas/TEAR
bbeb599cf2bab70fd7a82041336a1a918e8727f2
MIT
Qwen/Qwen-72B
1. YES
2. YES