'Returns a dictionary which expresses the coordinate variables
(base scalars) of this frame in terms of the variables of
otherframe.
Parameters
otherframe : CoordSys3D
The other system to map the variables to.
Examples
>>> from sympy.vector import CoordSys3D
>>> from sympy import Symbol
>>> A = CoordSys3D(\'A\')
>>> q = Symbol(\'q\')
>>> B = A.orient_new_axis(\'B\', q, A.k)
>>> A.scalar_map(B)
{A.x: -sin(q)*B.y + cos(q)*B.x, A.y: sin(q)*B.x + cos(q)*B.y, A.z: B.z}'

def scalar_map(self, other):

    relocated_scalars = []
    origin_coords = tuple(self.position_wrt(other).to_matrix(other))
    for (i, x) in enumerate(other.base_scalars()):
        relocated_scalars.append((x - origin_coords[i]))
    vars_matrix = (self.rotation_matrix(other) * Matrix(relocated_scalars))
    mapping = {}
    for (i, x) in enumerate(self.base_scalars()):
        mapping[x] = trigsimp(vars_matrix[i])
    return mapping
