Ask Your Question
0

from sage.numerical import optimize, fail

asked 2012-05-09 01:40:57 +0100

araichev gravatar image

updated 2015-01-13 21:31:47 +0100

FrédéricC gravatar image

Hi all, what did i do wrong?

> sage -version
Sage Version 4.8, Release Date: 2012-01-20
> sage -python
Python 2.6.4 (r264:75706, Jan 20 2012, 01:12:14) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from sage.numerical import optimize
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Applications/sage/local/lib/python2.6/site-packages/sage/numerical/__init__.py", line 1, in <module>
import all
File "/Applications/sage/local/lib/python2.6/site-packages/sage/numerical/all.py", line 1, in <module>
from optimize import (find_root, find_maximum_on_interval,
File "/Applications/sage/local/lib/python2.6/site-packages/sage/numerical/optimize.py", line 13, in <module>
from sage.modules.free_module_element import vector
File "integer.pxd", line 9, in init sage.modules.free_module_element (sage/modules/free_module_element.c:27684)
File "integer.pyx", line 171, in init sage.rings.integer (sage/rings/integer.c:35507)
File "/Applications/sage/local/lib/python2.6/site-packages/sage/rings/infinity.py", line 200, in <module>
import sage.rings.rational
File "fast_arith.pxd", line 3, in init sage.rings.rational (sage/rings/rational.c:25818)
File "fast_arith.pyx", line 51, in init sage.rings.fast_arith (sage/rings/fast_arith.c:7675)
File "integer_ring.pyx", line 69, in init sage.rings.integer_ring (sage/rings/integer_ring.c:11264)
File "/Applications/sage/local/lib/python2.6/site-packages/sage/structure/factorization.py", line 188, in <module>
from sage.misc.all import prod
File "/Applications/sage/local/lib/python2.6/site-packages/sage/misc/all.py", line 81, in <module>
from functional import (additive_order,
File "/Applications/sage/local/lib/python2.6/site-packages/sage/misc/functional.py", line 36, in <module>
from sage.rings.complex_double import CDF
File "complex_double.pyx", line 88, in init sage.rings.complex_double (sage/rings/complex_double.c:15116)
File "real_mpfr.pxd", line 15, in init sage.rings.complex_number (sage/rings/complex_number.c:16522)
File "real_mpfr.pyx", line 1, in init sage.rings.real_mpfr (sage/rings/real_mpfr.c:30362)
File "utils.pyx", line 11, in init sage.libs.mpmath.utils (sage/libs/mpmath/utils.c:6059)
File "/Applications/sage/local/lib/python2.6/site-packages/sage/all.py", line 72, in <module>
from sage.libs.all       import *
File "/Applications/sage/local/lib/python2.6/site-packages/sage/libs/all.py", line 1, in <module>
import sage.libs.ntl.all  as ntl
File "/Applications/sage/local/lib/python2.6/site-packages/sage/libs/ntl/__init__.py", line 1, in <module>
import all
File "/Applications/sage/local/lib/python2.6/site-packages/sage/libs/ntl/all.py", line 26, in <module>
from sage.libs.ntl.ntl_ZZ import (
File "ntl_ZZ.pyx", line 28, in init sage.libs.ntl.ntl_ZZ (sage/libs/ntl/ntl_ZZ.cpp:6353)
File "integer_ring.pyx", line 1063, in sage.rings.integer_ring.IntegerRing (sage/rings/integer_ring.c:9806)
NameError: ZZ
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2012-05-09 03:47:09 +0100

Jason Grout gravatar image

You tried to import just part of Sage. You need to import everything:

from sage.all import *

or

import sage.all
edit flag offensive delete link more

Comments

Oh, OK. I thought i could import only the Sage module M that i wanted for a Python session and that M would automatically import its dependent modules. So, that isn't the case? I need to load all of Sage?

araichev gravatar imagearaichev ( 2012-05-10 19:18:18 +0100 )edit

There are a myriad of dependencies between all the Sage modules. You need to import all of them by importing sage.all; that will import them in the correct order.

Jason Grout gravatar imageJason Grout ( 2012-05-24 11:59:08 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-05-09 01:40:57 +0100

Seen: 390 times

Last updated: May 09 '12