Thread Subject: meeting a problem when solving linear equations

Subject: meeting a problem when solving linear equations

From: Ziwen

Date: 5 Jul, 2008 05:19:02

Message: 1 of 6

Hi, is there anyone who can give me some advices?

I met a problem when solving linear equations with the form
of A*X=0, in which A is a 675*675 matrix with a very high
cond(A)=9.5694e+016. Then it seems that I can not use those
standard methods and commands to solve this matrix.

>>size(A)
ans =
   675 675
>> rank(A)
ans =
   674
>> rank(rref(A))
ans =
   675
>> cond(A)
ans =
  9.5694e+016

When ever I used 'rref' or 'null' to deal with this matrix,
the rank of this matrix will change to 675.

Is there any method to solve this problem? Or is there any
other commands or methods that can be used to deal with
this problem perfectly?

thanks for anyone's help.

Subject: meeting a problem when solving linear equations

From: Greg Heath

Date: 5 Jul, 2008 06:31:56

Message: 2 of 6

On Jul 5, 1:19 am, "Ziwen " <yzwcr...@gmai.com> wrote:
> Hi, is there anyone who can give me some advices?
>
> I met a problem when solving linear equations with the form
> of A*X=0, in which A is a 675*675 matrix with a very high
> cond(A)=9.5694e+016. Then it seems that I can not use those
> standard methods and commands to solve this matrix.

...solve this equation.

> >>size(A)
>
> ans =
> 675 675
> >> rank(A)
>
> ans =
> 674
> >> rank(rref(A))
>
> ans =
> 675
> >> cond(A)
>
> ans =
> 9.5694e+016
>
> When ever I used 'rref' or 'null' to deal with this matrix,
> the rank of this matrix will change to 675.

eps
svd(A)
norm(A)
cond(A)
rank(A) % = 674
rank(A,0) % = 675

doc rank

> Is there any method to solve this problem? Or is there any
> other commands or methods that can be used to deal with
> this problem perfectly?
>
> thanks for anyone's help.

Why do you expect a computer to give you perfect answers
when it cannot perfectly represent floating point numbers
that are not integer powers of 2?

Since rank(A,0) = 675, A*X = 0 has no exact solution.

However, with cond(A) = 9.5694e+016, You can find a reasonable
approximation that minimizes norm(A*X)/norm(X) via

[E L] = eig(A)

Review the following

doc eps
doc svd
doc norm
doc cond
doc rank
doc eig

Hope this helps.

Greg

Subject: meeting a problem when solving linear equations

From: Ziwen

Date: 5 Jul, 2008 07:39:02

Message: 3 of 6

thanks for your reply. I really have a lot of things to
learn.

