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

Help to correct the mathematical expression

SOLVED
Newbie

Help to correct the mathematical expression

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

2014-11-30+10_06_18-PTC+Mathcad+Prime+3.0+-+Y__Projects_507910+Dubai+Frame_Structural+calculation_st.jpg

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Help to correct the mathematical expression

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.

1.png

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.

2.png

View solution in original post

6 REPLIES 6

Re: Help to correct the mathematical expression

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

Re: Help to correct the mathematical expression

Dear Stuart

I attached now the MATH CAD spreadsheet. Thank you for.

Re: Help to correct the mathematical expression

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

Re: Help to correct the mathematical expression

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.

1.png

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.

2.png

View solution in original post

Re: Help to correct the mathematical expression

Doh! I'd forgotten about not being able to vectorize an if statement!

Stuart

Re: Help to correct the mathematical expression

Thank you ! Problem solved.

Announcements