Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 2012-02-01 11:43:30 -0500

DSM gravatar image

While it's true that P1(float(0)) works, P1(-1) doesn't:

sage: P1(float(-1))
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
ValueError: negative number cannot be raised to a fractional power

I'm not sure what the best way to avoid this problem would be. Probably we could get away with coercing the function argument to RDF instead of float-- making that one change got the function to plot without difficulty. It's already done in lots of places in plot.py.

While it's true that P1(float(0)) works, P1(-1) P1(float(-1)) doesn't:

sage: P1(float(-1))
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
ValueError: negative number cannot be raised to a fractional power

I'm not sure what the best way to avoid this problem would be. Probably we could get away with coercing the function argument to RDF instead of float-- making that one change got the function to plot without difficulty. It's already done in lots of places in plot.py.

While it's true that P1(float(0)) works, P1(float(-1)) doesn't:

sage: P1(float(-1))
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
ValueError: negative number cannot be raised to a fractional power

I'm not sure what the best way to avoid this problem would be. Probably we could get away with coercing the function argument to RDF instead of float-- float before it's called-- making that one change got the function to plot without difficulty. It's already done in lots of places in plot.py.

While it's true that P1(float(0)) works, P1(float(-1)) doesn't:

sage: P1(float(-1))
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
ValueError: negative number cannot be raised to a fractional power

I'm not sure what the best way to avoid this problem would be. Probably we could get away with coercing the function argument to RDF instead of float before it's called-- making that one change in generate_plot_points got the function to plot without difficulty. It's already done in lots of places in plot.py.plot.py, so maybe a few more wouldn't be a bad idea.