On Feb 26, 2009, at 2:28 PM, YannLC wrote:

> Forgive my stubborness, but you answered only half of my question :)
> do you think the following  is a sane behavior?
>
> sage: var('f x')
> (f, x)
> sage: f(x+3)
> x+3
>
> I would prefer a NotImplementedError...

This has come up many times, and it's unclear exactly what the best  
behavior should be. What about

sage: var('x')
sage: f = x
sage: f(3)
3

>
>        Yann
>
> On Feb 26, 11:14 pm, Robert Bradshaw <rober...@math.washington.edu>
> wrote:
>> On Feb 26, 2009, at 1:15 PM, YannLC wrote:
>>
>>
>>
>>> On Feb 26, 9:40 pm, Robert Bradshaw <rober...@math.washington.edu>
>>> wrote:
>>>> On Feb 26, 2009, at 12:22 PM, YannLC wrote:
>>
>>>>> Hi,
>>>>> am I doing something wrong here?
>>>>> If not, this is a bug...
>>
>>>>> sage: f=function('f',x)
>>>>> sage: f
>>>>> f(x)
>>>>> sage: g(f,x)=f(x+1)
>>>>> sage: g
>>>>> (f, x) |--> x + 1
>>
>>>> When one writes g(f, x) it creates two variables f and x, and your
>>>> original f is gone. I'm not sure what the best fix is here... There
>>>> is also the counter-intuitive
>>
>>>> sage: f = var('f')
>>>> sage: f(3)
>>>> 3
>>
>>>> - Robert
>>> My point was unclear.
>>> * First, how to define a function 'g' doing what I want then? I mean
>>> with an argument which is a function; is it possible?
>>> * then, I think that f shouldn't disappear like this:
>>> sage: g(f,x)=f(x)
>>> sage: g
>>> (f, x) |--> x
>>
>> That can't be done (yet). You can do
>>
>> def g(f, x):
>>      return x+1
>>
>> But then it's a Python function, not a calculus function.
>>
>> - Robert
> >


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send 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