How about this (edit if vector/point.py):

def _pdict_lists(self, other, num):
    """Creates a list of lists from self to other using _pos_dict. """
    outlist = [[self]]
    oldlist = [[]]
    while outlist != oldlist:
        oldlist = outlist[:]
        for i, v in enumerate(outlist):
            templist = v[-1]._pdlist[num].keys()
            for i2, v2 in enumerate(templist):
                if not v.__contains__(v2):
                    littletemplist = v + [v2]
                    if not outlist.__contains__(littletemplist):
                        outlist.append(littletemplist)
    for i, v in enumerate(oldlist):
        if v[-1] != other:
            outlist.remove(v)
    outlist.sort(key=len)
    if len(outlist) != 0:
        return outlist
    raise ValueError('No Connecting Path found between ' + other.name +
                     ' and ' + self.name)

def _pdict_list(self, other, num):
    """Creates a list from self to other using _pos_dict. """
    return self._pdict_lists(other, num)[0]

def pos_from(self, otherpoint, singleframe=False, frame=None, variables=False):
    """Returns a Vector distance between this Point and the other Point.

    Parameters
    ==========

    otherpoint : Point
        The otherpoint we are locating this one relative to
    singleframe : boolean
        Expresses the resulting vector in a single frame
    frame : ReferenceFrame
        Expresses the resulting vector in this frame
    variables : boolean
        If True, the coordinate symbols(if present) in the resulting Vector
        are re-expressed in terms the resulting frame (if singleframe is True
        or frame is given)

    Examples
    ========

    >>> from sympy.physics.vector import Point, ReferenceFrame
    >>> N = ReferenceFrame('N')
    >>> p1 = Point('p1')
    >>> p2 = Point('p2')
    >>> p1.set_pos(p2, 10 * N.x)
    >>> p1.pos_from(p2)
    10*N.x

    """
    if frame is not None:
        _check_frame(frame)

    last_error = None

    plists = self._pdict_lists(otherpoint, 0)

    for plist in plists:
        outvec = Vector(0)
        for i in range(len(plist) - 1):
            outvec += plist[i]._pos_dict[plist[i + 1]]

        # 0 Vector
        if len(outvec.args) == 0:
            return outvec

        try:
            if frame is not None:
                # Express in the given frame
                outvec = outvec.express(frame, variables=variables)
            elif singleframe:
                # Express in a single frame
                outvec = outvec.express(outvec.args[0][1], variables=variables)
            return outvec

        except ValueError as e:
            last_error = e
            continue

    raise last_error



-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/24c366d0-6386-4603-abe3-47a74be36a32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to