#1956: implement multivariate truncated power series arithmetic
-------------------------------------------+--------------------------------
   Reporter:  was                          |       Owner:  pernici              
    
       Type:  enhancement                  |      Status:  needs_work           
    
   Priority:  major                        |   Milestone:  sage-4.7             
    
  Component:  commutative algebra          |    Keywords:  multivariate power 
series
     Author:  Niles Johnson                |    Upstream:  N/A                  
    
   Reviewer:  Martin Albrecht, Simon King  |      Merged:                       
    
Work_issues:                               |  
-------------------------------------------+--------------------------------

Comment(by niles):

 Replying to [comment:97 niles]:
 > Replying to [comment:96 hlaw]:

 > > There seems to be a problem with how coercion/evaluation works between
 two multivariate power series rings when the number of variables in each
 differs.

 I tracked down this bug -- it was unique to the case where one of the
 power series rings is univariate, and comes from the fact that
 (univariate) power series rings automatically convert any univariate power
 series from a given variable to another:

 {{{
 sage: R.<a> = PowerSeriesRing(ZZ)sage: S.<b> = PowerSeriesRing(ZZ)
 sage: b in R
 False
 sage: R.has_coerce_map_from(S)
 False
 sage: R(b)
 a
 }}}

 I was thinking this should be filed as a separate bug, but polynomials
 have the same behavior, so perhaps it is intentional.  In any case, I've
 fixed multivariate power series to take this into account, so an error is
 raised when the variables don't match:

 {{{
 sage: B.<s, t> = PowerSeriesRing(QQ)
 sage: C.<z> = PowerSeriesRing(QQ)
 sage: B(z)
 ...
 TypeError: Cannot coerce input to polynomial ring.
 }}}

 > > Another problem, possibly related, is the following...

 I also implemented a `._subs_formal` method, which is called automatically
 by `.__call__`.  This method substitutes *anything* into the power series,
 requiring only that multiplication and exponentiation be defined for the
 inputs.  This gives all of the "expected" results from above.  Some
 further examples (from the new doctests):
 {{{
 sage: B.<s, t> = PowerSeriesRing(QQ)
 sage: C.<z> = PowerSeriesRing(QQ)
 sage: s(z,z)
 z

 sage: f = -2/33*s*t^2 - 1/5*t^5 - s^5*t + s^2*t^4
 sage: f(z,z)
 -2/33*z^3 - 1/5*z^5
 sage: f(z,1)
 -1/5 - 2/33*z + z^2 - z^5
 sage: RF = RealField(10)
 sage: f(z,RF(1))
 -0.20 - 0.061*z + 1.0*z^2 - 0.00*z^3 - 0.00*z^4 - 1.0*z^5

 sage: m = matrix(QQ,[[1,0,1],[0,2,1],[-1,0,0]])
 sage: m
 [ 1  0  1]
 [ 0  2  1]
 [-1  0  0]
 sage: f(m,m)
 [     2/33         0       1/5]
 [   131/55 -1136/165    -24/11]
 [     -1/5         0   -23/165]
 sage: f(m,m) == -2/33*m^3 - 1/5*m^5
 True

 sage: f = f.add_bigoh(10)
 sage: f(z,z)
 -2/33*z^3 - 1/5*z^5 + O(z^10)
 sage: f(m,m) # cannot substitute arbitrary elements when f has finite
 precision
 Traceback (most recent call last):
 ...
 AttributeError: 'sage.matrix.matrix_rational_dense.Matrix_rational_dense'
 object has no attribute 'add_bigoh'
 }}}

 Please test it out and let me know how it goes!
 -Niles

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/1956#comment:98>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to