Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do I create a vector from the difference between two points?

Having points $a$ and $b$, how do I create a vector that goes from $a$ to $b$? I'm trying the following but I get an error:

a=[(1,0,0)]
b=[(0,-1,0)]
u=vector(b-a)

The error is

File "/tmp/tmpoTA_jw/___code___.py", line 6, in <module> exec compile(u'u=vector(b-a) File "", line 1, in <module> TypeError: unsupported operand type(s) for -: 'list' and 'list'

How do I create and plot a vector from the difference between two points?

Having points $a$ and $b$, how do I create a vector that goes from $a$ to $b$? I'm trying the following but I get an error:

a=[(1,0,0)]
b=[(0,-1,0)]
u=vector(b-a)

Then, how do I plot $a$, $b$ and $u$ at the position of $a$? The error is

File "/tmp/tmpoTA_jw/___code___.py", line 6, in <module> exec compile(u'u=vector(b-a) File "", line 1, in <module> TypeError: unsupported operand type(s) for -: 'list' and 'list'