LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Something is up with matrix math

Solved!
Go to solution
Solution
Accepted by aeastet

I edited the original VI you attached to get this:

dsbNI_0-1761628383313.png

 

When I run it, I see these results (the same results we have been sharing in all these posts):

dsbNI_1-1761628465075.png

On the left, the results are computed and displayed with full precision. On the right, the matrices Sigma_reg_6SigFigs and Sigma_inv_6SigFigs have been rounded to 6 significant figures, but are shown with 8 significant figures to show that data was lost in the rounding. The diagonals of Ainv * A are computed and displayed. Given that the rounded result agrees with the result from Mathematica, I conclude that rounded matrices were input to Mathematica. Tim, would you be willing to try a simpler problem with your LabVIEW version and Mathematica? How about a simple 3x3 matrix with diagonal elements: 3, 6, 9. I hope LabVIEW returns the inverse with decimal equivalent of diagonal elements: 1/3, 1/6, 1/9. When performing the validation checks with full precision, Ainv * A should have diagonal elements very close to 1 (i.e. 1.000000000000000) If we use less precision, we should expect more error. If that experiment doesn't shed light, we can do a 1x1 A matrix = [3]. We know what the inverse is, and we can verify the math easily. Please let us know what you discover.

Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
Message 21 of 25
(191 Views)

@aeastet wrote:

LabVIEW is the only place where I am not seeing this as a result of matrix multiplying Sigma_reg and Sigma_ inv. For LabVIEW I only get 1.000000000000000000000. Noone is answering this question.

 

aeastet_0-1761595431299.png

 

The LabVIEW result:

aeastet_0-1761595733629.png


How can I make my question more clear?

 

 

Matrix A multiplied by the inverse matrix of A yields the identity matrix, in which all elements are 0 except for the diagonal elements, which are 1.

LabVIEW returns the identity matrix, so my questions are:

Why do you think LabVIEW is wrong and the other places are right?

Are "the other places" using single precision values?

Message 22 of 25
(170 Views)

Cutting to 6 digits emulates OPs values pretty well, which is what a Single represents ... so what's the precision in OPs other programs.

(Also, why would x * (1/x) _not_ be 1?)

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 23 of 25
(131 Views)

Mathematica can use "infinite" precision in its calculations. To speed up numeric calculations in Mathematica you need to specify a lesser precision.  

Message 24 of 25
(97 Views)

@aeastet wrote:

I am showing 20 digits. It is not a display issue. I have been doing this a really long time. I am not going to get caught on something that simple. Did anyone actually look at what I am doing in my code? 

 

 


I loaded your exact "Matrix Example Simple" and you were only showing 6 digits, not 20. Maybe your non-simple code is doing something different? Expanding the number of digits in your example showed the number change after the 6th digit. I only looked at your simple example, which disagreed due to the number of digits shown.

0 Kudos
Message 25 of 25
(70 Views)