You are not logged in.

- Topics: Active | Unanswered

**evinda****Member**- Registered: 2013-04-13
- Posts: 105

bobbym wrote:

So you see .3333 is not 1 / 3. When you did a calculation with it the error was magnified until it has a difference of 30.

I understand..And how can I explain why my result is Nan??

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 103,726

Because with that condition number you would need to have

.333333333333333333333333333333333333333333333333333333333333333333333\

3333333333333333333333333333333333333333333333333333333333333333333333\

3333333333333333333333333333333333333333333333333333333333333333333333\

3333333333333333333333333333333333333333333333333333333333333333333333\

3333333333333333333333333333333333333333333333333333333333333333333333\

333333333333333333333333333333333333333333333333333

for 1 / 3 and you only have .3333 or maybe .3333333333333333

The NAN might mean for all intents and purposes Matlab thinks that matrix is singular.

In math there is singular and non singular. In computation there is a third state, nearly singular. The Hilbert Matrix is one of those.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

**evinda****Member**- Registered: 2013-04-13
- Posts: 105

Is it like division by 0???Or not???

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 103,726

Probably came down to dividing by some very small number which Matlab interpreted as 0. That is only one possibility.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

**evinda****Member**- Registered: 2013-04-13
- Posts: 105

Could you explain what a nearly singular matrix is??

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 103,726

One with a very high condition number or one with the determinant being nearly 0.

You are not using Matlab well enough, read up on these suggestions:

The Symbolic Toolbox and its vpa (variable precision arithmetic) commands if you want to accurately work with a large Hilbert Matrix.

There is also the bicgstab command.

If you can not get any of these to work then give me the column vector b and I will solve the system using the tools I have.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

**evinda****Member**- Registered: 2013-04-13
- Posts: 105

bobbym wrote:

One with a very high condition number or one with the determinant being nearly 0.

You are not using Matlab well enough, read up on these suggestions:

The Symbolic Toolbox and its vpa (variable precision arithmetic) commands if you want to accurately work with a large Hilbert Matrix.

There is also the bicgstab command.

If you can not get any of these to work then give me the column vector b and I will solve the system using the tools I have.

Now,I wanted to calculate the determinant and the result is: det(H)=0..

So,you mean,that I should write it for example like that: vpa(hilb(n))? Or with an other way?? :/

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 103,726

I do not program in Matlab so you will have to consult the help.

Just what I said Matlab is interpreting a nearly singular matrix for a singular matrix.

Unless you can access the higher precision routines that Matlab has ( and they are pretty skimpy ) a big Hilbert will be out.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

**evinda****Member**- Registered: 2013-04-13
- Posts: 105

bobbym wrote:

I do not program in Matlab so you will have to consult the help.

Just what I said Matlab is interpreting a nearly singular matrix for a singular matrix.

Unless you can access the higher precision routines that Matlab has ( and they are pretty skimpy ) a big Hilbert will be out.

I haven't found yet such a routine of Matlab..

And something else...Why when I find the error ||x_{k}-D|| of the last iteration of the methods,for n>=250,at the Jacobi method I get the result Nan and at the Gauss-Seidel method I get a real number???

(D is the exact result of the linear system)

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 103,726

Neither method will return a reliable answer.

bobbym wrote:

If you can not get any of these to work then give me the column vector b and I will solve the system using the tools I have.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

**evinda****Member**- Registered: 2013-04-13
- Posts: 105

Why??Because of the fact that the Hilbert Matrix is very ill-conditioned??

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 103,726

Yes, it would require you to work to 400 digits of precision to get an answer that had 20 correct digits. If you can not work to that many digits the answers obtained will be meaningless.

If you supply the b, I can do the calculations for you.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

**evinda****Member**- Registered: 2013-04-13
- Posts: 105

bobbym wrote:

Yes, it would require you to work to 400 digits of precision to get an answer that had 20 correct digits. If you can not work to that many digits the answers obtained will be meaningless.

If you supply the b, I can do the calculations for you.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 103,726

Hi evinda;

You do not have the b vector to copy and paste? I am not seeing how to use that sum?!

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

**evinda****Member**- Registered: 2013-04-13
- Posts: 105

bobbym wrote:

Hi evinda;

You do not have the b vector to copy and paste? I am not seeing how to use that sum?!

You want to know how I wrote it in my code??

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 103,726

Yes, let me see how you did it.

I have to go offline now for a bit, see you then.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline