Group Abstract Group Abstract

Message Boards Message Boards

Code for verification of reliable digits ?

Posted 9 years ago

the linear equation system $Ax=b$ has one approximation $\bar x$ and one exact $x^* \neq 0$ solutions. we also gives: $p>3, \|x^* - \bar x \| \leq 10^{-20} + \|A\| \|A^{-1}\| 10^{-p} \|x^*\| $ which $\|A\| \|A^{-1}\|=10^{4}$. The reliable digits of $\bar x$ for solutions of this system of equation is $0$.

this is the mathematica code for verification of the above example.

    hm = HilbertMatrix[4];
    sol = {1, 1, 1, 1};
    mat = Round[N[hm], 1.*^-4];
    bv = Round[N[hm.sol], 1.*^-4];
    s = LinearSolve[mat, bv];
    NumberForm[Norm[sol - s], 5]

The result is $0.6780$. I didn't understand what the meaning of this result. anyone could describe it the result of this code for me? (i.e what is the relation among this answer and the solved example ).

POSTED BY: Dr Muh Nikson
8 Replies
Posted 9 years ago

I got it, except your last statement "there are at most one digit or so correct." would you please wrote more simpler?

Thanks so much Teacher :)

POSTED BY: Dr Muh Nikson

The solution components all have size around 1. The norm of the error is also around 1. That gives some indication that there are at most one digit or so correct.

POSTED BY: Daniel Lichtblau
Posted 9 years ago

Wow now I think 85% fully understand, thanks so much. I love learning....

My two last question is:

1) which part of this code calculate the reliable digits? I want to try it on cloud.

2) There are no reliable digits? am I right? which part of your code show this?

Thanks again from your kind and advanced help.

POSTED BY: Dr Muh Nikson
Posted 9 years ago
POSTED BY: J. M.
Posted 9 years ago

Thanks so much, very nice.

We have one approximation solution:

Out[53]= {1.01850881228, 0.783151176337, 1.53552721482, 0.645697515412}

with this code:

In[54]:= diff = approxsol - sol

we get a vector with difference between the solution with approximation solution.

but I couldn't get this code:

In[55]:= Norm[diff]
POSTED BY: Dr Muh Nikson

Probably you are right about the purpose of that forced rounding.

POSTED BY: Daniel Lichtblau
Posted 9 years ago

"Numerically this is garbage anyway" - yes, that was the way of showing "the reliable digits... for solutions of this system of equation is 0". That was also why a matrix whose condition number is on the order of $10^4$ was chosen for that demo. (Otherwise, Norm[diff] should have been much tinier.)

(That is, assuming I had correctly divined the exercise's intent. But I really was hoping the kid had concluded for himself how far away the result from zero was.)

POSTED BY: J. M.
POSTED BY: Daniel Lichtblau
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard