1 | initial version |
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: