Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: digitprecision for gaussian inputs converting cartesian matrix from
Posted:
Dec 5, 2012 3:10 AM


Bill,
Thanks for the suggestions!
Em segundafeira, 3 de dezembro de 2012 06h37min55s UTC2, Bill Rowe escreveu: > On 11/30/12 at 5:59 AM, decicco10@gmail.com (locometro, INMETRO/UFRJ, > > Brasil  RJ) wrote: > > > > >I have some issues to discuss here: > > > > >My goal: rotation,xy 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/631+g(d,p) geom=connectivity field=x+1 pop=reg > > >#int=ultrafine > > > > >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 > > >etc...(72lines). > > > > >(*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 xy, using the exctracted > > >columns*) > > > > >rotZ = RotationMatrix[45 Degree, {0, 0, 1}]; datarotZ = (rotZ.#) & > > >/@ data2 (*this promote the rotation matrice over xyx*) > > > > >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.



