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
- :
- Prime 3.1 - Problem with until function?

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- 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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

07-05-2015
07:43 PM

07-05-2015
07:43 PM

Prime 3.1 - Problem with until function?

I was looking at some of the Rosetta Code challenges for implementation in Mathcad and decided to try a couple in Prime Express (as this is what I have). The major drawback to Express is the lack of programming capability, but there's quite a bit that can be (or should be able to be done) using just range variables and functions that don't make use of programs.

I wanted to pick all of the non-zero elements out of a vector and decided to use the until function to sweep through a reverse sorted vector until it hit a zero. However, Prime keeps telling me that 'until' is undefined, even though I inserted it using the Functions Dialog. Express doesn't raise an alert saying that it's Premium Feature, so I'd expect it work. Neither can I find anything in the Migration Guide or Help to indicate it's been deprecated. Is there a known problem with the until function in Prime 3.1?

Stuart

16 REPLIES 16

Highlighted
##

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

07-06-2015
09:34 AM

07-06-2015
09:34 AM

Re: Prime 3.1 - Problem with until function?

Mathcad 11.2 'knows' the function: if called with a single parameter it complains there's one missing, if called with 3 parameters it complains there's one too much. If called with two parameters it marks the error: "This function is obsolete. Press [F1] for Help.".

The function is listed with description,

Function for iteration: until(x,y) This function allows you to halt an iterative process based on a condition. Returns y until x is negative.

Arguments: x is a test expression (usually involving a negative, the until function halts iteration.

y is the value returned by the until function at each iteration.

but also in the list of obsolete functions.

The obsolete functions include: APPEND, READ, until, WRITE.

These functions continue to exist in Mathcad to support backward compatibility, but their use is discouraged.

So if I set the worksheet calculation mode to 'backwards compatible' it 'works' although I cannot find it to stop iteration. I tried your expression: iteration runs through to 12.

For 'until(9-k, k^2)' I would expect the iteration to run to 9 but it outputs the full range of k^2:

Ah, you cannot use it this way. It must be like:

or is the same. Too bad for the 0 at the end.

In Prime 3.0 (Express) I get the same error as you find in 3.1.

Highlighted
##

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

07-06-2015
10:14 AM

07-06-2015
10:14 AM

Re: Prime 3.1 - Problem with until function?

LucMeekes wrote:

Mathcad 11.2 'knows' the function: ..

but also in the list of obsolete functions.

The obsolete functions include: APPEND, READ, until, WRITE.

These functions continue to exist in Mathcad to support backward compatibility, but their use is discouraged.

So if I set the worksheet calculation mode to 'backwards compatible' it 'works' although I cannot find it to stop iteration. I tried your expression: iteration runs through to 12.

For 'until(9-k, k^2)' I would expect the iteration to run to 9 but it outputs the full range of k^2:

In Prime 3.0 (Express) I get the same error as you find in 3.1.

That's interesting. Thanks, Luc. I don't use until very often, but it has its occasional uses, particularly when I'm developing an algorithm (or, more likely, debugging a program).

I ran your example in Mathcad 15 and got this ...

So it definitely appears to have been been unbroken in M15!

Stuart

Highlighted
##

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

07-06-2015
11:12 AM

07-06-2015
11:12 AM

Re: Prime 3.1 - Problem with until function?

Hi Stuart,

Note that I changed my response after you grabbed it, see above.

Good to see that the final 0 is omitted in Mcad15, and I guess they put it back in the 'fully supported' list.

Did you try (as I initially did) to just get the result from, e.g. 'until(7-k,k)=' ?

Luc

Highlighted
##

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

07-06-2015
11:23 AM

07-06-2015
11:23 AM

Re: Prime 3.1 - Problem with until function?

LucMeekes wrote:

Hi Stuart,

Note that I changed my response after you grabbed it, see above.

Good to see that the final 0 is omitted in Mcad15, and I guess they put it back in the 'fully supported' list.

Did you try (as I initially did) to just get the result from, e.g. 'until(7-k,k)=' ?

Well, if they did, that offers some hope that it's supposed to work in Prime.

I didn't try just evaluating the until function ... or, at least, not as far as I remember - I'll check with my goldfish!

However, if I did, I probably got the same result as I've just obtained. It doesn't work.

The error message is "This 'break' must occur within a loop".

Stuart

Highlighted
##

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

07-06-2015
01:07 PM

07-06-2015
01:07 PM

Re: Prime 3.1 - Problem with until function?

So they broke that part in Mathcad 15. But they might claim they improved, because now it gives a - some what to the point - error message, whereas in Mathcad 11 it would produce output albeit not the expected/desired one.

Highlighted
##

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

07-08-2015
03:23 PM

07-08-2015
03:23 PM

Re: Prime 3.1 - Problem with until function?

StuartBruff wrote:

I was looking at some of the Rosetta Code challenges for implementation in Mathcad and decided to try a couple in Prime Express (as this is what I have). The major drawback to Express is the lack of programming capability, but there's quite a bit that can be (or should be able to be done) using just range variables and functions that don't make use of programs.

I wanted to pick all of the non-zero elements out of a vector and decided to use the until function to sweep through a reverse sorted vector until it hit a zero. However, Prime keeps telling me that 'until' is undefined, even though I inserted it using the Functions Dialog. Express doesn't raise an alert saying that it's Premium Feature, so I'd expect it work. Neither can I find anything in the Migration Guide or Help to indicate it's been deprecated. Is there a known problem with the until function in Prime 3.1?

Stuart

Could somebody with a full Prime 3.1 please say whether they see the same thing as I get in Express?

Thanks,

Stuart

Highlighted
##

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

07-08-2015
05:24 PM

07-08-2015
05:24 PM

Re: Prime 3.1 - Problem with until function?

Hello Stuart, I do indeed see the same thing using 3.1

Highlighted
##

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

07-08-2015
05:29 PM

07-08-2015
05:29 PM

Re: Prime 3.1 - Problem with until function?

Norm Schutzkus wrote:

Hello Stuart, I do indeed see the same thing using 3.1

Thanks, Norm.

As I'm not a maintenance customer, I can't raise a problem report. I'd be grateful, therefore, if an MC could flag it up to PTC. Thanks.

Stuart

Highlighted
##

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

07-09-2015
08:45 AM

07-09-2015
08:45 AM

Re: Prime 3.1 - Problem with until function?

Hello Stuart, I'd be glad to, but how? I was under the impression that PTC monitored these discussions.

Best regards,

Norm