×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# precision while adding matrices

 Forum Search FAQs Links MVPs

## precision while adding matrices

(OP)
Hi, I have a fortran program which generates 2d matrices A1(12x12) and A2(12x12), then combine it in such a way that A2(1,1) is added to A1(7,7), A2(1,2) is added to A1(7,8) and so on (as shown in the attachment). I got the output as matrix A (18 x18) from fortran. all the matrices are declared as double precision in fortran.
eg; doubleprecision,dimension(12,12)::A1,A2
doubleprecision,dimension(18,18)::A
The combined A matrix was checked manually. please refer the attachment, it appears to be slightly different from what I got when I did assemblage in excel - how do I get rid of this error - something to do with precision control ?

### RE: precision while adding matrices

Double precision gives 15 digit accuracy. If the numbers you are playing with are of magnitude 1E12. If when subtracted/added, it ends up with something that is 1E-4, you are just getting spurious rubbish since 12+4 = 16 which is > 15. I would consider anything < 1E-3 to be 0.

### RE: precision while adding matrices

rkr19 - You might like to have a look at:
https://newtonexcelbach.wordpress.com/2011/12/20/w...

You can get similar differences in rounding when comparing spreadsheet results with results from VBA, or even between two results entirely generated on the spreadsheet, with and without brackets.

Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/

### RE: precision while adding matrices

(OP)
i tried calculating the Eigen values in Mathcad and it gave me results what I expected. it didn't show any issues. the results were same as that i got from an independent software check. so I am not worried whether the matrices are wrong. please see the attachment 'comparison.jpg'. it compares Mathcad results with dsygv output(results.txt). the Eigen value(1) in Mathcad matches almost with eigenval(3) of dsygv, eig(2) of Mathcad matched eig(4) of dsygv and so on. it looks like 2 negative figures were coming on the top...i wish to know if there is some way i can condition the matrices for dsygv to work properly - or is there a better routine which will work on them considering them as unsymmetric matrices. thanks

### RE: precision while adding matrices

I have posted a response in your other thread (since it's directly about dsygv problems).

Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

#### Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!