Hello community, I have this problem:
Solved! Go to Solution.
I've only got Mathcad Express, so I can't do programming, but the attached Express worksheet outlines one possible method of doing what (I think) you want.
A programmed version should be much simpler.
Stuart
I knew something was bugging me. Clearly my subconscious knew what when I wrote "slide function f".
Use the convolution operators with an appropriate kernel.
The operators themselves and the Diff function should give sufficient information to write a function that will vectorize over the vector and its convolution to give what's required.
Stuart
Its absolutely unclear to me what your Exercise 1 should be all about and what your cases I and II should demonstrate.
In your vector m you don't have "exactly 3 consecutive" values because you have exactly seven consecutive values.
So what should the result of vector m be and how does it relate to the two "cases" you show????
As you can see, Stuart and Tetsuro interpreted your description differently, and neither of them would arrive at the vectors you specified as X and Y.
According your Exercise 2 I understand it in the sense that a vector which consist only of strings "True" and/or "" only should return "True" and if the vector contains just one other element (for example a string like "TRUE" or "true " or "False" or " ") the result should be "False.
This could be done that way:
Note that this corresponds to Tetsuro's second version - everything which is not a "True" or an empty string "" triggers the result "False".
His first version on the other hand means that only a "False" triggers the result "False", everything else is allowed and returns a "True".
Unfortunately, I'm allergic to something at the moment and struggling to see, so, mea culpa, I didn't get as far as downloading the OP's worksheet and looking at the second example. So, in partial atonement ...
I wasn't sure, upon reading it, what "all true" meant, since some of the values are just empty strings, but Soln_1 is true.
So, I defined a predicate function "all.x?" that checks for all one value or a set of values.
Stuart
