Hi,
On Fri, Mar 26, 2010 at 6:19 PM, dabu <[email protected]> wrote:
<SNIP>
> Is it possible to use these two packages simultaneous ?
Yes. You just need to be careful about how you import modules in
Python. Doing import like so
sage: from scipy import *
sage: from sympy import *
would import all top-level modules of both SciPy and SymPy. This could
result in name clashes. For example, if there is scipy.foo and
sympy.foo, the name clash is in whether you are referring to foo of
SciPy or SymPy. In general, avoid import statements of the form
from foo import *
unless you have a very good reason to do so. A workaround for the
problem you reported above could be as follows:
[mv...@sage ~]$ sage
----------------------------------------------------------------------
| Sage Version 4.3.3, Release Date: 2010-02-21 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: import sympy
sage: import scipy
sage: f = sympy.Function("f")
sage: x = sympy.Symbol('x')
sage: eqn = sympy.diff(f(x), x)
sage: id = scipy.eye(10, 10)
sage: eqn
D(f(x), x)
sage: id
array([[ 1., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 1., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 1., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 1., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 1., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 1., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 1., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 1.]])
For a technical reason to avoid wild card import statements of the form
from foo import *
see the Google Python Style Guide [1].
[1]
http://google-styleguide.googlecode.com/svn/trunk/pyguide.html?showone=Imports#Imports
--
Regards
Minh Van Nguyen
--
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-support
URL: http://www.sagemath.org
To unsubscribe from this group, send email to
sage-support+unsubscribegooglegroups.com or reply to this email with the words
"REMOVE ME" as the subject.