#10519: analytic combinatorics: new code for computing asymptotics for
multivariate
generating functions
-----------------------------+----------------------------------------------
Reporter: araichev | Owner: sage-combinat
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-4.7.1
Component: combinatorics | Keywords: analytic combinatorics,
multivariate generating functions, asymptotics
Work_issues: | Upstream: N/A
Reviewer: | Author: Alex Raichev
Merged: | Dependencies:
-----------------------------+----------------------------------------------
Comment(by hivert):
Hi Alex,
> I thought this might be because amgf.sage is a Sage file and not a
Python
> file. So i renamed it amgf.py instead and got syntax errors. What's up
with
> that? Do i have to rewrite all my code in Python instead of Sage?
The basic answer is yes, but Rewriting is a big word for what is really
needed. There is little work to do since Sage mostly follows Python
syntax.
The two main difference are handling of integer (see
http://www.sagemath.org/doc/tutorial/afterword.html), and the necessity to
import what you need.
== Handling of integer ==
- Notation for exponentiation: In Python {{{**}}} means exponentiation
and
{{{^}}} means “xor”.
- If you need to return an integer for the user, write it return
{{{Integer(1)}}} instead of return 1. In Python 1 is a machine integer
{{{int}}} (32 or 64 bits depending on your machine) and
{{{Integer(1)}}} is
a Sage/Gmp arbitrary precision integer. Also {{{Integer}}} are much
more
powerful than {{{int}}}, for example they know about prime and
factorization.
== Importing stuff ==
The second big change is the necessity to import all what you need. More
precisely, each time you use some Sage function, you need to import it at
the
beginning of the file. for example if you want to you
{{{PolynomialRing}}},
you need to write
{{{
from sage.rings.polynomial.polynomial_ring_constructor import
PolynomialRing
}}}
You can ask Sage where to find PolynomialRing using:
{{{
sage: PolynomialRing.__module__
'sage.rings.polynomial.polynomial_ring_constructor'
}}}
This also correspond to the path starting after {{{site-packages}}}
given when you are asking Sage for
{{{PolynomialRing}}} help:
{{{
sage: PolynomialRing?
Type: function
[...]
File: /home/florent/src/Sage/sage/local/lib/python2.6/site-
packages/sage/rings/polynomial/polynomial_ring_constructor.py
[...]
}}}
I hope this helps,
Florent
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10519#comment:12>
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.