Ask Your Question

Point -> Vector to a point

asked 2019-04-06 17:10:33 -0600

thetha gravatar image

updated 2020-06-26 07:57:24 -0600

FrédéricC gravatar image

Hello everyone,

If i have point in 3D


How to create a vector from the origin to the point. I know i could define the vector. But I would rather have a point, for plotting reasons

And i would like to plot the Point and the Vector, with automatic labeling of the coordinates.

I have managed to do this like:

from sage.plot.plot3d.shapes2 import frame3d

t = var('t')
p = vector([4,3,2])
q = vector([0,0,0])
vec=parametric_plot3d(p*t+q, (t,0,1))

T_A = text3d('A',eps)
#T_B = text3d('B',B)

Is there any better, way to do it?

Here is the file:

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2019-04-07 08:37:40 -0600

eric_g gravatar image

updated 2019-04-07 08:57:56 -0600

Like this:

E = EuclideanSpace(3)
A = E.point((4,3,2), name='A')
v = E.tangent_space(A)((1,2,1), name='v')  # a vector at A
A.plot(size=20, color='red', opacity=0.5) + v.plot(color='green')
  • Remark 1: the command A = E.point((4,3,2), name='A') can be shorten to A = E((4,3,2), name='A') (this notation reflects SageMath's parent/element framework, points being elements of the Euclidean space E)
  • Remark 2: the notation E.tangent_space(A)((1,2,1)) arises from differential geometry; it simply means the vector of components (1,2,1) whose origin is A.

For more details and examples see

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-04-06 17:10:33 -0600

Seen: 260 times

Last updated: Apr 07 '19