MathGroup Archive 1993

[Date Index] [Thread Index] [Author Index]

Search the Archive

Real vs. Integer paradox

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: Real vs. Integer paradox
  • From: llefton at matcomlab.math.uno.edu
  • Date: Wed, 3 Mar 93 15:45:26 CST

Hello, 

In computing the NullSpace of a matrix with Mathematica, there seems  
to be a significantly different algorithm used depending on whether  
the matirx has real or symbolic (e.g. integer) entries.  Here's an  
example:


Mathematica 2.0 for NeXT
Copyright 1988-91 Wolfram Research, Inc.
 -- NeXT graphics initialized -- 


In[1]:= $Version

Out[1]= NeXT 2.0 (July 15, 1991)

In[2]:= A=Table[Random[Integer,5], {2}, {4}]

Out[2]= {{2, 4, 1, 4}, {1, 3, 2, 1}}

In[3]:= NullSpace[A]

                         5    3
Out[3]= {{-4, 1, 0, 1}, {-, -(-), 1, 0}}
                         2    2

We check that these are indeed null vectors:

In[4]:= A. Transpose[NullSpace[A]]

Out[4]= {{0, 0}, {0, 0}}

Great.  But now suppose we have floating point values

In[5]:= Ar = N[A]

Out[5]= {{2., 4., 1., 4.}, {1., 3., 2., 1.}}

In[6]:= NullSpace[Ar]

Out[6]= {{-0.943569, 0.211961, 0.0273498, 0.252986}, 

 

>    {0., -0.59588, 0.681005, 0.425628}}

Whoa! Let's see if these are correct.

In[7]:= Chop[Ar.Transpose[NullSpace[Ar]]]

Out[7]= {{0, 0}, {0, 0}}

Yes they are, but why are they so different?
Any help or explanation would be appreciated.

 ----------------------------------------------------------------
| Lew Lefton                 | Phone:     (504) 286-7441         |
| Department of Mathematics  | FAX:       (504) 286-5516         |
| University of New Orleans  | e-mail:    llefton at math.uno.edu   |
| New Orleans, LA  70148     |             (NeXT mail welcome)   |
 ----------------------------------------------------------------





  • Prev by Date: Misbehavior of Conjugate[Exp[I x]]
  • Next by Date: RE: curve-fitting
  • Previous by thread: Misbehavior of Conjugate[Exp[I x]]
  • Next by thread: RE: Real vs. Integer paradox