Hi Alasdair,

On 1 Jul., 13:00, David Joyner <wdjoy...@gmail.com> 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., some definitions such as f(x) = sin(x) or R.<x>=QQ[] are not
valid Python. But when you do this in Sage, it internally becomes
sage: preparse('m(x)=sin(x)')
'__tmp__=var("x"); m = symbolic_expression(sin(x)).function(x)'

In your first approach, you get '__tmp__=var("x"); m =
symbolic_expression(mod(x,Integer(10))).function(x)'

But mod(x,Integer(10)) gives an error, since x is a symbolic variable
and not an integer, and since "mod" is not symbolic, in contrast to
"sin":
  sage: type(sin)
  <class 'sage.functions.trig.Function_sin'>
  sage: type(mod)
  <type 'builtin_function_or_method'>

Cheers,
   Simon

--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to