I’m reading the VMLS book introduction about algebra linear and trying to draw the vector displacement in a plot. When sum two vectors a and b, the a+b vector dont need to connect to the end of b as shown in the book?

In my experiments the a+b vector crosses the b vector

function sumsdisp2(a::Vector, b::Vector)
if (length(a) != 2) || (length(b) != 2)
error("This function only works with 2d vectors");
end
ab = a + b;
plot([0, a[1]], [0, a[2]], arrow=true, label="a");
plot!([a[1], b[1]], [a[2], b[2]], arrow=true, label="b");
plot!([0, ab[1]], [0, ab[2]], arrow=true, label="a+b");
end

I’m not sure how you produced your example plot (I can’t get your output from various input vectors), but here’s how to do it with quiver, which is the Plots function for plotting vector fields:

It looks like in your example you added the result of a + b to a, rather than adding b (you get to [3, 4] which is [1, 2] + [2, 2] instead of [1, 2] + [1, 0] which I think is what you were trying to do)

The book doesn’t give the vectors values, only the values. Then I’m trying to reproduce ploting, but have another thing that im not seeing in the process.

It worked. I’ll read more about quiver function in documentation. But what I notice is quiver maintains the vector magnitude when ploting above the origin (0, 0). Thank you.