'Returns the matrix form of the vector with respect to the given
frame.
Parameters
reference_frame : ReferenceFrame
The reference frame that the rows of the matrix correspond to.
Returns
matrix : ImmutableMatrix, shape(3,1)
The matrix that gives the 1D vector.
Examples
>>> from sympy import symbols
>>> from sympy.physics.vector import ReferenceFrame
>>> from sympy.physics.mechanics.functions import inertia
>>> a, b, c = symbols(\'a, b, c\')
>>> N = ReferenceFrame(\'N\')
>>> vector = a * N.x + b * N.y + c * N.z
>>> vector.to_matrix(N)
Matrix([
[a],
[b],
[c]])
>>> beta = symbols(\'beta\')
>>> A = N.orientnew(\'A\', \'Axis\', (beta, N.x))
>>> vector.to_matrix(A)
Matrix([
[                         a],
[ b*cos(beta) + c*sin(beta)],
[-b*sin(beta) + c*cos(beta)]])'

def to_matrix(self, reference_frame):

    return Matrix([self.dot(unit_vec) for unit_vec in reference_frame]).reshape(3, 1)
