On Wed, Jun 3, 2009 at 10:51 AM, moky <moky.m...@gmail.com> wrote: > ===================================== > > #! /usr/bin/sage -python > # -*- coding: utf8 -*- > > from sage.all import * > > var('x') > f(x)= 8 > print f.derivative() > > ===============================
This is a difference between Sage and Python -- "f(x) = 8" is not valid Python. That's why it's not working in your script. To see what "f(x)=8" really does, run the preparse command: '__tmp__=var("x"); f = symbolic_expression(Integer(8)).function(x)' Thus, you can do x = var('x') f = SR(8).function(x) and have it behave exactly the same way as before (since SR(8) and symbolic_expression(8) produce equivalent results). --Mike --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---