10-27-2025 01:42 PM
10-27-2025 01:50 PM
When I am multiplying the matrix I should get a matrix that includes the right values. When I do the multiply I see this:
This multiply is wrong using matrix math:
The matrix should look like this:
Why to I not see the significant values when doing matrix math? Please look at these closely.
When I do the subtraction I should get this result not zero:
10-27-2025 01:54 PM - edited 10-27-2025 04:34 PM
So why are you even use matrix operations if all you really need are 1D array operation on the diagonal?
10-27-2025 02:14 PM
In the picture I posted I was showing the full values (left) and the truncated values (right), to show the difference in the math. Apologies if that wasn't clear.
Attached is the Simple example with everything expanded to 16 digits. You can see that the matrix data has all the extra digits as well, and once enough digits are copied over the x*y and x*y2 indicators do match.
I still don't understand the -0 row; must be noise from the underlying library, but it doesn't see to throw off the expected result: the matrix times its inverse is all 1's.
10-27-2025 03:05 PM - edited 10-27-2025 03:09 PM
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.
The LabVIEW result:
How can I make my question more clear?
10-27-2025 03:11 PM - edited 10-27-2025 03:22 PM
The matrix math is returning correct values
For A^-1 * A, we expect to get a diagonal matrix, and the matrix product returned by A x B.vi is:
This matrix includes all the right values as JePe1 has shown.
When you do the multiplication of elements, I think you may be copying "0.00598466" into Numeric and "167.094" into Numeric 2. The product:
0.00598466 * 167.094 = 1.000000778040
This product shows the errors you get when rounding intermediate results.
If you were to include the full (DBL) precision of the elements, you would instead see the following:
0.005984663470026351 * 167.0937731099518 = 1.000000000000000
This product is correct. It is not missing significant digits.
You are expecting to see a difference matrix match that of Mathematica. Please be wary when trying to compare floating point numbers exactly. It looks like several of the difference matrix elements are limited by machine epsilon. That doesn't make the right answer wrong, but it may mean that you need to apply a tolerance when comparing numbers. Integers can be compared exactly, but floating-point numbers must be compared to within tolerance (even more so when comparing across different computer architectures and software implementations). If you copy the full precision values to Mathematica, I bet you will see better agreement on numeric and matrix products.
Does Mathematica allow you to view more significant digits? Yes, you can use NumberForm function to specify the number of significant digits displayed.
10-27-2025 03:37 PM
Yep, Doug from NI gave (what I believe is) the correct answer. If you multiply 0.00598466 by 167.094 and display it in an "ordinary" Dbl Indicator, you will (probably) get the answer "1". But now change the Display Style to show, say, 15 significant digits, and you will get something like "0.999999999974", or "not quite". The more manipulation you do with this "not quite right" quantity, the more chances there are for this "small difference" to grow. One easy way to see this is to take the Product of the Numeric and its reciprocal and pass it through the "Decrement" function -- you should get 0, but you'll instead get (at least on my PC) -2.56466E-11 (to 6 significant digits, more are present but the display format is only showing 6 digits of precision).
Bob Schor
10-27-2025 04:30 PM
@aeastet wrote:
Here is a simple version
I'll answer your question specifically- the posters above are correct. Your issue is a copy/paste error.
Simple steps to fix your example VI:
1. Right click an element of Sigma_inv, select Display format, and set "Digits" to 15. Expand the control to make room for the new digits.
2. Do the same for Sigma_reg.
3. Copy/paste element 0,0 from Sigma_reg and Sigma_inv into Numeric and Numeric 2. Rerun your VI. Now, x*y 2 is exactly 1, even though Numeric and Numeric 2 didn't visibly change.
The problem is that copy/pasting from the indicator copies the text, not the value. So, if you have only 6 digits displayed when you copy, you only get 6 digits in the clipboard. Your error shows up at the 7th place in your original code, and you're only getting 6 digits of precision from your copy/paste.
For bonus points, after doing the above- copy the value from "Numeric 2" and paste it back again. Rerun, and you'll see the result changes.
10-27-2025 06:12 PM - edited 10-27-2025 06:58 PM
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?
10-27-2025 06:38 PM
What version of LabVIEW are you using? Is the data source of the original A matrix the same for Mathematica and for LabVIEW?