On Jan 27, 2008 6:50 PM, Peter <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> It seems the __abs__ method for vectors is missing the part that is
> supposed to square the components before they are added.
>
> [e.g. abs(vector([1..5])) should really be
> sqrt(1+4+9+16+25)=sqrt(55) ]
>
> The code of the current version is included below.
>
>     def __abs__(self):
>         """
>         Return the square root of the sum of the squares of the
> entries of this vector.
>
>         EXAMPLES:
>             sage: v = vector([1..5]); abs(v)
>             sqrt(15)
>             sage: v = vector(RDF, [1..5]); abs(v)
>             3.87298334621
>         """
>         return sum(self.list()).sqrt()
>
> The last line should be something like
>
>         return sum([x*x for x in self.list()]).sqrt()
>
> (not sure if that is the most efficient way).

Thanks for tracking this down.  I've made it trac #1955
   http://trac.sagemath.org/sage_trac/ticket/1955
and declared it a blocker, since obviously it will give
terribly wrong mathematical results.

William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to