On Dec 4, 2007, at 5:09 AM, fwc wrote:

>>> 1)  Taylor series of a rational function.
>>
>>> This works:
>>> sage: cos(x).taylor(x,0,2)
>>
>>> This doesn't:
>>> sage: x/(1+x).taylor(x,0,2)
>>
>>> This is very confusing:
>
>> This is due to the fact that '.' binds tighter than '/'.  For  
>> example,
>> sage: x/(1+x).taylor(x,0,2)
>> x/(x + 1)
>> sage: x/((1+x).taylor(x,0,2))
>> x/(x + 1)
>> sage: (x/(1+x)).taylor(x,0,2)
>> x - x^2
>>
>> In Sage, "(x/(1+x))" creates an object and the you call the taylor()
>> method on that object.
>
> Mathematica has the advantage that Series creates a truncated series
> object rather than a polynomial.  Thus it doesn't matter whether the
> division is done before or after:
>
> sage: mathematica("x/Series[1+x, {x, 0, 1}]")
> SeriesData[x, 0, {1, -1}, 1, 3, 1]
> sage: mathematica("Series[x/(1+x), {x, 0, 2}]")
> SeriesData[x, 0, {1, -1}, 1, 3, 1]

Hmmmm this is an excellent point. We do have a PowerSeriesRing which  
can keep track of where you truncated to, but it's only used in a  
more strictly algebraic setting, it's not really part of the symbolic  
calculus package. Is it possible for the symbolic calculus package to  
do something similar to this? What about creating a PowerSeriesRing  
with the SymbolicExpressionRing as the base ring?


sage: R.<z> = PowerSeriesRing(SymbolicExpressionRing)
------------------------------------------------------------------------ 
---
<type 'exceptions.TypeError'>             Traceback (most recent call  
last)

/Users/david/<ipython console> in <module>()

/Users/david/sage-2.8.14/local/lib/python2.5/site-packages/sage/rings/ 
power_series_ring.py in PowerSeriesRing(base_ring, name,  
default_prec, names, sparse)
     171         R = PowerSeriesRing_generic(base_ring, name,  
default_prec, sparse=sparse)
     172     else:
--> 173         raise TypeError, "base_ring must be a commutative ring"
     174     _cache[key] = weakref.ref(R)
     175     return R

<type 'exceptions.TypeError'>: base_ring must be a commutative ring


Well maybe not....

Would be nice though....

david


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to