[SciPy-user] small error problem

Ryan Krauss ryanlists at gmail.com
Sat Oct 29 14:22:06 EDT 2005


My version:
In [3]: scipy.__version__
Out[3]: '0.3.3_309.4626'

In both places, I get:
(Pdb) type(mat)
Out[2]: <type 'array (scipy)'>

Any other info I can provide?

Ryan

On 10/29/05, Travis Oliphant <oliphant at ee.byu.edu> wrote:
> Ryan Krauss wrote:
>
> >I have a script that uses row reduction to mind the null space of a
> >matrix.  I am experiencing some strange behavior.  At the begining of
> >the script, I have a 2x2 matrix, but it is of rank 1.  (I realize that
> >find the null space of a 2x2 could be much simpler, but I will
> >generally have higher ranked matrices.  I have also found the
> >nullspace using svd, but have gotten the best results from rref in the
> >past.)
> >
> >
> which version of scipy are you using?
>
> >The fact that the matrix is rank one can be verified early in the
> >script.  Row 2 is a multiple of row 1:
> >(Pdb) mat[1,1]/mat[1,0]-mat[0,1]/mat[0,0]
> >Out[2]: NumPy array, format: long
> >0.0
> >(Pdb) '%0.30f'%(mat[1,1]/mat[1,0]-mat[0,1]/mat[0,0])
> >Out[2]: '0.000000000000000000000000000000'
> >
> >In order to do the row reduction, I append a column of zeros:
> >(Pdb) vect
> >Out[2]: NumPy array, format: long
> >[[ 0.,]
> > [ 0.,]]
> > 15  ->     mat=c_[mat,vect]
> >(Pdb) mat
> >Out[2]: NumPy array, format: long
> >[[ 1.50155914,-1.24770975,]
> > [-2.98977017, 2.48432803,]]
> >
> >But now there is some small error:
> >(Pdb) '%0.30f'%(mat[1,1]/mat[1,0]-mat[0,1]/mat[0,0])
> >Out[2]: '-0.000000013035565737951060327759'
> >(Pdb) mat[1,1]/mat[1,0]-mat[0,1]/mat[0,0]
> >Out[2]: -1.303556573795106e-08
> >
> >and the output is now a scalar instead of NumPy array, format: long
> >
> >
> I'm not sure what NumPy array, format: long means
>
> It does seem strange that the expression is different things in
> different places.
>
> Could you post more information.  What is the result of type(mat), for
> example.
>
> Thanks,
>
> -Travis
>
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
>




More information about the SciPy-User mailing list