MathGroup Archive 2012

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

Search the Archive

Re: digit-precision for gaussian inputs converting cartesian matrix from

  • To: mathgroup at
  • Subject: [mg128862] Re: digit-precision for gaussian inputs converting cartesian matrix from
  • From: Bill Rowe <readnews at>
  • Date: Sat, 1 Dec 2012 04:32:50 -0500 (EST)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:

On 11/30/12 at 5:59 AM, decicco10 at (locometro, INMETRO/UFRJ,
Brasil - RJ) wrote:

>I have some issues to discuss here:

>My goal:  rotation,x-y plane, apllying over some cartesians vectors.

>(*step 1: I import a input.txt for Gaussian program like this:  *)

>%chk=campoX_1.chk %mem=2gb %nproc=4
>#p b3lyp/6-31+g(d,p) geom=connectivity field=x+1 pop=reg

>single point campo direcao X+01

>0 1
>C                  0.00000000    0.00000000    0.00000000
>C                  1.41786969    0.00000000    0.00000000
>C                 -0.68401407    1.24221249    0.00000000

>(*step 2: I extract the  data from input above, as below:*)

>data2 = Take[data1, {9, 56}, {2, 4}]] data3 = Flatten[Take[data1,
>{9, 56}, {1}]]; data4 = Drop[data1, {8, 56}, None];

>(*As I need the 1st(molecules symbol), 2nd (X) , 3rd (Y) and 4th(Z)
>columns, for my table and calculations*).

>(*step 3:  Rotation 45 degree, over plane x-y, using the exctracted

>rotZ = RotationMatrix[45 Degree, {0, 0, 1}]; datarotZ = (rotZ.#) &
>/@ data2 (*this promote the rotation matrice over  x-y-x*)

>output-> {{0., 0., 0.}, {1.00259, 1.00259, 0.}, {-1.36205, 0.394706,
>0.}, {-2.49436, 0.668808, 0.00086376}, {1.85795, 1.79358,
>-0.00004936}, {-3.36958, -5.96549, -0.00908542}, \
>{-2.95205, -7.30672, 0.00803008},...etc (* cartesians numbers
>already rotated 45 degrees*).

>BUT NOTICE that the numbers of digits has been modified!, I need the
>original 8 digits, including zeros, after the decimal point! I do
>not want mathematica aplying any aproximation or cuts.

There are a couple of issues here. First, any number entered
with a decimal point and not given an explicit precision is a
machine precision number in Mathematica. All machine precision
numbers are stored as binary data. In general, numbers you enter
as decimal numbers cannot be represented exactly in a finite
number of binary digits. So, the value Mathematica uses
typically is slightly different than the value you entered.

Once you start using machine precision values, by default
Mathematica will use machine precision for other parts of you
computation. These values also will be slightly different than
what you enter. As the computation proceeds these small
differences accumulate. The end result is reversing computations
often will not result in exactly the same decimal digits even
though the reverse computation would mathematically be an exact
inverse, resulting in an identity operation.

The only way around this issue is to either use exact values (no
decimal point, all fractions expressed as rationals) or to
increase the precision in the values you enter to make use of
Mathematica's arbitrary precision arithmetic. The cost is slower
execution of computations.

A second issue is by default Mathematica doesn't display
trailing zeros. You can change this by changing your display
options or by using functions like NumberForm to control how
Mathematica displays numbers.

  • Prev by Date: Re: Mathematica 9--Is This A Joke?
  • Next by Date: Re: V9 !!!
  • Previous by thread: Re: Mathematica 9--Is This A Joke?
  • Next by thread: Re: digit-precision for gaussian inputs converting cartesian matrix from