You mentioned 'Since rank(A,0) = 675, A*X = 0 has no exact
solution'. Here, I just got rank(A,8.6E4)=674 and rank
(A,8.5E4)=675. Then what should I do next? It seems there
is no parameter for null to change the tolerance, and rank
(rref(A,9E4) is still 675, while the result of rref(A,9E4)
is a identity matrix

In fact, the only thing I want is to get a rational X as
the numerical wavefunction.



Greg Heath <heath@alumni.brown.edu> wrote in message
<56856cbd-0f9f-47e2-9d72-
ea95cbd67114@b1g2000hsg.googlegroups.com>...
> On Jul 5, 1:19 am, "Ziwen " <yzwcr...@gmai.com> wrote:
> > Hi, is there anyone who can give me some advices?
> >
> > I met a problem when solving linear equations with the
form
> > of A*X=0, in which A is a 675*675 matrix with a very
high
> > cond(A)=9.5694e+016. Then it seems that I can not use
those
> > standard methods and commands to solve this matrix.
>
> ...solve this equation.
>
> > >>size(A)
> >
> > ans =
> > 675 675
> > >> rank(A)
> >
> > ans =
> > 674
> > >> rank(rref(A))
> >
> > ans =
> > 675
> > >> cond(A)
> >
> > ans =
> > 9.5694e+016
> >
> > When ever I used 'rref' or 'null' to deal with this
matrix,
> > the rank of this matrix will change to 675.
>
> eps
> svd(A)
> norm(A)
> cond(A)
> rank(A) % = 674
> rank(A,0) % = 675
>
> doc rank
>
> > Is there any method to solve this problem? Or is there
any
> > other commands or methods that can be used to deal with
> > this problem perfectly?
> >
> > thanks for anyone's help.
>
> Why do you expect a computer to give you perfect answers
> when it cannot perfectly represent floating point numbers
> that are not integer powers of 2?
>
> Since rank(A,0) = 675, A*X = 0 has no exact solution.
>
> However, with cond(A) = 9.5694e+016, You can find a
reasonable
> approximation that minimizes norm(A*X)/norm(X) via
>
> [E L] = eig(A)
>
> Review the following
>
> doc eps
> doc svd
> doc norm
> doc cond
> doc rank
> doc eig
>
> Hope this helps.
>
> Greg

Subject: meeting a problem when solving linear equations

From: Per Sundqvist

Date: 5 Jul, 2008 09:01:05

Message: 4 of 6

"Ziwen " <yzwcroco@gmai.com> wrote in message
<g4n8el$edn$1@fred.mathworks.com>...
> thanks for your reply. I really have a lot of things to
> learn.
>
> You mentioned 'Since rank(A,0) = 675, A*X = 0 has no exact
> solution'. Here, I just got rank(A,8.6E4)=674 and rank
> (A,8.5E4)=675. Then what should I do next? It seems there
> is no parameter for null to change the tolerance, and rank
> (rref(A,9E4) is still 675, while the result of rref(A,9E4)
> is a identity matrix
>
> In fact, the only thing I want is to get a rational X as
> the numerical wavefunction.
>
>
>
> Greg Heath <heath@alumni.brown.edu> wrote in message
> <56856cbd-0f9f-47e2-9d72-
> ea95cbd67114@b1g2000hsg.googlegroups.com>...
> > On Jul 5, 1:19 am, "Ziwen " <yzwcr...@gmai.com> wrote:
> > > Hi, is there anyone who can give me some advices?
> > >
> > > I met a problem when solving linear equations with the
> form
> > > of A*X=0, in which A is a 675*675 matrix with a very
> high
> > > cond(A)=9.5694e+016. Then it seems that I can not use
> those
> > > standard methods and commands to solve this matrix.
> >
> > ...solve this equation.
> >
> > > >>size(A)
> > >
> > > ans =
> > > 675 675
> > > >> rank(A)
> > >
> > > ans =
> > > 674
> > > >> rank(rref(A))
> > >
> > > ans =
> > > 675
> > > >> cond(A)
> > >
> > > ans =
> > > 9.5694e+016
> > >
> > > When ever I used 'rref' or 'null' to deal with this
> matrix,
> > > the rank of this matrix will change to 675.
> >
> > eps
> > svd(A)
> > norm(A)
> > cond(A)
> > rank(A) % = 674
> > rank(A,0) % = 675
> >
> > doc rank
> >
> > > Is there any method to solve this problem? Or is there
> any
> > > other commands or methods that can be used to deal with
> > > this problem perfectly?
> > >
> > > thanks for anyone's help.
> >
> > Why do you expect a computer to give you perfect answers
> > when it cannot perfectly represent floating point numbers
> > that are not integer powers of 2?
> >
> > Since rank(A,0) = 675, A*X = 0 has no exact solution.
> >
> > However, with cond(A) = 9.5694e+016, You can find a
> reasonable
> > approximation that minimizes norm(A*X)/norm(X) via
> >
> > [E L] = eig(A)
> >
> > Review the following
> >
> > doc eps
> > doc svd
> > doc norm
> > doc cond
> > doc rank
> > doc eig
> >
> > Hope this helps.
> >
> > Greg
>

Hey, You are trying to solve an eigen value problem. Your
wave equation is probably of the type: H*f=lam*f, where H is
a differential operator, isn't it? AX=0,has the trivial
solution X=0.

You should use:
[V,D]=eig(A);
[lam,ix]=sort(diag(D));
V=V(:,ix);%sort eigen vectors to match lam
n=1; %first eigen value
lambda=lam(n)
X=V(:,n)



where you have not taken A=H-I*lam, but only H, because you
don't know the eigen value lam before you have solved the
full problem! That could be the reason why you get a weird
rank, because you put in a wrong eigen value.

Subject: meeting a problem when solving linear equations

From: Ziwen

Date: 5 Jul, 2008 11:45:03

Message: 5 of 6

Per Sundqvist, thanks so much for your patience and your
detailed reply. I'm really sorry that I totally ignored the
help information of 'eig', which can solve all the
problems.


Subject: meeting a problem when solving linear equations

From: Greg Heath

Date: 5 Jul, 2008 20:27:46

Message: 6 of 6

On Jul 5, 3:39 am, "Ziwen " <yzwcr...@gmai.com> wrote:
> thanks for your reply. I really have a lot of things to
> learn.
>
> You mentioned 'Since rank(A,0) = 675, A*X = 0 has no exact
> solution'. Here, I just got rank(A,8.6E4)=674 and rank
> (A,8.5E4)=675. Then what should I do next? It seems there
> is no parameter for null to change the tolerance, and rank
> (rref(A,9E4) is still 675, while the result of rref(A,9E4)
> is a identity matrix
>
> In fact, the only thing I want is to get a rational X as
> the numerical wavefunction.

Let me repeat:

"However, with cond(A) = 9.5694e+016, You can find a
reasonable approximation that minimizes
norm(A*X)/norm(X) via

 [E L] = eig(A)"

i.e., the eigenvector corresponding to the
minimum eigenvalue.

Hope this helps.

Greg

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com