I am having trouble finding a solution to this. Using numpy arrays, I wanna multiply a 3x1 array with 1x3 array, and as a result end up with 3x3 array. Since dot function assumes the first element as column vector and the second as row vector, I cannot get it working. This is what I am using

A=array([1,2,3])
print "Amat=",dot(A,A)
print "A2mat=",dot(A.transpose(),A)
print "A3mat=",dot(A,A.transpose())
u2=mat([ux,uy,uz])
print "u2mat=", u2.transpose()*u2  

And the output

Amat= 14
A2mat= 14
A3mat= 14
u2mat=
[[ 0.  0.  0.]
[ 0.  0.  0.]
[ 0.  0.  1.]]
Aug 2, 2022 in Python 667 views

## How to do Matrix Multiplication in python?

def matmult(a,b): zip_b = ...READ MORE

## what is the practical use of polymorphism in Python?

Polymorphism is the ability to present the ...READ MORE

## Use of "continue" in python

The break statement is used to "break" ...READ MORE

+1 vote

## Count the frequency of an item in a python list

To count the number of appearances: from collections ...READ MORE

## How can I find out the index of an element from row and column in Python?

You probably want to use np.ravel_multi_index: [code] import numpy ...READ MORE