topic Re: Prime 3.1 - Problem with until function? in PTC Mathcad
https://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402110#M157785
<HTML><HEAD></HEAD><BODY><BLOCKQUOTE><TABLE border="1"><TBODY><TR><TD>
<P>LucMeekes wrote:</P>
<P></P>
<P>But, apart from the extra iteration, in Mcad 6 the until function works as expected 'stand-alone':</P>
<P><IMG alt="" class="jive-image image-1" height="197" src="https://community.ptc.com/legacyfs/online/89672_pastedImage_0.png" style="max-width: 113px;" width="113" /></P>
<P>Luc</P>
</TD></TR></TBODY></TABLE></BLOCKQUOTE><P>I doubt whether we'll see it fixed in M15, but it would be nice to make it work in Prime 3.2 / Prime 4.0 (whatever, as long as it's the next iteration).</P><P></P><P>Of course, it would be really cool if they made it work with a vector ...</P><P></P><P>Even better would be if they, additionally, made better use of ranges and allowed them as arguments to functions, plus extending the concept to sequences, ie, something along the lines of (and being very loose with notation) ...</P><P></P><P><term>:=<scalar>|<string>|<array>|<function> </P><P>99| 3-2i | "a" | [1,2,3] | sin</P><P><sequence>:= <term>,<term></P><P>1,2 | "a","c"</P><P><sequence>:=<term>,<sequence></P><P>1,2,3 | 1,2,4 | "a","c",</P><P><sequence>:=(<sequence>)</P><P>(1,2,4)</P><P><range>:=<term>..<term> [<term> in this instance would be limited to types that have a natural successor or predecessor, eg numbers and characters]</P><P>1..2 | "a".."b"</P><P><range>:= <sequence>..<term></P><P>1,2..5 | "a","b".."e"</P><P><sequence>:=<range></P><P>1,2..5 | "a","b".."e"</P><P><sequence>:=(<range>),<sequence></P><P>(1,2,4..32),9,13 | ("a","b".."e"),5,11</P><P><sequence>:=<sequence>,(<range>)</P><P>"a","b",(1,2..5) | 5,11,("a","b".."e")</P><P><sequence>:=<sequence>,(<range>),<sequence></P><P>"a","b",(1,2..5),9,13 | 5,11,("a","b".."e"),5,11</P><P></P><P>Another provisio I'd put on ranges is that the number of terms in a multiterm initial sequence determines the order of the polynomial that fits the sequence and that the final term represents the final value of the implied sequence (as it currently does). The reason for this extension I've had a few occasions when I would have liked to have non-contiguous values in a range definition, generate alphabetic sequences, generate a simple polynomial set of values. A typical example of usage is using my vec function to generate a set of values or wanting to pass multiple range definitions to a function without having to generate a corresponding set of range variables; for example: in Mathcad 15 (and M11) I can use vec(2,4..8) to create the vector [2,4,6,8] directly; I would like to call a function g(x,y) with g(0.1,0.2, 0.4..3) and have g iterate over the (quadratically implied) values 0.1,0.1,0.2,0.4,0.7,1.1,1.6,2.2 and 2.9; or have a character sequence, "a","b","d".."z" map to "a","b","c","g","k","p","v".</P><P></P><P>Whilst there is an argument that range variables can be done away and replaced with vectors, with a range definition then acting as an implied array creator, I think they still have their uses as a separate implied iterator. For one thing, they take up less memory (I've had several instances where I've run out of memory using vectors but had no problem with range variables or loops</P><P></P><P>Well, something like that, anyway.</P><P></P><P>The strange thing is that some of this (<EM>sequences of values mixed with implied linear sequence (..) range definitions</EM>) can already be done in a for loop:</P><P></P><P><IMG alt="" class="jive-image image-2" src="https://community.ptc.com/legacyfs/online/89670_pastedImage_234.png" style="max-width: 1200px; max-height: 900px;" /></P><P></P><P>And it can partially be done in M15, plus a bit of programming to show the intent (including a polynomial function generator)</P><P><IMG alt="" class="jive-image image-3" src="https://community.ptc.com/legacyfs/online/89671_pastedImage_239.png" style="max-width: 1200px; max-height: 900px;" /></P><P></P><P>There are no "optical tricks" in the above, BTW; it's all done with standard programming.</P><P></P><P>Stuart</P></BODY></HTML>Fri, 10 Jul 2015 02:11:38 GMTStuartBruff2015-07-10T02:11:38ZPrime 3.1 - Problem with until function?
https://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402094#M157769
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 ableThu, 03 May 2018 15:17:42 GMThttps://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402094#M157769StuartBruff2018-05-03T15:17:42ZRe: Prime 3.1 - Problem with until function?
https://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402095#M157770
<HTML><HEAD></HEAD><BODY><P>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.".</P><P>The function is listed with description,</P><P> Function for iteration: until(x,y) This function allows you to halt an iterative process based on a condition. Returns <SPAN style="font-style: italic;">y</SPAN> until <SPAN style="font-style: italic;">x</SPAN> is negative.</P><P> Arguments: <SPAN style="font-style: italic;">x</SPAN> is a test expression (usually involving a negative, the <SPAN style="font-style: italic;">until</SPAN> function halts iteration.</P><P> <SPAN style="font-style: italic;">y</SPAN> is the value returned by the <SPAN style="font-style: italic;">until</SPAN> function at each iteration.</P><P>but also in the list of obsolete functions.</P><P> The obsolete functions include: APPEND, READ, until, WRITE.</P><P> These functions continue to exist in Mathcad to support backward compatibility, but their use is discouraged.</P><P></P><P>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.</P><P>For 'until(9-k, k^2)' I would expect the iteration to run to 9 but it outputs the full range of k^2:</P><P><IMG __jive_id="89477" alt="" class="jive-image image-1" src="https://community.ptc.com/legacyfs/online/89477_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /></P><P>Ah, you cannot use it this way. It must be like:</P><P><IMG __jive_id="89484" alt="" class="jive-image image-2" src="https://community.ptc.com/legacyfs/online/89484_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /> or <IMG __jive_id="89485" alt="" class="jive-image image-3" src="https://community.ptc.com/legacyfs/online/89485_pastedImage_1.png" style="max-width: 1200px; max-height: 900px;" />is the same. Too bad for the 0 at the end.</P><P></P><P>In Prime 3.0 (Express) I get the same error as you find in 3.1.</P></BODY></HTML>Mon, 06 Jul 2015 13:34:09 GMThttps://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402095#M157770LucMeekes2015-07-06T13:34:09ZRe: Prime 3.1 - Problem with until function?
https://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402096#M157771
<HTML><HEAD></HEAD><BODY><BLOCKQUOTE><TABLE border="1"><TBODY><TR><TD>
<P>LucMeekes wrote:</P>
<P></P>
<P>Mathcad 11.2 'knows' the function: ..</P>
<P>but also in the list of obsolete functions.</P>
<P> The obsolete functions include: APPEND, READ, until, WRITE.</P>
<P> These functions continue to exist in Mathcad to support backward compatibility, but their use is discouraged.</P>
<P></P>
<P>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.</P>
<P>For 'until(9-k, k^2)' I would expect the iteration to run to 9 but it outputs the full range of k^2:</P>
<BR />
<P>In Prime 3.0 (Express) I get the same error as you find in 3.1.</P>
</TD></TR></TBODY></TABLE></BLOCKQUOTE><P></P><P>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).</P><P></P><P>I ran your example in Mathcad 15 and got this ...</P><P></P><P><IMG alt="" class="jive-image image-1" src="https://community.ptc.com/legacyfs/online/89478_pastedImage_1.png" style="max-width: 1200px; max-height: 900px;" /></P><P></P><P>So it definitely appears to have been been unbroken in M15!</P><P></P><P>Stuart</P></BODY></HTML>Mon, 06 Jul 2015 14:14:10 GMThttps://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402096#M157771StuartBruff2015-07-06T14:14:10ZRe: Prime 3.1 - Problem with until function?
https://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402097#M157772
<HTML><HEAD></HEAD><BODY><P>Hi Stuart,</P><P></P><P>Note that I changed my response after you grabbed it, see above.</P><P>Good to see that the final 0 is omitted in Mcad15, and I guess they put it back in the 'fully supported' list.</P><P>Did you try (as I initially did) to just get the result from, e.g. 'until(7-k,k)=' ?</P><P></P><P>Luc</P></BODY></HTML>Mon, 06 Jul 2015 15:12:34 GMThttps://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402097#M157772LucMeekes2015-07-06T15:12:34ZRe: Prime 3.1 - Problem with until function?
https://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402098#M157773
<HTML><HEAD></HEAD><BODY><BLOCKQUOTE><TABLE border="1"><TBODY><TR><TD>
<P>LucMeekes wrote:</P>
<P></P>
<P>Hi Stuart,</P>
<P></P>
<P>Note that I changed my response after you grabbed it, see above.</P>
<P>Good to see that the final 0 is omitted in Mcad15, and I guess they put it back in the 'fully supported' list.</P>
<P>Did you try (as I initially did) to just get the result from, e.g. 'until(7-k,k)=' ?</P>
</TD></TR></TBODY></TABLE></BLOCKQUOTE><P>Well, if they did, that offers some hope that it's supposed to work in Prime.</P><P></P><P>I didn't try just evaluating the until function ... or, at least, not as far as I remember - I'll check with my goldfish!</P><P></P><P>However, if I did, I probably got the same result as I've just obtained. It doesn't work.</P><P></P><P><IMG alt="" class="jive-image image-1" src="https://community.ptc.com/legacyfs/online/89487_pastedImage_1.png" style="max-width: 1200px; max-height: 900px;" /></P><P>The error message is "This 'break' must occur within a loop".</P><P></P><P>Stuart</P></BODY></HTML>Mon, 06 Jul 2015 15:23:53 GMThttps://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402098#M157773StuartBruff2015-07-06T15:23:53ZRe: Prime 3.1 - Problem with until function?
https://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402099#M157774
<HTML><HEAD></HEAD><BODY><P>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.</P></BODY></HTML>Mon, 06 Jul 2015 17:07:13 GMThttps://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402099#M157774LucMeekes2015-07-06T17:07:13ZRe: Prime 3.1 - Problem with until function?
https://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402100#M157775
<HTML><HEAD></HEAD><BODY><BLOCKQUOTE><TABLE border="1"><TBODY><TR><TD>
<P>StuartBruff wrote:</P>
<P></P>
<P>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.</P>
<P></P>
<P>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?</P>
<P></P>
<P>Stuart</P>
<P></P>
<P><IMG alt="" class="jive-image image-1" height="568" src="https://community.ptc.com/legacyfs/online/89617_pastedImage_2.png" style="max-width: 699px;" width="699" /></P>
</TD></TR></TBODY></TABLE></BLOCKQUOTE><P>Could somebody with a full Prime 3.1 please say whether they see the same thing as I get in Express?</P><P></P><P>Thanks,</P><P></P><P>Stuart</P></BODY></HTML>Wed, 08 Jul 2015 19:23:57 GMThttps://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402100#M157775StuartBruff2015-07-08T19:23:57ZRe: Prime 3.1 - Problem with until function?
https://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402101#M157776
<HTML><HEAD></HEAD><BODY><P>Hello Stuart, I do indeed see the same thing using 3.1</P><P><IMG class="jive-image image-1" src="https://community.ptc.com/legacyfs/online/89619_pastedImage_0.png" style="max-height: 900px; max-width: 1200px;" /></P></BODY></HTML>Wed, 08 Jul 2015 21:24:57 GMThttps://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402101#M157776nas0k2015-07-08T21:24:57ZRe: Prime 3.1 - Problem with until function?
https://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402102#M157777
<HTML><HEAD></HEAD><BODY><BLOCKQUOTE><TABLE border="1"><TBODY><TR><TD>
<P>Norm Schutzkus wrote:</P>
<P></P>
<P>Hello Stuart, I do indeed see the same thing using 3.1</P>
<P><IMG class="jive-image image-1" height="338" src="https://community.ptc.com/legacyfs/online/89627_pastedImage_0.png" style="max- max-width: 500px;" width="500" /></P>
</TD></TR></TBODY></TABLE></BLOCKQUOTE><P>Thanks, Norm.</P><P></P><P>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.</P><P></P><P>Stuart</P></BODY></HTML>Wed, 08 Jul 2015 21:29:42 GMThttps://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402102#M157777StuartBruff2015-07-08T21:29:42ZRe: Prime 3.1 - Problem with until function?
https://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402103#M157778
<HTML><HEAD></HEAD><BODY><P>Hello Stuart, I'd be glad to, but how? I was under the impression that PTC monitored these discussions.</P><P></P><P>Best regards,</P><P></P><P>Norm</P></BODY></HTML>Thu, 09 Jul 2015 12:45:02 GMThttps://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402103#M157778nas0k2015-07-09T12:45:02ZRe: Prime 3.1 - Problem with until function?
https://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402104#M157779
<HTML><HEAD></HEAD><BODY><BLOCKQUOTE><TABLE border="1"><TBODY><TR><TD>
<P>StuartBruff wrote:</P>
<P></P>
<P>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.</P>
<P></P>
<P>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?</P>
<P></P>
<P>Stuart</P>
<P></P>
<P><IMG alt="" class="jive-image image-1" height="568" src="https://community.ptc.com/legacyfs/online/89637_pastedImage_2.png" style="max-width: 699px;" width="699" /></P>
</TD></TR></TBODY></TABLE></BLOCKQUOTE><P>I've got Prime 3.0--we're being dragged "kicking and screaming," </P><P></P><P>Prime does not have "until" in the programming operator menu.</P></BODY></HTML>Thu, 09 Jul 2015 12:50:11 GMThttps://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402104#M157779FredKohlhepp2015-07-09T12:50:11ZRe: Prime 3.1 - Problem with until function?
https://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402105#M157780
<HTML><HEAD></HEAD><BODY><P>Hello Fred, it is a function under Piecewise Continuous.</P><P></P><P><IMG class="jive-image image-1" src="https://community.ptc.com/legacyfs/online/89639_pastedImage_1.png" style="max-height: 900px; max-width: 1200px;" /></P></BODY></HTML>Thu, 09 Jul 2015 12:54:18 GMThttps://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402105#M157780nas0k2015-07-09T12:54:18ZRe: Prime 3.1 - Problem with until function?
https://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402106#M157781
<HTML><HEAD></HEAD><BODY><BLOCKQUOTE><TABLE border="1"><TBODY><TR><TD>
<P>Fred Kohlhepp wrote:</P>
<P style="min-height: 8pt; padding: 0px;"></P>
<P>Prime does not have "until" in the programming operator menu.</P>
</TD></TR></TBODY></TABLE></BLOCKQUOTE><P>As Norm says, it's in the Piecewise functions section. It dates back to the Good Old Days, when programming was but a distant gleam in Mathsoft's eyes and all we had was iteration. I still find it a useful exercise, now and again, to try to refashion a problem in terms of pure iteration. Usually it just makes my brain hurt and curse the limitations of Prime Express ... although not sufficiently to make me want to shell out £1000 for Prime 3.1 (not when I get Personal Use editions of Mathematica, Maple and Matlab for less than £200).</P><P></P><P>Here's the example from the Mathcad 6 User Guide (*), duly written up and working in Mathcad 15 ...</P><P></P><P></P><P></P><P><IMG __jive_id="89631" alt="" class="jive-image image-1" src="https://community.ptc.com/legacyfs/online/89631_pastedImage_1.png" style="max-width: 1200px; max-height: 900px;" /></P><P>I suspect the M6 difference in N2 is to deal with the extra zero that Luc noted in M11.</P><P></P><BLOCKQUOTE><TABLE border="1"><TBODY><TR><TD>I've got Prime 3.0--we're being dragged "kicking and screaming,"</TD></TR></TBODY></TABLE></BLOCKQUOTE><P></P><P>You would have thought they'd at least drag you to Prime 3.1. </P><P></P><P>Stuart</P><P></P><P>(*) Yes, I've still got it! Every now and again, my wife tries to get me to throw away a book or two, on the basis that I either "don't need that many" or "you've got a newer one" or "surely you only need one book on xxxx". Ha Ha! I gloat! (but only because she's not around at the moment). This is just why you can never have too many books or dispose of old ones! It more than justifies the extra expense of wall-length book cases! But you try telling some people that ....</P></BODY></HTML>Thu, 09 Jul 2015 14:48:35 GMThttps://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402106#M157781StuartBruff2015-07-09T14:48:35ZRe: Prime 3.1 - Problem with until function?
https://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402107#M157782
<HTML><HEAD></HEAD><BODY><BLOCKQUOTE><TABLE border="1"><TBODY><TR><TD>
<P>StuartBruff wrote:</P>
<P></P>
<BLOCKQUOTE class="jive-quote">
<P>Fred Kohlhepp wrote:</P>
<P></P>
<P>Prime does not have "until" in the programming operator menu.</P>
</BLOCKQUOTE>
<P>As Norm says, it's in the Piecewise functions section. It dates back to the Good Old Days, when programming was but a distant gleam in Mathsoft's eyes and all we had was iteration. I still find it a useful exercise, now and again, to try to refashion a problem in terms of pure iteration. Usually it just makes my brain hurt and curse the limitations of Prime Express ... although not sufficiently to make me want to shell out £1000 for Prime 3.1 (not when I get Personal Use editions of Mathematica, Maple and Matlab for less than £200).</P>
<P></P>
<P><EM><STRONG>The function is there and can be inserted but Prime 3.0 doesn't work either</STRONG></EM></P>
<P><EM><IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.ptc.com/legacyfs/online/89645_Capture.PNG" style="height: auto;" /></EM></P>
<P></P>
<P></P>
<P></P>
<P></P>
<P>I suspect the M6 difference in N2 is to deal with the extra zero that Luc noted in M11.</P>
<P></P>
<BLOCKQUOTE class="jive-quote">I've got Prime 3.0--we're being dragged "kicking and screaming,"</BLOCKQUOTE>
<P></P>
<P>You would have thought they'd at least drag you to Prime 3.1. </P>
<P><EM><STRONG>I work in a company at least as bureaucratic as PTC, it'll be at least three years. . .(maybe that's a good thing <span class="lia-unicode-emoji" title=":winking_face:">😉</span></STRONG></EM></P>
<P></P>
<P>Stuart</P>
<P></P>
<P>(*) Yes, I've still got it! Every now and again, my wife tries to get me to throw away a book or two, on the basis that I either "don't need that many" or "you've got a newer one" or "surely you only need one book on xxxx". Ha Ha! I gloat! (but only because she's not around at the moment). This is just why you can never have too many books or dispose of old ones! It more than justifies the extra expense of wall-length book cases! But you try telling some people that ....</P>
</TD></TR></TBODY></TABLE></BLOCKQUOTE></BODY></HTML>Thu, 09 Jul 2015 16:01:43 GMThttps://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402107#M157782FredKohlhepp2015-07-09T16:01:43ZRe: Prime 3.1 - Problem with until function?
https://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402108#M157783
<HTML><HEAD></HEAD><BODY><P>You're right,</P><P>the extra iteration apparently has been in for a long time. Here is Mathcad 6:</P><P><IMG alt="" class="jive-image image-1" src="https://community.ptc.com/legacyfs/online/89651_pastedImage_2.png" style="max-width: 1200px; max-height: 900px;" /></P><P>Luc</P></BODY></HTML>Thu, 09 Jul 2015 19:54:03 GMThttps://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402108#M157783LucMeekes2015-07-09T19:54:03ZRe: Prime 3.1 - Problem with until function?
https://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402109#M157784
<HTML><HEAD></HEAD><BODY><P>But, apart from the extra iteration, in Mcad 6 the until function works as expected 'stand-alone':</P><P><IMG __jive_id="89659" alt="" class="jive-image image-1" src="https://community.ptc.com/legacyfs/online/89659_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /></P><P>Luc</P></BODY></HTML>Thu, 09 Jul 2015 19:58:46 GMThttps://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402109#M157784LucMeekes2015-07-09T19:58:46ZRe: Prime 3.1 - Problem with until function?
https://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402110#M157785
<HTML><HEAD></HEAD><BODY><BLOCKQUOTE><TABLE border="1"><TBODY><TR><TD>
<P>LucMeekes wrote:</P>
<P></P>
<P>But, apart from the extra iteration, in Mcad 6 the until function works as expected 'stand-alone':</P>
<P><IMG alt="" class="jive-image image-1" height="197" src="https://community.ptc.com/legacyfs/online/89672_pastedImage_0.png" style="max-width: 113px;" width="113" /></P>
<P>Luc</P>
</TD></TR></TBODY></TABLE></BLOCKQUOTE><P>I doubt whether we'll see it fixed in M15, but it would be nice to make it work in Prime 3.2 / Prime 4.0 (whatever, as long as it's the next iteration).</P><P></P><P>Of course, it would be really cool if they made it work with a vector ...</P><P></P><P>Even better would be if they, additionally, made better use of ranges and allowed them as arguments to functions, plus extending the concept to sequences, ie, something along the lines of (and being very loose with notation) ...</P><P></P><P><term>:=<scalar>|<string>|<array>|<function> </P><P>99| 3-2i | "a" | [1,2,3] | sin</P><P><sequence>:= <term>,<term></P><P>1,2 | "a","c"</P><P><sequence>:=<term>,<sequence></P><P>1,2,3 | 1,2,4 | "a","c",</P><P><sequence>:=(<sequence>)</P><P>(1,2,4)</P><P><range>:=<term>..<term> [<term> in this instance would be limited to types that have a natural successor or predecessor, eg numbers and characters]</P><P>1..2 | "a".."b"</P><P><range>:= <sequence>..<term></P><P>1,2..5 | "a","b".."e"</P><P><sequence>:=<range></P><P>1,2..5 | "a","b".."e"</P><P><sequence>:=(<range>),<sequence></P><P>(1,2,4..32),9,13 | ("a","b".."e"),5,11</P><P><sequence>:=<sequence>,(<range>)</P><P>"a","b",(1,2..5) | 5,11,("a","b".."e")</P><P><sequence>:=<sequence>,(<range>),<sequence></P><P>"a","b",(1,2..5),9,13 | 5,11,("a","b".."e"),5,11</P><P></P><P>Another provisio I'd put on ranges is that the number of terms in a multiterm initial sequence determines the order of the polynomial that fits the sequence and that the final term represents the final value of the implied sequence (as it currently does). The reason for this extension I've had a few occasions when I would have liked to have non-contiguous values in a range definition, generate alphabetic sequences, generate a simple polynomial set of values. A typical example of usage is using my vec function to generate a set of values or wanting to pass multiple range definitions to a function without having to generate a corresponding set of range variables; for example: in Mathcad 15 (and M11) I can use vec(2,4..8) to create the vector [2,4,6,8] directly; I would like to call a function g(x,y) with g(0.1,0.2, 0.4..3) and have g iterate over the (quadratically implied) values 0.1,0.1,0.2,0.4,0.7,1.1,1.6,2.2 and 2.9; or have a character sequence, "a","b","d".."z" map to "a","b","c","g","k","p","v".</P><P></P><P>Whilst there is an argument that range variables can be done away and replaced with vectors, with a range definition then acting as an implied array creator, I think they still have their uses as a separate implied iterator. For one thing, they take up less memory (I've had several instances where I've run out of memory using vectors but had no problem with range variables or loops</P><P></P><P>Well, something like that, anyway.</P><P></P><P>The strange thing is that some of this (<EM>sequences of values mixed with implied linear sequence (..) range definitions</EM>) can already be done in a for loop:</P><P></P><P><IMG alt="" class="jive-image image-2" src="https://community.ptc.com/legacyfs/online/89670_pastedImage_234.png" style="max-width: 1200px; max-height: 900px;" /></P><P></P><P>And it can partially be done in M15, plus a bit of programming to show the intent (including a polynomial function generator)</P><P><IMG alt="" class="jive-image image-3" src="https://community.ptc.com/legacyfs/online/89671_pastedImage_239.png" style="max-width: 1200px; max-height: 900px;" /></P><P></P><P>There are no "optical tricks" in the above, BTW; it's all done with standard programming.</P><P></P><P>Stuart</P></BODY></HTML>Fri, 10 Jul 2015 02:11:38 GMThttps://community.ptc.com/t5/PTC-Mathcad/Prime-3-1-Problem-with-until-function/m-p/402110#M157785StuartBruff2015-07-10T02:11:38Z