-
-
Notifications
You must be signed in to change notification settings - Fork 698
Open
Description
Plotting prime_pi gives the following error:
sage: plot(prime_pi(x), (x, 1, 100))
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/huss/.sage/temp/bernoulli/12905/_home_huss__sage_init_sage_0.py in <module>()
/local/data/huss/software/sage-4.1.1/local/lib/python2.6/site-packages/sage/functions/prime_pi.so in sage.functions.prime_pi.PrimePi.__call__ (sage/functions/prime_pi.c:1038)()
/local/data/huss/software/sage-4.1.1/local/lib/python2.6/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.__int__ (sage/symbolic/expression.cpp:4389)()
/local/data/huss/software/sage-4.1.1/local/lib/python2.6/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.__float__ (sage/symbolic/expression.cpp:5526)()
TypeError: float() argument must be a string or a number
It also does not work without the variable:
sage: plot(prime_pi, (1, 100))
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (35, 0))
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/huss/.sage/temp/bernoulli/12905/_home_huss__sage_init_sage_0.py in <module>()
/local/data/huss/software/sage-4.1.1/local/lib/python2.6/site-packages/sage/plot/misc.pyc in wrapper(*args, **kwds)
238 kwds[new_name] = kwds[old_name]
239 del kwds[old_name]
--> 240 return func(*args, **kwds)
241
242 from sage.misc.sageinspect import sage_getsource
/local/data/huss/software/sage-4.1.1/local/lib/python2.6/site-packages/sage/plot/misc.pyc in wrapper(*args, **kwds)
133 options['__original_opts'] = kwds
134 options.update(kwds)
--> 135 return func(*args, **options)
136
137
/local/data/huss/software/sage-4.1.1/local/lib/python2.6/site-packages/sage/plot/plot.pyc in plot(funcs, *args, **kwds)
2052 do_show = kwds.pop('show',False)
2053 if hasattr(funcs, 'plot'):
-> 2054 G = funcs.plot(*args, **original_opts)
2055 # if we are using the generic plotting method
2056 else:
/local/data/huss/software/sage-4.1.1/local/lib/python2.6/site-packages/sage/functions/prime_pi.so in sage.functions.prime_pi.PrimePi.plot (sage/functions/prime_pi.c:2395)()
/local/data/huss/software/sage-4.1.1/local/lib/python2.6/site-packages/sage/functions/prime_pi.so in sage.functions.prime_pi.PrimePi.__call__ (sage/functions/prime_pi.c:1038)()
TypeError: an integer is required
For nth_prime
sage: plot(nth_prime(x), (x, 1, 100))
also gives an error, but
sage: plot(nth_prime, (1, 100))
works.
CC: @kcrisman
Component: graphics
Issue created by migration from https://trac.sagemath.org/ticket/6876