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
I've got Prime 3.0--we're being dragged "kicking and screaming,"
Prime does not have "until" in the programming operator menu.
Hello Fred, it is a function under Piecewise Continuous.
Fred Kohlhepp wrote:
Prime does not have "until" in the programming operator menu.
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).
Here's the example from the Mathcad 6 User Guide (*), duly written up and working in Mathcad 15 ...
I suspect the M6 difference in N2 is to deal with the extra zero that Luc noted in M11.
I've got Prime 3.0--we're being dragged "kicking and screaming,"
You would have thought they'd at least drag you to Prime 3.1.
Stuart
(*) 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 ....
StuartBruff wrote:
Fred Kohlhepp wrote:
Prime does not have "until" in the programming operator menu.
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).
The function is there and can be inserted but Prime 3.0 doesn't work either
I suspect the M6 difference in N2 is to deal with the extra zero that Luc noted in M11.
I've got Prime 3.0--we're being dragged "kicking and screaming,"You would have thought they'd at least drag you to Prime 3.1.
I work in a company at least as bureaucratic as PTC, it'll be at least three years. . .(maybe that's a good thing 😉
Stuart
(*) 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 ....
You're right,
the extra iteration apparently has been in for a long time. Here is Mathcad 6:
Luc
But, apart from the extra iteration, in Mcad 6 the until function works as expected 'stand-alone':
Luc
LucMeekes wrote:
But, apart from the extra iteration, in Mcad 6 the until function works as expected 'stand-alone':
Luc
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).
Of course, it would be really cool if they made it work with a vector ...
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) ...
<term>:=<scalar>|<string>|<array>|<function>
99| 3-2i | "a" | [1,2,3] | sin
<sequence>:= <term>,<term>
1,2 | "a","c"
<sequence>:=<term>,<sequence>
1,2,3 | 1,2,4 | "a","c",
<sequence>:=(<sequence>)
(1,2,4)
<range>:=<term>..<term> [<term> in this instance would be limited to types that have a natural successor or predecessor, eg numbers and characters]
1..2 | "a".."b"
<range>:= <sequence>..<term>
1,2..5 | "a","b".."e"
<sequence>:=<range>
1,2..5 | "a","b".."e"
<sequence>:=(<range>),<sequence>
(1,2,4..32),9,13 | ("a","b".."e"),5,11
<sequence>:=<sequence>,(<range>)
"a","b",(1,2..5) | 5,11,("a","b".."e")
<sequence>:=<sequence>,(<range>),<sequence>
"a","b",(1,2..5),9,13 | 5,11,("a","b".."e"),5,11
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".
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
Well, something like that, anyway.
The strange thing is that some of this (sequences of values mixed with implied linear sequence (..) range definitions) can already be done in a for loop:
And it can partially be done in M15, plus a bit of programming to show the intent (including a polynomial function generator)
There are no "optical tricks" in the above, BTW; it's all done with standard programming.
Stuart