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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

trap errors individually in calculation of vector/matrix

DaveWooff
5-Regular Member

trap errors individually in calculation of vector/matrix

Hi,

say I have a vector v with possible zero valued elements and I want log(v), is there an efficient way to get Mathcad to trap errors individually? In my case I simply want to return a predetermined constant -ve value for all zero elements.

At the moment I have something like "-100 on error log(v)" which returns a scalar if any element is zero rather than a vector. I know I could loop through but this might be slow since some of my arrays are quite big.

Regards,

D

1 ACCEPTED SOLUTION

Accepted Solutions

I thought maybe vectorize would work.

It does if you use it as a function.

View solution in original post

4 REPLIES 4

I thought maybe vectorize would work.

Need a three line program

I find it a little strange that the on error doesn't work when vectorized.

Mike

I thought maybe vectorize would work.

It does if you use it as a function.

DaveWooff
5-Regular Member
(To:RichardJ)

Got it. Many thanks everyone!

Top Tags