Hi,

On Aug 19, 10:30 am, Harald Schilly <harald.schi...@gmail.com> wrote:
> here is another "report a problem" message from the notebook
> interface. It's not a bug (i think) but it gives insight in how Sage
> is used and over what users stumble when using it for simple things.
>
> ------------------
> This doesn't work:
>
> var('k')
> u = 1 + k
> k = 1
> u.n()
> ------------------
>
> Comment:
> I think n() could be made more intelligent in a way that it searches
> the globals()? Or not .n(), but a new method ".evaluate()" or
> something that does this? Any ideas? Just u.subs(globals()) didn't
> work for me.


Here goes another easy way of doing above.
-------
sage: eval(repr(u))
2
-------

It could also work for functions

-------
sage: f(x) = function('f', x)
sage: h = f(x) + f(x).diff(x)
sage: h
diff(f(x), x, 1) + f(x)

sage: f(x) = sin(x)
sage: eval(repr(h))
sin(x) + cos(x)
--------


Cheers,
Golam

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

Reply via email to