(ctx, *args, **kwargs)
return y
``linspace(a, b, n)`` returns a list of `n` evenly spaced
        samples from `a` to `b`. The syntax ``linspace(mpi(a,b), n)``
        is also valid.

        This function is often more convenient than :func:`~mpmath.arange`
        for partitioning an interval into subintervals, since
        the endpoint is included::

            >>> from sympy.mpmath import *
            >>> mp.dps = 15; mp.pretty = False
            >>> linspace(1, 4, 4)
            [mpf('1.0'), mpf('2.0'), mpf('3.0'), mpf('4.0')]

        You may also provide the keyword argument ``endpoint=False``::

            >>> linspace(1, 4, 4, endpoint=False)
            [mpf('1.0'), mpf('1.75'), mpf('2.5'), mpf('3.25')]
``linspace(a, b, n)`` returns a list of `n` evenly spaced
        samples from `a` to `b`. The syntax ``linspace(mpi(a,b), n)``
        is also valid.
linspace ( a b n ) returns a list of n evenly spaced samples from a to b . The syntax linspace ( mpi ( a b ) n ) is also valid .
def linspace(ctx, *args, **kwargs):
        """
        ``linspace(a, b, n)`` returns a list of `n` evenly spaced
        samples from `a` to `b`. The syntax ``linspace(mpi(a,b), n)``
        is also valid.

        This function is often more convenient than :func:`~mpmath.arange`
        for partitioning an interval into subintervals, since
        the endpoint is included::

            >>> from sympy.mpmath import *
            >>> mp.dps = 15; mp.pretty = False
            >>> linspace(1, 4, 4)
            [mpf('1.0'), mpf('2.0'), mpf('3.0'), mpf('4.0')]

        You may also provide the keyword argument ``endpoint=False``::

            >>> linspace(1, 4, 4, endpoint=False)
            [mpf('1.0'), mpf('1.75'), mpf('2.5'), mpf('3.25')]

        """
        if len(args) == 3:
            a = ctx.mpf(args[0])
            b = ctx.mpf(args[1])
            n = int(args[2])
        elif len(args) == 2:
            assert hasattr(args[0], '_mpi_')
            a = args[0].a
            b = args[0].b
            n = int(args[1])
        else:
            raise TypeError('linspace expected 2 or 3 arguments, got %i' \
                            % len(args))
        if n < 1:
            raise ValueError('n must be greater than 0')
        if not 'endpoint' in kwargs or kwargs['endpoint']:
            if n == 1:
                return [ctx.mpf(a)]
            step = (b - a) / ctx.mpf(n - 1)
            y = [i*step + a for i in xrange(n)]
            y[-1] = b
        else:
            step = (b - a) / ctx.mpf(n)
            y = [i*step + a for i in xrange(n)]
        return y
def linspace ( ctx , * args , * * kwargs ) : if len ( args ) == 3 : a = ctx . mpf ( args [ 0 ] ) b = ctx . mpf ( args [ 1 ] ) n = int ( args [ 2 ] ) elif len ( args ) == 2 : assert hasattr ( args [ 0 ] , '_mpi_' ) a = args [ 0 ] . a b = args [ 0 ] . b n = int ( args [ 1 ] ) else : raise TypeError ( 'linspace expected 2 or 3 arguments, got %i' % len ( args ) ) if n < 1 : raise ValueError ( 'n must be greater than 0' ) if not 'endpoint' in kwargs or kwargs [ 'endpoint' ] : if n == 1 : return [ ctx . mpf ( a ) ] step = ( b - a ) / ctx . mpf ( n - 1 ) y = [ i * step + a for i in xrange ( n ) ] y [ - 1 ] = b else : step = ( b - a ) / ctx . mpf ( n ) y = [ i * step + a for i in xrange ( n ) ] return y