Here's an example.
A=matrix(RDF,2,2,[1/2,-1/2,-1/2,1/2])
A.SVD()
<result>
(
[-0.707106781187 0.707106781187]
[ 0.707106781187 0.707106781187],
[ 1.0 0.0]
[ 0.0 7.85046229342e-17],
[-0.707106781187 0.707106781187]
[ 0.707106781187 0.707106781187]
)
The exact solution is -1/sqrt(2),1/sqrt(2), 1/sqrt(2), 1/sqrt(2)
and D=(1, 0),(0, 0)
Something like this... http://www.wolframalpha.com/input/?i=SVD+%7B%7B1%2F2%2C+-1%2F2%7D%2C%7B-1%2F2%2C+1%2F2%7D%7D
Is there a way to get the exact solution?
One more question...
Why doesn't the next code work?
A=matrix(RR,2,2,[1/2,-1/2,-1/2,1/2])
A.SVD()