### Instruction: A line is parameterized by
\[\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 0 \\ -2 \end{pmatrix} + t \begin{pmatrix} 3 \\ 4 \end{pmatrix}.\]A second line is parameterized by
\[\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} -8 \\ 12 \end{pmatrix} + u \begin{pmatrix} 1 \\ 3 \end{pmatrix}.\]If $\theta$ is the acute angle formed by the two lines, then find $\cos \theta.$ Please respond by writing a program in Python.### Response: import numpy as np

# define the direction vectors for the two lines
v1 = np.array([3, 4])
v2 = np.array([1, 3])

# calculate the dot product of the two vectors
dot_product = np.dot(v1, v2)

# calculate the magnitudes of the two vectors
mag_v1 = np.linalg.norm(v1)
mag_v2 = np.linalg.norm(v2)

# calculate the cosine of the angle between the two vectors
cos_theta = dot_product / (mag_v1 * mag_v2)

print(cos_theta)