Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to plot composition of unit step and sin functions

When i was trying to plot the function U(sin(x)) where U is the unit step function it leaves error message, but U(exp(x)) worked nicely

the error message was

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

File "/tmp/tmpeAn7w2/___code___.py", line 3, in <module> exec compile(u'plot(h(sin(x)), (x, -_sage_const_10 , _sage_const_10 )) File "", line 1, in <module>

File "/sage/local/lib/python2.6/site-packages/sage/misc/decorators.py", line 657, in wrapper return func(args, kwds) File "/sage/local/lib/python2.6/site-packages/sage/misc/decorators.py", line 504, in wrapper return func(args, *options) File "/sage/local/lib/python2.6/site-packages/sage/plot/plot.py", line 3071, in plot G = _plot(funcs, *args, *kwds) File "/sage/local/lib/python2.6/site-packages/sage/plot/plot.py", line 3105, in _plot funcs, ranges = setup_for_eval_on_grid(funcs, [xrange], options['plot_points']) File "/sage/local/lib/python2.6/site-packages/sage/plot/misc.py", line 138, 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 1388, in sage.ext.fast_eval.fast_float (sage/ext/fast_eval.c:8901) TypeError: no way to make fast_float from None

How to plot composition of unit step and sin functions

When i was trying to plot the function U(sin(x)) where U is the unit step function it leaves error message, but U(exp(x)) worked nicely

the error message was

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

<module> File "/tmp/tmpeAn7w2/___code___.py", line 3, in <module> exec compile(u'plot(h(sin(x)), (x, -_sage_const_10 , _sage_const_10 )) File "", line 1, in <module>

<module> File "/sage/local/lib/python2.6/site-packages/sage/misc/decorators.py", line 657, in wrapper return func(args, kwds) func(*args, **kwds) File "/sage/local/lib/python2.6/site-packages/sage/misc/decorators.py", line 504, in wrapper return func(args, *options) func(*args, **options) File "/sage/local/lib/python2.6/site-packages/sage/plot/plot.py", line 3071, in plot G = _plot(funcs, *args, *kwds) **kwds) File "/sage/local/lib/python2.6/site-packages/sage/plot/plot.py", line 3105, in _plot funcs, ranges = setup_for_eval_on_grid(funcs, [xrange], options['plot_points']) File "/sage/local/lib/python2.6/site-packages/sage/plot/misc.py", line 138, in setup_for_eval_on_grid return fast_float(funcs, *vars,options), *vars,**options), [tuple(range+[range_step]) for range,range_step in zip(ranges, range_steps)] File "fast_eval.pyx", line 1388, in sage.ext.fast_eval.fast_float (sage/ext/fast_eval.c:8901) TypeError: no way to make fast_float from None

None
click to hide/show revision 3
retagged

How to plot composition of unit step and sin functions

When i was trying to plot the function U(sin(x)) where U is the unit step function it leaves error message, but U(exp(x)) worked nicely

the error message was

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

  File "/tmp/tmpeAn7w2/___code___.py", line 3, in <module>
    exec compile(u'plot(h(sin(x)), (x, -_sage_const_10 , _sage_const_10 ))
  File "", line 1, in <module>

  File "/sage/local/lib/python2.6/site-packages/sage/misc/decorators.py", line 657, in wrapper
    return func(*args, **kwds)
  File "/sage/local/lib/python2.6/site-packages/sage/misc/decorators.py", line 504, in wrapper
    return func(*args, **options)
  File "/sage/local/lib/python2.6/site-packages/sage/plot/plot.py", line 3071, in plot
    G = _plot(funcs, *args, **kwds)
  File "/sage/local/lib/python2.6/site-packages/sage/plot/plot.py", line 3105, in _plot
    funcs, ranges = setup_for_eval_on_grid(funcs, [xrange], options['plot_points'])
  File "/sage/local/lib/python2.6/site-packages/sage/plot/misc.py", line 138, 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 1388, in sage.ext.fast_eval.fast_float (sage/ext/fast_eval.c:8901)
TypeError: no way to make fast_float from None