answersLogoWhite

0


Best Answer

Generally vectors are displayed in parenthesis with the vector components separated by a comma. If there are vectors within another vector then brackets are used for the internal vector.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you display the elements in a vector to the user?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Math & Arithmetic

How would I add numbers input by a user one at a time into a vector in MATLAB I have the loop set up but don't know how to add the data into the vector?

First, make sure your vector is initialized outside of the loop. Then, within your loop you need to update the vector. If you want data entered by the user only, you should initialize with an empty vector. Example program (not sure which loop you're using, but I'll use a while loop here): vector=[]; user='y'; while user=='y' user=input('Enter another variable? Type y for yes and n for no: '); if user=='n' break end var=input('Please input variable: '); vector=[vector, var]; end The key part in this coding is the line: >> vector=[vector,var]; as this will update your vector with the previous vector values, and then add another value to the vector with whatever number var is. Hope this helps!


How do you find the vector sum and vector difference of the two vector quantities?

Element by element. That is: Sum all the first elements to get the first element of the result; Sum all the second elements to get the second element of the result...The vector sum is obtained by adding the two quantities. The vector difference is obtained by subtracting one from the other. Hint: 'sum' always means addition is involved, 'difference' always means subtraction is involved.* * * * *That is the algebraic answer. There is also a geometric answer.To sum vectors a and b, draw vector a. From the tip of vector a, draw vector b. Then a + b is the vector from the base of a to the tip of b. To calculate a - b, instead of drawing b,draw the vector -b, which is a vector of the same magnitude as b but going in the opposite direction.


Can a vector be represented in terms of unit vector?

Yes, a vector can be represented in terms of a unit vector which is in the same direction as the vector. it will be the unit vector in the direction of the vector times the magnitude of the vector.


Can a vector space have exactly two distinct vectors in it?

No.A vector space is a set over a field that has to satisfy certain rules, called axioms. The field in question can be Z2 (see discussion), but unlike a field, a vector's inverse is distinct from the vector. Therefore, in order to satisfy the "inverse elements of addition" axiom for vector spaces, a vector space must minimally (except if it is the null space) have three vectors, v, 0, and v-1. The null space only has one vector, 0.Field's can allow for two distinct elements, unlike vector spaces, because for any given element of a field, for example a, a + (-a) = 0 meets the inverse axiom, but a and -a aren't required to be distinct. They are simply scalar magnitudes, unlike vectors which can often be thought of as having a direction attached to them. That's why the vectors, v and -v are distinct, because they're pointing in opposite directions.


Is vector A parallel vector B given that vector A is equal to the zero vector and vector B is equal to the zero vector?

The zero vector is both parallel and perpendicular to any other vector. V.0 = 0 means zero vector is perpendicular to V and Vx0 = 0 means zero vector is parallel to V.

Related questions

Using vector to add objects and display their member variables?

import java.util.Vector; suppose-:::: test t=new test(); /**this is how we add elements to vector*/ Vector v=new Vector(); v.addElements(t);


How would I add numbers input by a user one at a time into a vector in MATLAB I have the loop set up but don't know how to add the data into the vector?

First, make sure your vector is initialized outside of the loop. Then, within your loop you need to update the vector. If you want data entered by the user only, you should initialize with an empty vector. Example program (not sure which loop you're using, but I'll use a while loop here): vector=[]; user='y'; while user=='y' user=input('Enter another variable? Type y for yes and n for no: '); if user=='n' break end var=input('Please input variable: '); vector=[vector, var]; end The key part in this coding is the line: >> vector=[vector,var]; as this will update your vector with the previous vector values, and then add another value to the vector with whatever number var is. Hope this helps!


What does vector's member size() do?

The vector size() member returns the current size of the vector, in elements.


What does push back() do to a vector in c plus plus?

The vector's push_back() member inserts one or more new elements at the end -- the back -- of the vector. If there are insufficient unused elements available, the underlying array is reallocated with a larger reserve and the existing elements moved to the new allocation, after which the new elements are appended. All iterators into the vector are rendered invalid after a reallocation.


When does Defense Travel System display the user activation screen?

Only the first time the user logs in to DTS does the Defense Travel System display the user activation screen.


What is the display screen that the user interacts with?

Monitor


When the size of vetor is fixed in c plus plus?

The size of a vector cannot be fixed because a vector is a wrapper for a dynamic array where resizing occurs automatically (by virtue of the vector class). So, even if you reserved enough memory for n elements in advance, the vector will resize automatically as soon as you push more than n elements. A normal dynamic array does not resize automatically (you have to manually resize the array in order to accommodate more elements than you've allowed), and is therefore more suitable for a fixed size dynamic array. However, if you embed a vector in your own class wrapper (such as fixed_vector), you can reserve n elements in the vector via the constructor, and subsequently control how many elements are pushed onto the vector. Once n elements are pushed, any subsequent elements can be ignored, perhaps raising an exception for added safety.


What is inventory displayer c plus plus?

// Inventory Displayer // Demonstrates constant references #include <iostream> #include <string> #include <vector> using namespace std; //parameter vec is a constant reference to a vector of strings void display(const vector<string>& vec); int main() { vector<string> inventory; inventory.push_back( "sword"); inventory.push_back( "armor"); inventory.push_back( "shield"); display(inventory); return 0; } //parameter vec is a constant reference to a vector of strings void display(const vector<string>& vec) { cout << "Your items:\n"; for (vector<string>::const_iterator iter = vec.begin(); iter != vec.end(); ++iter) { cout << *iter << endl; } }


Which display device is suited for cad system a a crt with vector referesh monitor b crt with raster scan monitor c plasma panel display d led display?

a


How can you convert ArrayList to Vector?

Both of these types of Collections allow for a new instance to be created with the contents of another Collection. // This method will accept a Vector and return a new ArrayList which contains all elements of that Vector static ArrayList toArrayList(Vector v) { return new ArrayList(v); } // This method will accept an ArrayList and return a new Vector which contains all elements of that ArrayList static Vector toArrayList(ArrayList al) { return new Vector(al); }


What is a zero vector?

A zero vector is a vector whose elements are all zero. It has no direction or magnitude, and does not change the position of any point it is added to. In mathematics, it is often denoted as 0.


What is a profile name?

The user profile name identifies the user to the server. This user profile name is also known as the user ID. It is the name the user types in the User prompt on the Sign On display.