# Problem regarding user input in Sage manifolds

I am unable to take input from user in case of sage manifold,i am working in differentiable manifold.Especially,I am having problem to take input from user in case of vector fields(differentiable manifold) Any help is appreciated

edit retag close merge delete

1

In order to get help you need:

1. to give details about your operating system and your Sage installation
2. describe precisely your problem
3. provide some code snippet
( 2017-07-15 13:30:55 +0200 )edit

My operating system is windows and i am executing sage software 7.6 using sage manifold appliance (virtual box) My problem is t I am unable to take raw_input from user(just like python) for vector field on a 5 dimensional manifold. The code snippet is as follows M = Manifold(5, 'M') X.<a,b,c,d,e> = M.chart() v = M.vector_field(name='v') eU = X.frame() v[eU,:]=raw_input("enter a value") print v[0]

( 2017-07-15 17:09:41 +0200 )edit

Sort by ยป oldest newest most voted

Note that the raw input captures a string from the user - in my case from the sage interpreter:

sage: a = raw_input( "Please enter a number... >" )
Please enter a number... >7
sage: a
'7'


The code has to arrange that the input is parsed correctly. For the posted case an evaluation would be enough, if the user raw input is prepared to be evaluated. Note for this the example:

sage: eval( '17, 5, 22, 196544, -1' )
(17, 5, 22, 196544, -1)
sage: type( _ )
<type 'tuple'>


Slightly changed code:

M = Manifold(5, 'M')
X.<a,b,c,d,e> = M.chart()
v = M.vector_field(name='v')
eU = X.frame()
v[eU,:] = eval( raw_input( "enter five numbers (comma separated) > " ) )
print "eU =", eU
print "v[ eU, : ] =", v[eU,:]


Let's see it it works, code was copy-pasted into the sage interpreter via %cpaste:

sage: %cpaste
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
:M = Manifold(5, 'M')
X.<a,b,c,d,e> = M.chart()
v = M.vector_field(name='v')
eU = X.frame()
v[eU,:] = eval( raw_input( "enter five numbers (comma separated) > " ) )
print "eU =", eU
print "v[ eU, : ] =", v[eU,:]
:::::::
:--
enter five numbers (comma separated) > 17, 5, 22, 196544, -1
eU = Coordinate frame (M, (d/da,d/db,d/dc,d/dd,d/de))
v[ eU, : ] = [17, 5, 22, 196544, -1]
sage:

more

thank you,its working

( 2017-07-15 18:48:12 +0200 )edit