Esempio n. 1
0
 def _eval_evalf(self, prec):
     if not self.args:
         return self
     new_args = []
     for mat, frame in self.args:
         new_args.append([mat.evalf(n=prec_to_dps(prec)), frame])
     return Vector(new_args)
Esempio n. 2
0
    def _eval_evalf(self, prec=15, **options):
        """Evaluate the coordinates of the point.

        This method will, where possible, create and return a new Point
        where the coordinates are evaluated as floating point numbers to
        the precision indicated (default=15).

        Parameters
        ==========

        prec : int

        Returns
        =======

        point : Point

        Examples
        ========

        >>> from sympy import Point, Rational
        >>> p1 = Point(Rational(1, 2), Rational(3, 2))
        >>> p1
        Point2D(1/2, 3/2)
        >>> p1.evalf()
        Point2D(0.5, 1.5)

        """
        coords = [x.evalf(n=prec_to_dps(prec), **options) for x in self.args]
        return Point(*coords, evaluate=False)
Esempio n. 3
0
    def _eval_evalf(self, prec):
        """Returns the floating point approximations (decimal numbers) of the quaternion.

        Returns
        =======

        Quaternion
            Floating point approximations of quaternion(self)

        Examples
        ========

        >>> from sympy.algebras.quaternion import Quaternion
        >>> from sympy import sqrt
        >>> q = Quaternion(1/sqrt(1), 1/sqrt(2), 1/sqrt(3), 1/sqrt(4))
        >>> q.evalf()
        1.00000000000000
        + 0.707106781186547*i
        + 0.577350269189626*j
        + 0.500000000000000*k

        """

        return Quaternion(
            *[arg.evalf(n=prec_to_dps(prec)) for arg in self.args])
Esempio n. 4
0
 def _eval_evalf(self, prec):
     if not self.args:
         return self
     new_args = []
     for inlist in self.args:
         new_inlist = list(inlist)
         new_inlist[0] = inlist[0].evalf(n=prec_to_dps(prec))
         new_args.append(tuple(new_inlist))
     return Dyadic(new_args)
Esempio n. 5
0
 def _eval_evalf(self, prec=15, **options):
     f, (t, a, b) = self.args
     dps = prec_to_dps(prec)
     f = tuple([i.evalf(n=dps, **options) for i in f])
     a, b = [i.evalf(n=dps, **options) for i in (a, b)]
     return self.func(f, (t, a, b))
Esempio n. 6
0
 def _eval_evalf(self, prec=15, **options):
     pt, tup = self.args
     dps = prec_to_dps(prec)
     pt = pt.evalf(n=dps, **options)
     tup = tuple([i.evalf(n=dps, **options) for i in tup])
     return self.func(pt, normal_vector=tup, evaluate=False)