On Oct 9, 10:53 pm, Mike Hansen <mhan...@gmail.com> wrote:
> On Mon, Oct 4, 2010 at 4:03 PM, jpc <pedrocruzave...@gmail.com> wrote:
> > Why does the plot
> >   plot(k%1,k,0,5)
>
> For a symbolic variable 'k', k%1 returns an error since the notion of
> a symbolic mod operation hasn't been implemented.
>
> > What can be used instead ?
>
> You can just delay the application of the mod operation:
>
> plot(lambda z: z%1.0, 0, 5)

Just to make sure it's clear, Mike is doing

sage: plot( lambda k: k%1., (k,0,5))

while the original poster would have had

sage: plot( lambda k: k%1, (k,0,5))
verbose 0 (3766: plot.py, generate_plot_points) WARNING: When
plotting, failed to evaluate function at 198 points.
verbose 0 (3766: plot.py, generate_plot_points) Last error message:
'Cannot convert non-integral float to integer'

That is to say, just changing 1 to 1. 'fixes' it because now Sage
knows that the modulus isn't an integer, so it can accept non-integer
inputs on the other side as well.

I guess this isn't technically a bug (or not different from not having
the symbolic %), but maybe should the coercion do something with
this?

- kcrisman

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to