Skip to main content
12-Amethyst
February 11, 2016
Question

Flip or swap a vector

  • February 11, 2016
  • 4 replies
  • 8764 views

Hi,

a very simple problem:

I want to flip a vector, that means reverse the sequence of its elements for example (1,2,3)  -->  (3,2,1). I tried several methods, none works really.

The problem is, the result vector seems to be ok, but if I use it in other expressions together with the vectorize operator MathCad says always this value has to be a vector.

FlipVector.gif

I am using Prime 3.0. Thanks


4 replies

24-Ruby IV
February 11, 2016

There is a built-in function. Or you would like to create own one?

Manfred_F12-AmethystAuthor
12-Amethyst
February 11, 2016

Hi Valery,

sorry didn't know this function. but the problem stays the same. The only workaround I found by now is to assign a variable and then use the vectorize operation. Seems that the vectorize operator somehow does not work on functions, which have a vector as result?


23-Emerald I
February 11, 2016

"vectorize" means "take the vectors under the arrow apart and do this operation on each element, leave the result in a vector with the same number of elements.."

When you vectorize your function, Mathcad takes the first element of the vector and tries to sort it into three parts--it can't

Besides, there's a command "reverse"

24-Ruby IV
February 11, 2016

Fred Kohlhepp написал(а):

"vectorize" means

One good example

4-Participant
September 30, 2022

R_10006357_0-1664514073037.png