Skip to main content
19-Tanzanite
May 1, 2024
Solved

This value must be a vector in MPC10

  • May 1, 2024
  • 2 replies
  • 5743 views

Hi,

Seems that Mathcad Prime 10 does not allow anymore this. How to do in this case?

Cornel_1-1714575888045.png

Best answer by Werner_E

I already mention the fact that this undocumented trick does not work anymore in a former thread and provided a range2vec function.

But of course it would be easier to use a function which creates the vector right ahead.

But to quickly fix older worksheets the function may come handy.

Werner_E_0-1714590661605.png

 

In the past many functions which would create a vector were posted now and then. Some follow the syntax of a range definition and require the user to provide first, second and last value. Due to numerical round-off errors some of those functions suffer from the problem that the number of elements is calculated wrong and the last value is missing.

 

See here why "rangevec" fails with your example:

Werner_E_1-1714592098737.png

 

You may have the idea to use "round" instead of floor, but this would yield wrong results in other cases. For example

Werner_E_2-1714591630224.png

 

BTW, on contrary to Luc I won't call it an improvement when a convenient, but undocumented feature is ditched without providing an at least equally convenient official, 'legal' replacement - either for turning a range into a vector or for quickly creating the desired vector right ahead.

 

2 replies

Cornel19-TanzaniteAuthor
19-Tanzanite
May 1, 2024

Cornel_0-1714576985272.png

Cornel19-TanzaniteAuthor
19-Tanzanite
May 1, 2024

Here maybe is how to replicate this range definition:

Cornel_0-1714579159076.png
Being also interested in how a linspace function could be defined in Mathcad prime as I saw that it does not exist, I came across an older topic:
https://community.ptc.com/t5/Mathcad/Does-anyone-know-how-to-plot-something-like-this-in-mathcad/td-p/59034 

Cornel_1-1714579312390.png

 

But what I do not like at this program is that step is defined as something like below with x starting value, y ending value and z step. How could this program (or another create another program, this program is example that I could find) be changed in order that the step z to be defined as z-x. Or how could this program be changed in order to have linspace(x,y,z) as is the case of step range defined default be mathcad, with x starting value, specified step y-x, and ending value z?

Cornel_5-1714579814092.png

Cornel19-TanzaniteAuthor
19-Tanzanite
May 1, 2024

Something like that as linspace function seems to work better than step range defined by mathcad operator even in mathcad prime 9 (without the need to show t1 step range):

Cornel_1-1714580756925.png

Cornel_0-1714581145543.png

 

And what will be good is how to redefine linspace function as step range:

Cornel_5-1714580885667.png

Right now is not good:

Cornel_6-1714580914166.png

Werner_E25-Diamond IAnswer
25-Diamond I
May 1, 2024

I already mention the fact that this undocumented trick does not work anymore in a former thread and provided a range2vec function.

But of course it would be easier to use a function which creates the vector right ahead.

But to quickly fix older worksheets the function may come handy.

Werner_E_0-1714590661605.png

 

In the past many functions which would create a vector were posted now and then. Some follow the syntax of a range definition and require the user to provide first, second and last value. Due to numerical round-off errors some of those functions suffer from the problem that the number of elements is calculated wrong and the last value is missing.

 

See here why "rangevec" fails with your example:

Werner_E_1-1714592098737.png

 

You may have the idea to use "round" instead of floor, but this would yield wrong results in other cases. For example

Werner_E_2-1714591630224.png

 

BTW, on contrary to Luc I won't call it an improvement when a convenient, but undocumented feature is ditched without providing an at least equally convenient official, 'legal' replacement - either for turning a range into a vector or for quickly creating the desired vector right ahead.

 

Cornel19-TanzaniteAuthor
19-Tanzanite
May 1, 2024

Ok, I see. If someone will find also how to modify the above posted linspace() function in order to have same behaviour as step range operator and to see how will work also this linspace function, then will be also good. Anyway is ok so far either with range2vect() function.

Cornel_0-1714591638880.png

Cornel_1-1714591657590.png