Skip to main content
added 263 characters in body
Source Link
H. Kenan
  • 663
  • 6
  • 13

I have this simple example in which I am trying to write a column vector (ket vector) and then I want to normalize it. It seems that ther is something wrong, leading to an error message

"The first argument is not a number or a vector,... "

 myVec = {{1}, {2}};
Normalize[myVec]

How can one fix this. What is the best way of writing a ket vector and bra vector in Mathematica?

Edit: Related to some comments below, I want to added the following:

 mat1 = {{1}, {2}};
Dimensions[mat1](*(2,1)*)

    mat2 = {{1, 2}};
Dimensions[mat2](*(1,2)*)

    mat3 = {1, 2};
Dimensions[mat3](*(2)*)

I have this simple example in which I am trying to write a column vector (ket vector) and then I want to normalize it. It seems that ther is something wrong, leading to an error message

"The first argument is not a number or a vector,... "

 myVec = {{1}, {2}};
Normalize[myVec]

How can one fix this. What is the best way of writing a ket vector and bra vector in Mathematica?

I have this simple example in which I am trying to write a column vector (ket vector) and then I want to normalize it. It seems that ther is something wrong, leading to an error message

"The first argument is not a number or a vector,... "

 myVec = {{1}, {2}};
Normalize[myVec]

How can one fix this. What is the best way of writing a ket vector and bra vector in Mathematica?

Edit: Related to some comments below, I want to added the following:

 mat1 = {{1}, {2}};
Dimensions[mat1](*(2,1)*)

    mat2 = {{1, 2}};
Dimensions[mat2](*(1,2)*)

    mat3 = {1, 2};
Dimensions[mat3](*(2)*)
Source Link
H. Kenan
  • 663
  • 6
  • 13

Normalize a vector: error

I have this simple example in which I am trying to write a column vector (ket vector) and then I want to normalize it. It seems that ther is something wrong, leading to an error message

"The first argument is not a number or a vector,... "

 myVec = {{1}, {2}};
Normalize[myVec]

How can one fix this. What is the best way of writing a ket vector and bra vector in Mathematica?