[sage-support] Re: A little question about mod in function definition

2009-07-03 Thread Alasdair
So it seems there are (at least!) two classes of functions; those which accept symbolic input, like sin: m(x)=sin(x/2) and those which don't, such as mod. I had not realized there was such a distinction. Thank you all. -Alasdair On Jul 2, 5:15 am, William Stein wrote: > On Wed, Jul 1, 2009 a

[sage-support] Re: A little question about mod in function definition

2009-07-01 Thread William Stein
On Wed, Jul 1, 2009 at 8:52 PM, Simon King wrote: > > Hi Alasdair, > > On 1 Jul., 13:00, David Joyner wrote: >> I think the first tries to use Sage's symbolic expression machinery >> but the second does not. > > Yes, it seems so. > > Using Sage, one should always be aware that  some very handy/fa

[sage-support] Re: A little question about mod in function definition

2009-07-01 Thread Simon King
Hi Alasdair, On 1 Jul., 13:00, David Joyner wrote: > I think the first tries to use Sage's symbolic expression machinery > but the second does not. Yes, it seems so. Using Sage, one should always be aware that some very handy/fancy syntax is only available due to the Sage preparser. E.g., so

[sage-support] Re: A little question about mod in function definition

2009-07-01 Thread David Joyner
On Wed, Jul 1, 2009 at 4:43 AM, Alasdair wrote: > > Of these two examples: > > m(x)=mod(x,10) > > m=lambda x:mod(x,10) > > The first returns an error "unable to convert x (=x) to an integer". > Can anyone explain what's going on here? I think the first tries to use Sage's symbolic expression mach

[sage-support] Re: A little question about mod in function definition

2009-07-01 Thread Kwankyu
You should define a Python function def m(x): return mod(x,10) Kwankyu --~--~-~--~~~---~--~~ 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 o