Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Any one can help me to correct the error in may mathermatical expression. The second condition are not also readed by this expression same with the example I attached -2.33<-1
Solved! Go to Solution.
As Stuart already stated - you have to use vectorization. You cannot compare a vector to a scalar (and what Mathcad's symbolics does is a bug).
Unfortunately the if expression can not be vectorized directly, so the best approach in my opinion is to cretae a function to do the calculations and call this function vectorized. The additional benefit is that you can use the very same function for both giframe and goframe. You may wish to change my function- and argument-names.
You used the symbolic evaluation because it (sometimes) yields a result. But I would call that a bug as the results may be wrong. It seems that the symbolics always assumes that the first condition is true, no matter what the value is.
Place a Vectorize operator over the entire expression on the right hand side. The "if" operators expect to get a scalar result, whereas your expressions use vectors. The vectorize operator makes Mathcad operate on each element, hence satisfying the needs of the if statements.
It's generally better to post a worksheet, as well as an image, because it can be quite difficult to see what's going on in many cases, eg an index looks the same as a subscripted name, making it near impossible to spot a typo. Furthermore, the source of the error might lie somewhere other than the place the error shows up.
Stuart
Dear Stuart
I attached now the MATH CAD spreadsheet. Thank you for.
Unfortunately, I don't have Prime, so can't read your file. But if you select the whole of the expression on the right hand side and go to the matrix ribbon tab, you should be able to find the vectorize operator .. It might even be available from the main ribbon in the operator section.
Stuart
As Stuart already stated - you have to use vectorization. You cannot compare a vector to a scalar (and what Mathcad's symbolics does is a bug).
Unfortunately the if expression can not be vectorized directly, so the best approach in my opinion is to cretae a function to do the calculations and call this function vectorized. The additional benefit is that you can use the very same function for both giframe and goframe. You may wish to change my function- and argument-names.
You used the symbolic evaluation because it (sometimes) yields a result. But I would call that a bug as the results may be wrong. It seems that the symbolics always assumes that the first condition is true, no matter what the value is.
Doh! I'd forgotten about not being able to vectorize an if statement!
Stuart
Thank you ! Problem solved.