On Mar 27, 2009, at 10:36 AM, [email protected] wrote:

> On Mar 26, 7:16 pm, Robert Bradshaw <[email protected]>
> wrote:
>> def Y(t):
>>      return 2500+numerical_integral(S(u)-R(u),0,t)[0]
>>
>> but then it won't be a symbolic object. (It will be a Python  
>> function.)
>
> Wait.  What is the difference between a "symbolic object" and a
> "Python function" ?

A symbolic object can be manipulated, reasoned about, and has a bunch  
of methods attached.

sage: f(x) = x^3-x
sage: f + 1
x |--> x^3 - x + 1
sage: f.integrate(x)
x |--> x^4/4 - x^2/2
...

A Python function can just be called (pretty much). It's just a chunk  
of executable code (for example, could include loops, branching, look  
stuff up in a file/online, etc.).

sage: def f(x): x^3-x
....:
sage: f.integrate()
------------------------------------------------------------
Traceback (most recent call last):
   File "<ipython console>", line 1, in <module>
AttributeError: 'function' object has no attribute 'integrate'

> Not sure whey the "def" way works but not the "Y(t) = ..." way.

The body of a function is not executed until it is called. In the  
latter case, when you call Y(3) the "t" is specialized at 3 and the  
numerical integration actually can evaluate at a given point.

- Robert


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to