TypeError doing a contour plot of imag_part(I*log(x+I*y))

asked 2012-04-13 09:48:28 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Hi. I'm trying to do a contour plot of the imaginary part of i*log(z).

z = var("z")
x,y = var("x,y",domain="real")
u = I*log(z)
f = imag_part(u(z=(x+I*y)))
contour_plot(f,(x,-3,3),(y,-3,3))

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_30.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("eiA9IHZhcigieiIpCngseSA9IHZhcigieCx5Iixkb21haW49InJlYWwiKQp1ID0gSSpsb2coeikKZiA9IGltYWdfcGFydCh1KHo9KHgrSSp5KSkpCmNvbnRvdXJfcGxvdChmLCh4LC0zLDMpLCh5LC0zLDMpKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>

  File "/tmp/tmpk8YRSf/___code___.py", line 7, in <module>
    exec compile(u'contour_plot(f,(x,-_sage_const_3 ,_sage_const_3 ),(y,-_sage_const_3 ,_sage_const_3 ))
  File "", line 1, in <module>

  File "/cosas/sage/local/lib/python2.6/site-packages/sage/misc/decorators.py", line 456, in wrapper
    return func(*args, **kwds)
  File "/cosas/sage/local/lib/python2.6/site-packages/sage/misc/decorators.py", line 456, in wrapper
    return func(*args, **kwds)
  File "/cosas/sage/local/lib/python2.6/site-packages/sage/misc/decorators.py", line 534, in wrapper
    return func(*args, **options)
  File "/cosas/sage/local/lib/python2.6/site-packages/sage/plot/contour_plot.py", line 470, in contour_plot
    g, ranges = setup_for_eval_on_grid([f], [xrange, yrange], options['plot_points'])
  File "/cosas/sage/local/lib/python2.6/site-packages/sage/plot/misc.py", line 144, in setup_for_eval_on_grid
    return fast_float(funcs, *vars,**options), [tuple(range+[range_step]) for range,range_step in zip(ranges, range_steps)]
  File "fast_eval.pyx", line 1357, in sage.ext.fast_eval.fast_float (sage/ext/fast_eval.c:8418)
  File "fast_eval.pyx", line 1372, in sage.ext.fast_eval.fast_float (sage/ext/fast_eval.c:8627)
  File "fast_callable.pyx", line 420, in sage.ext.fast_callable.fast_callable (sage/ext/fast_callable.c:3173)
  File "expression.pyx", line 8108, in sage.symbolic.expression.Expression._fast_callable_ (sage/symbolic/expression.cpp:30640)
  File "/cosas/sage/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 1392, in fast_callable
    return FastCallableConverter(ex, etb)()
  File "/cosas/sage/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 220, in __call__
    return self.composition(ex, operator)
  File "/cosas/sage/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 1370, in composition
    return self.etb.call(function, *ex.operands())
  File "fast_callable.pyx", line 685, in sage.ext.fast_callable.ExpressionTreeBuilder.call (sage/ext/fast_callable.c:5024)
  File "fast_callable.pyx", line 565, in sage.ext.fast_callable.ExpressionTreeBuilder.__call__ (sage/ext/fast_callable.c:4378)
  File "expression.pyx", line 8108, in sage.symbolic.expression.Expression._fast_callable_ (sage/symbolic/expression.cpp:30640)
  File "/cosas/sage/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 1392, in fast_callable
    return FastCallableConverter(ex, etb)()
  File "/cosas/sage/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 220, in __call__
    return self.composition(ex, operator)
  File "/cosas/sage/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 1370, in composition
    return self.etb.call(function, *ex.operands())
  File "fast_callable.pyx", line 685, in sage.ext.fast_callable.ExpressionTreeBuilder.call (sage/ext/fast_callable.c:5024)
  File "fast_callable.pyx", line 565, in sage.ext.fast_callable.ExpressionTreeBuilder.__call__ (sage/ext/fast_callable ...
(more)
edit retag flag offensive close merge delete

Comments

3

I have an inkling that http://trac.sagemath.org/sage_trac/ticket/5572 contains things that might help fix this. Unfortunately, these sorts of issues have been a problem for a while, with your workaround being as good a solution as any, I'm afraid.

kcrisman gravatar imagekcrisman ( 2012-04-13 11:50:48 +0200 )edit