Skip to main content
Best answer by Werner_E

Whenever in  any calculation a NaN is involved, the result is NaN.

Werner_E_0-1728314285920.png

Maybe a utility  function to do the vector multiplication ignoring any multiplications with NaN involved could help:

Werner_E_1-1728314362218.png

Werner_E_3-1728314387669.png

Applied to your calculation it looks like this:

Werner_E_0-1728315265872.png

Is this somewhere near to what you expected?

 

The calculation takes some time as Prime has to multiply 3669*2=7338 times two 3670x1 vectors  and a user-written function using augment and filterNaN isn't very fast.

 

Prime 9 sheet attached

 

2 replies

23-Emerald V
October 7, 2024

@YA_10963798 wrote:

I don't know why I getting this kind of result.. I tried everything. It is on page 15 . I use prime 9

YA_10963798_0-1728301451061.png

 


When you multiply any pair of vectors that contain at least one NaN, the result is also a NaN.

 

2024 10 07 B.png

 

Stuart

 

I've got Mathcad Prime 10, so I can't post a worksheet that's useful to you.  Sorry.

14-Alexandrite
October 7, 2024

so that means the whole results will be NaN.. and that will erase all other results?.

 

 

23-Emerald V
October 7, 2024
Yes, I’m afraid so.

Stuart
Werner_E25-Diamond IAnswer
25-Diamond I
October 7, 2024

Whenever in  any calculation a NaN is involved, the result is NaN.

Werner_E_0-1728314285920.png

Maybe a utility  function to do the vector multiplication ignoring any multiplications with NaN involved could help:

Werner_E_1-1728314362218.png

Werner_E_3-1728314387669.png

Applied to your calculation it looks like this:

Werner_E_0-1728315265872.png

Is this somewhere near to what you expected?

 

The calculation takes some time as Prime has to multiply 3669*2=7338 times two 3670x1 vectors  and a user-written function using augment and filterNaN isn't very fast.

 

Prime 9 sheet attached

 

23-Emerald V
October 8, 2024

@Werner_E wrote:

Whenever in  any calculation a NaN is involved, the result is NaN.

Maybe a utility  function to do the vector multiplication ignoring any multiplications with NaN involved could help:

The calculation takes some time as Prime has to multiply 3669*2=7338 times two 3670x1 vectors  and a user-written function using augment and filterNaN isn't very fast.


 

Out of idle curiosity, I wondered what you meant by "takes some time".  Now I know.

 

Surprisingly, a brute force and ignorance method offers better performance.

 

2024 10 08 D.png

 

Stuart

25-Diamond I
October 8, 2024

Not such a big surprise. I suspect that "filterNaN" is the main bottleneck and not "augment" or the column selector.

The if function seems to be faster even though its used in the loop.