<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 contimech 
Step1:  tr(vec)
Provides the trace of a second order tensor written as a vector v in the SMART+ formalism. Return a double. Example
Step2:  dev(vec)
Provides the deviatoric part of a second order tensor written as a vector v in the SMART+ formalism. Return a vec. Example
Step3:  Mises_stress(vec)
Provides the Von Mises stress $\sigma^{Mises}$ of a second order stress tensor written as a vector v in the SMART+ formalism. Return a double.
Step4:  Mises_strain(vec)
Provides the Von Mises strain $\varepsilon^{Mises}$ of a second order stress tensor written as a vector v in the SMART+ formalism. Return a double.
Step5:  eta_stress(vec)
Provides the stress flow
Step6:  eta_strain(vec)
Provides the strain flow 
$$\eta_{strain}=\frac{2/3\varepsilon_{dev}}{\varepsilon_{Mises}}$$
from a second order strain tensor written as a vector v in the SMART+ formalism (i.e. the shear terms are multiplied by 2, providing shear angles). Return a vec.
Step7:  v2t_stress(vec)
Converts a second order stress tensor written as a vector v in the SMART+ formalism into a second order stress tensor written as a matrix m. Return a mat.
Step8:  t2v_stress(vec)
Converts a second order stress tensor written as a matrix m in the SMART+ formalism into a second order stress tensor written as a vector v. Return a vec.
Step9:  v2t_strain(vec)
Converts a second order strain tensor written as a vector v in the SMART+ formalism into a second order strain tensor written as a matrix m. Return a mat.
Step10:  t2v_strain(vec)
Converts a second order strain tensor written as a matrix m in the SMART+ formalism into a second order strain tensor written as a vector v. Return a vec.
Step11:  J2_stress(vec)
Provides the second invariant of a second order stress tensor written as a vector v in the SMART+ formalism. Return a double. 
$$ J_2 (\boldsymbol{\sigma}) = \frac{1}{2} \sigma_{ij} \sigma_{ij} $$
Step12:  J2_strain(vec)
Provides the second invariant of a second order strain tensor written as a vector v in the SMART+ formalism. Return a vec. 
$$ J_2 (\boldsymbol{\varepsilon}) = \frac{1}{2} \varepsilon_{ij} \varepsilon_{ij} $$
Step13:  J3_stress(vec)
Provides the third invariant of a second order stress tensor written as a vector v in the SMART+ formalism. Return a double. 
$$ J_3 (\boldsymbol{\sigma}) = \frac{1}{2} \sigma_{ij} \sigma_{jk} \sigma_{ki} $$
Step14:  J3_strain(vec)
Provides the third invariant of a second order strain tensor written as a vector v in the SMART+ formalism. Return a vec. 
$$ J_3 (\boldsymbol{\varepsilon}) = \frac{1}{2} \varepsilon_{ij} \varepsilon_{jk} \varepsilon_{ki} $$
<ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from simmit import smartplus as sim
import os
Explanation: contimech : tools and functions useful in Continuum Mechanics
End of explanation
v = np.random.rand(6)
trace = sim.tr(v)
print v
print trace
Explanation: tr(vec)
Provides the trace of a second order tensor written as a vector v in the SMART+ formalism. Return a double. Example:
End of explanation
v = np.random.rand(6)
v_dev = sim.dev(v)
print v
print v_dev
Explanation: dev(vec)
Provides the deviatoric part of a second order tensor written as a vector v in the SMART+ formalism. Return a vec. Example:
End of explanation
v = np.random.rand(6)
Mises_sig = sim.Mises_stress(v)
print v
print Mises_sig
Explanation: Mises_stress(vec)
Provides the Von Mises stress $\sigma^{Mises}$ of a second order stress tensor written as a vector v in the SMART+ formalism. Return a double.
End of explanation
v = np.random.rand(6)
Mises_eps = sim.Mises_strain(v)
print v
print Mises_eps
Explanation: Mises_strain(vec)
Provides the Von Mises strain $\varepsilon^{Mises}$ of a second order stress tensor written as a vector v in the SMART+ formalism. Return a double.
End of explanation
v = np.random.rand(6)
sigma_f = sim.eta_stress(v)
print v
print sigma_f
Explanation: eta_stress(vec)
Provides the stress flow:
$$\eta_{stress}=\frac{3/2\sigma_{dev}}{\sigma_{Mises}}$$
from a second order stress tensor written as a vector v in the SMART+ formalism (i.e. the shear terms are multiplied by 2, providing shear angles). Return a vec.
End of explanation
v = np.random.rand(6)
eps_f = sim.eta_strain(v)
print v
print eps_f
Explanation: eta_strain(vec)
Provides the strain flow 
$$\eta_{strain}=\frac{2/3\varepsilon_{dev}}{\varepsilon_{Mises}}$$
from a second order strain tensor written as a vector v in the SMART+ formalism (i.e. the shear terms are multiplied by 2, providing shear angles). Return a vec.
End of explanation
v = np.random.rand(6)
m = sim.v2t_stress(v);
print v
print m
Explanation: v2t_stress(vec)
Converts a second order stress tensor written as a vector v in the SMART+ formalism into a second order stress tensor written as a matrix m. Return a mat.
End of explanation
m = np.random.rand(3,3)
m_symm = (m + m.T)/2
v = sim.t2v_stress(m_symm);
print m_symm
print v
Explanation: t2v_stress(vec)
Converts a second order stress tensor written as a matrix m in the SMART+ formalism into a second order stress tensor written as a vector v. Return a vec.
End of explanation
v = np.random.rand(6)
m = sim.v2t_strain(v);
print v
print m
Explanation: v2t_strain(vec)
Converts a second order strain tensor written as a vector v in the SMART+ formalism into a second order strain tensor written as a matrix m. Return a mat.
End of explanation
m = np.random.rand(3,3)
m_symm = (m + m.T)/2
v = sim.t2v_strain(m_symm);
print m_symm
print v
Explanation: t2v_strain(vec)
Converts a second order strain tensor written as a matrix m in the SMART+ formalism into a second order strain tensor written as a vector v. Return a vec.
End of explanation
v = np.random.rand(6)
J2 = sim.J2_stress(v)
print v
print J2
Explanation: J2_stress(vec)
Provides the second invariant of a second order stress tensor written as a vector v in the SMART+ formalism. Return a double. 
$$ J_2 (\boldsymbol{\sigma}) = \frac{1}{2} \sigma_{ij} \sigma_{ij} $$
End of explanation
v = np.random.rand(6)
J2 = sim.J2_strain(v)
print v
print J2
Explanation: J2_strain(vec)
Provides the second invariant of a second order strain tensor written as a vector v in the SMART+ formalism. Return a vec. 
$$ J_2 (\boldsymbol{\varepsilon}) = \frac{1}{2} \varepsilon_{ij} \varepsilon_{ij} $$
End of explanation
v = np.random.rand(6)
J3 = sim.J3_stress(v)
print v
print J3
Explanation: J3_stress(vec)
Provides the third invariant of a second order stress tensor written as a vector v in the SMART+ formalism. Return a double. 
$$ J_3 (\boldsymbol{\sigma}) = \frac{1}{2} \sigma_{ij} \sigma_{jk} \sigma_{ki} $$
End of explanation
v = np.random.rand(6)
J3 = sim.J3_strain(v)
print v
print J3
Explanation: J3_strain(vec)
Provides the third invariant of a second order strain tensor written as a vector v in the SMART+ formalism. Return a vec. 
$$ J_3 (\boldsymbol{\varepsilon}) = \frac{1}{2} \varepsilon_{ij} \varepsilon_{jk} \varepsilon_{ki} $$
End of explanation
<END_TASK>