Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#26 2013-11-30 04:23:41

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

Re: What have I done wrong??

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?? hmm

Offline

#27 2013-11-30 04:28:12

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What have I done wrong??

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.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#28 2013-11-30 05:08:28

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

Re: What have I done wrong??

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

Offline

#29 2013-11-30 05:14:24

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What have I done wrong??

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.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#30 2013-11-30 05:43:29

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

Re: What have I done wrong??

Could you explain what a nearly singular matrix is??  hmm

Offline

#31 2013-11-30 05:47:07

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What have I done wrong??

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.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#32 2013-11-30 07:24:08

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

Re: What have I done wrong??

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.. eek

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

Offline

#33 2013-11-30 12:39:49

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What have I done wrong??

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.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#34 2013-11-30 23:25:48

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

Re: What have I done wrong??

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.. hmm
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

#35 2013-12-01 00:14:47

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What have I done wrong??

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.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#36 2013-12-01 00:28:25

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

Re: What have I done wrong??

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

Offline

#37 2013-12-01 00:34:07

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What have I done wrong??

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.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#38 2013-12-01 01:13:41

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

Re: What have I done wrong??

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

#39 2013-12-01 01:25:44

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What have I done wrong??

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.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#40 2013-12-01 01:51:34

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

Re: What have I done wrong??

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

#41 2013-12-01 01:55:26

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What have I done wrong??

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.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

Board footer

Powered by FluxBB