On Dec 3, 2008, at 10:42 AM, Jason Grout wrote:

> Robert Bradshaw wrote:
>> On Dec 3, 2008, at 5:55 AM, Stan Schymanski wrote:
>>
>>> Dear all,
>>>
>>> Could anyone tell me how to controll the order in which arguments  
>>> are
>>> evaluated when they are passed to python functions? It seems that  
>>> the
>>> functions are evaluated first and then the variables are  
>>> substituted,
>>> which leads to failures in the following example:
>>
>> To answer the original question, Python doesn't give control over
>> this. Arguments are always evaluated before passed to the function.
>> (What one can do, as Jason demonstrated, is pass in a function to be
>> evaluated later).
>
> So, bringing up an issue that has come up before, there is no way  
> to do
> the equivalent of the Hold or HoldAll commands in Mma?  See
> http://reference.wolfram.com/mathematica/ref/Hold.html?q=Hold&lang=en
> for example.

Not without some preparsing magic, and even then it might be tricky  
as there is not a simple one-to-one correspondence between the python  
parse tree and the mathematical expression.

> It'd still be nice if there were a way to be able to create and deal
> with unevaluated symbolic expressions (for example, if I want to print
> an integral sign by doing latex(hold(integrate(...))) ).  I guess we
> could add yet another feature to the preparser if there was enough  
> demand.
>
> Another way to do it might be to have classes like Integrate (as  
> opposed
> to functions), that represent an integral.

I'm not a fan of making such a distinction based on the  
capitalization of the first letter, but it would make sense to have  
integral (the noun) be unevaluated, and integrate (the verb) actually  
do the work.

> That still wouldn't prevent
> something like Integral(2+3,(x,0,3)) being simplified to
> Integral(5,(x,0,3)), though.

No, it wouldn't.

- Robert


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