cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

NaN as a result

YA_10963798
14-Alexandrite

NaN as a result

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

Thanks in advance for your help

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:YA_10963798)

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

 

View solution in original post

9 REPLIES 9
StuartBruff
23-Emerald III
(To:YA_10963798)


@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.

YA_10963798
14-Alexandrite
(To:StuartBruff)

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

 

 

StuartBruff
23-Emerald III
(To:YA_10963798)

Yes, I’m afraid so.

Stuart
YA_10963798
14-Alexandrite
(To:StuartBruff)

thank you for trying . I appreciate your time 

Werner_E
25-Diamond I
(To:YA_10963798)

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

 

YA_10963798
14-Alexandrite
(To:Werner_E)

Thank you that solved my problem

StuartBruff
23-Emerald III
(To:Werner_E)


@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

Werner_E
25-Diamond I
(To:StuartBruff)

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.

StuartBruff
23-Emerald III
(To:Werner_E)


@Werner_E wrote:

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.


Indeed, filterNaN does seem to be the larger bottleneck.  However, augment is not entirely innocent in these proceedings.

 

2024 10 08 E.png

 

Stuart

Announcements

Top Tags