How to turn a column vector into a line vector when the number was defined as a sequence?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
How to turn a column vector into a line vector when the number was defined as a sequence?
Hello,
How to turn this column vector intro a line vector (like shown below)?
Mathcad Prime 8 file attached.
Solved! Go to Solution.
- Labels:
-
Calculus_Derivatives
-
Mathcad Usage
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
How to deal with this comment in green?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
In this case, you accept it, because you do redefine the vector d purposely.
It's just a warning, not an error.
Success!
Luc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
"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
