If you want elementwise division you have to use the ./ operator. Then each element gets divided by the corresponding element in the other vector.
On Wednesday, February 5, 2014 8:16:42 AM UTC+1, Andreas Noack Jensen wrote: > > I different framing of Kevin's answer could be that it solves your systems > of equations: three systems of one equation in three variables > > julia> x=a/b > 3x3 Array{Float64,2}: > 0.0519481 0.0649351 0.0779221 > 0.103896 0.12987 0.155844 > 0.155844 0.194805 0.233766 > > > julia> x*b > 3-element Array{Float64,1}: > 1.0 > 2.0 > 3.0 > > The solutions are not unique and Julia chooses those with minimum norm. > > 2014-02-05 Kevin Squire <kevin....@gmail.com <javascript:>>: > > > > Hello Fil, > > > > Generally, division is like multiplying by the inverse of the divisor. > For vectors, the inverse is actually a pseudoinverse or generalized > inverse. In this case, > > > > a / b = a * pinv(b) > > > > where > > > > julia> pinv(b) > > 1x3 Array{Float64,2}: > > 0.0519481 0.0649351 0.0779221 > > > > julia> pinv(b) * b > > 1-element Array{Float64,1}: > > 1.0 > > > > julia> a * pinv(b) # the outer product of a and pinv(b) > > 3x3 Array{Float64,2}: > > 0.0519481 0.0649351 0.0779221 > > 0.103896 0.12987 0.155844 > > 0.155844 0.194805 0.233766 > > > > Cheers! > > Kevin > > > > > > On Tue, Feb 4, 2014 at 9:19 PM, Fil Mackay > > <f...@vertigotechnology.com<javascript:>> > wrote: > >> > >> Can anyone explain what's going on here? :) > >> > >> julia> a = [1,2,3] > >> 3-element Array{Int64,1}: > >> 1 > >> 2 > >> 3 > >> > >> julia> b = [4,5,6] > >> 3-element Array{Int64,1}: > >> 4 > >> 5 > >> 6 > >> > >> julia> a / b > >> 3x3 Array{Float64,2}: > >> 0.0519481 0.0649351 0.0779221 > >> 0.103896 0.12987 0.155844 > >> 0.155844 0.194805 0.233766 > >> > >> I get the principle of how two vectors (3x) lead to a matrix (3x3) > result - but the actual values are a mystery? > >> > > > > > > -- > Med venlig hilsen > > Andreas Noack Jensen >