Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hello,
How to turn this column vector intro a line vector (like shown below)?
Mathcad Prime 8 file attached.
Solved! Go to Solution.
How to deal with this comment in green?
In this case, you accept it, because you do redefine the vector d purposely.
It's just a warning, not an error.
Success!
Luc
You do that with the transpose operator, like you did.
But you have to do it on the vector, not on a range.
the vector is a, not an.
So remove that [n from a under the transpose and it works.
Explanation:
You created the vector a in a neat, regular, legal way, using the range n.
To show the vector a, all you need to do is type
a=
and it will show the column vector.
You typed
an=
which appears to show the same, but Prime interprets as something else. It takes the vector a, and apples the range n, and displays for each of the values of the range n, the corresponding element of a. And the displayed result looks just the same as when it shows the vector a.
Success!
Luc
According row vector:
According the green redefinition warning:
It appears because you are changing the value of "d". As this is exactly what you intend, you may ignore that warning.
You may also consider turning off these warnings
Case 1:
Case 2:
According to calculation:
So, I need to put ORIGIN=1 in order for first element to be equal with 2, with the real a1 value, even that I defined n = 1, 2...10, so the first element of n is 1. Why is this difference?
EDIT:
An ORIGIN-independent approach to create a vector with the first 10 values:
or a different approach using a vector n:
Using explicit vectorization is not mandatory in this case, but might be in case of different calculations.
Of course you can also turn the range into a vector using that undocumented trick with the inline evaluation:
"So, I need to put ORIGIN=1 in order for first element to be equal with 2, with the real a1 value, even that I defined n = 1, 2...10, so the first element of n is 1. Why is this difference?"
When you define a range:
n := 1,2..10
you define sort of a counter, that counts from 1 to 10.
You can use it to create vector elements, by using n as the index, to point to individual vector elements.
So when you assign
an := 3+(-1)^n
you first assign a1, then a2, and so further until a10.
but if ORIGIN=0, then the very first element of every vector will be the one with index 0, so a0, is created (automatically) when a1 is created.
In short, your definition of a range that you use to fill vector elements is independent of ORIGIN, the index of the first element of the array.
If ORIGIN=2, then your range for n will cause an error at the assignment an := 3+(-1)^n, simply because a1 cannot exist. With ORIGIN=2, the first element of the array is a2.
Hope this helps.
Success!
Luc