Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Help to correct the mathematical expression

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-30-2014
01:10 AM

11-30-2014
01:10 AM

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.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-30-2014
07:54 AM

11-30-2014
07:54 AM

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.

6 REPLIES 6

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-30-2014
05:33 AM

11-30-2014
05:33 AM

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-30-2014
05:48 AM

11-30-2014
05:48 AM

Re: Help to correct the mathematical expression

Dear Stuart

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-30-2014
05:56 AM

11-30-2014
05:56 AM

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-30-2014
07:54 AM

11-30-2014
07:54 AM

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-30-2014
08:20 AM

11-30-2014
08:20 AM

Re: Help to correct the mathematical expression

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

Stuart

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-30-2014
11:53 PM

11-30-2014
11:53 PM

Re: Help to correct the mathematical expression

Thank you ! Problem solved.