MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: precisions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg56025] Re: precisions
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Wed, 13 Apr 2005 01:11:14 -0400 (EDT)
  • Organization: The University of Western Australia
  • References: <d3g92l$t1u$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <d3g92l$t1u$1 at smc.vnet.net>,
 "Tun Myint Aung" <TMA at nus.edu.sg> wrote:

>     I am doing a calculation involving eigenvalues and eigenvectors for
> structural mechanics. I encountered with difficulties in numerical
> calculation which is very sensitive to precisions of numerical numbers.
> I used "SetPrecision[inputdata,100] for my input data. 

This does _not_ make the inputdata high precision. You need to assign 
the result back to inputdata:

  inputdata = SetPrecision[inputdata,100]

And this is probably not what you want to do anyway. See what happens 
when you apply SetPrecision to a number:

  SetPrecision[0.1, 20]
  0.10000000000000000555111512312578270212`20

Note that, as the documentation says, SetPrecision will first expose any 
hidden extra digits in the internal binary representation of a number, 
and only after these are exhausted add trailing zeros. 

> But after I got eigenvalues and eigenvectors, these numbers are 
> "MachinePrecision". 

Also, note that if you multiply a high precision expression by, say, 1.0 
(a MachinePrecision number) then all quantities are coerced to 
MachinePrecision.

Here is a trivial 2 x 2 example:

  mat = {{0.1, 0.2}, {0.11, 0.21}};

  Eigenvalues[mat]
  {0.3131929201955638, -0.00319292019556372}

Using SetPrecision.

  highprec = SetPrecision[mat, 20];

 Eigenvalues[highprec]

 { 0.3131929201955637465002112916455935305`20,   
  -0.00319292019556374872065734089590661134`20}

> I tried to change the precision in "Eigenvalues", but there are no options
> for that. How can I set the precision for the whole notebook?

This is not the correct approach. For sensitivity analysis here are two 
suggestions:

[1] you could introduce symbolic parameters. For example, 

  f[x_] = mat + {{0, 0}, {0, x}}

and then compute Eigenvalues[f[x]].

[2] use Interval arithmetic instead.

  new = mat + 10^(-5) Interval[{-1,1}]

and then compute Eigenvalues[new]. Note that you can also compute 
Eigenvector[] and Inverse[] for matrices involving Interval[].

Cheers,
Paul

-- 
Paul Abbott                                   Phone: +61 8 6488 2734
School of Physics, M013                         Fax: +61 8 6488 1014
The University of Western Australia      (CRICOS Provider No 00126G)         
35 Stirling Highway
Crawley WA 6009                      mailto:paul at physics.uwa.edu.au 
AUSTRALIA                            http://physics.uwa.edu.au/~paul


  • Prev by Date: Re: Numerical Optimization involving equation solving
  • Next by Date: Re: Re: Mathematica graphs in WORD
  • Previous by thread: FW: precisions
  • Next by thread: Set working directory? Read polynomial from text file?