| 1 | initial version |
You can define all variables but x4 as symbolic and then define a power series ring in variable x4 over the symbolic ring with the default precision 8, the coefficient of x4^7 is then simply g[7]:
var('x1 x2 x3 w1 w2 w3 w4 w5 w6')
R.<x4> = PowerSeriesRing(SR,default_prec=8)
g = ... # copy your expression here
print( g[7] )
| 2 | No.2 Revision |
You can define all variables but x4 as symbolic and then define a power series ring in variable x4 over the symbolic ring with the default precision 8, 8 (or anything at least one more than the power of the required coefficient), the coefficient of x4^7 is then simply g[7]:
var('x1 x2 x3 w1 w2 w3 w4 w5 w6')
R.<x4> = PowerSeriesRing(SR,default_prec=8)
g = ... # copy your expression here
print( g[7] )
| 3 | No.3 Revision |
You can define all variables but x4 as symbolic and then define a power series ring in variable x4 over the symbolic ring with the default precision 8 (or anything at least one more than the power of the required coefficient), the coefficient of x4^7 is then simply g[7]:
var('x1 x2 x3 w1 w2 w3 w4 w5 w6')
R.<x4> = PowerSeriesRing(SR,default_prec=8)
g = ... # copy your expression here
print( g[7] )
ADDED. From discussion with @Emmanuel Charpentier in the comments: in the setup of the code given in the question, the following addition will do the job:
...
R1.<p4> = PowerSeriesRing(SR,default_prec=8)
print( eval(preparse(str(g).replace('x4','p4')))[7] )
| 4 | No.4 Revision |
You can define all variables but x4 as symbolic and then define a power series ring in variable x4 over the symbolic ring with the default precision 8 (or anything at least one more than the power of the required coefficient), the coefficient of x4^7 is then simply g[7]:
var('x1 x2 x3 w1 w2 w3 w4 w5 w6')
R.<x4> = PowerSeriesRing(SR,default_prec=8)
g = ... # copy your expression here
print( g[7] )
ADDED. From discussion with @Emmanuel Charpentier in the comments: in the setup of the code given in the question, the following addition will do the job:
...
R1.<p4> = PowerSeriesRing(SR,default_prec=8)
print( eval(preparse(str(g).replace('x4','p4')))[7] )
It does not require re-defining x4 as power-series variable.
| 5 | No.5 Revision |
You can define all variables but x4 as symbolic and then define a power series ring in variable x4 over the symbolic ring with the default precision 8 (or anything at least one more than the power of the required coefficient), the coefficient of x4^7 is then simply g[7]:
var('x1 x2 x3 w1 w2 w3 w4 w5 w6')
R.<x4> = PowerSeriesRing(SR,default_prec=8)
g = ... # copy your expression here
print( g[7] )
ADDED. From discussion with @Emmanuel Charpentier in the comments: in the setup of the code given in the question, the following addition will do the job:
R1.<p4> = PowerSeriesRing(SR,default_prec=8)
print( eval(preparse(str(g).replace('x4','p4')))[7] )
It does not require re-defining x4 as a power-series variable.variable, but rather introduces a new variable p4 for that purpose.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.