Ask Your Question
0

How to create a symbolic arbitrary dimensional zero vector?

asked 2013-11-05 22:40:35 -0500

gundamlh gravatar image

updated 2013-11-12 05:54:22 -0500

one way:

sage: symbolic_expression(list(zero_vector(k))) 
# k, dim. of vector, k is some fixed integer, e.g. k = 10, 
# many thanks to @tmonteil 

but it is too long!!

edit retag flag offensive close merge delete

Comments

Can you make your wish more explicit ? Is k a fixed number ? Wich order of magnitude ?

tmonteil gravatar imagetmonteil ( 2013-11-05 23:11:46 -0500 )edit

Sorry, it is some fixed integer, e.g. k = 10

gundamlh gravatar imagegundamlh ( 2013-11-06 01:28:14 -0500 )edit

what do you mean by "it is too long" ?

tmonteil gravatar imagetmonteil ( 2013-11-06 02:06:53 -0500 )edit

the length of the string "symbolic_expression(list(zero_vector(k)))", can we use some command like "zero_list(k)"?

gundamlh gravatar imagegundamlh ( 2013-11-06 02:30:27 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-11-06 02:12:59 -0500

tmonteil gravatar image

You can make your expression shorter by typing:

sage: w = zero_vector(SR, 10) ; w
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)

You can check that it is the same object:

sage: v = symbolic_expression(list(zero_vector(10)))
sage: v
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
sage: v == w
True
edit flag offensive delete link more

Comments

Thanks! Yes, that is what I want! SR = Symbolic Ring, super.

gundamlh gravatar imagegundamlh ( 2013-11-06 02:32:38 -0500 )edit

Can we create a list whose entries are all 1, using a similar method?

gundamlh gravatar imagegundamlh ( 2013-11-13 03:10:51 -0500 )edit

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2013-11-05 22:40:35 -0500

Seen: 205 times

Last updated: Nov 12 '13