On Sun, Nov 2, 2008 at 4:41 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
>
>
> On Nov 2, 12:14 pm, mabshoff <[EMAIL PROTECTED]> wrote:
>> Sage already does that via its preparser:
>>
>> sage: x^2
>> x^2
>> sage: x**2
>> x^2
>> sage: preparse("x^2")
>> 'x**Integer(2)'
>
> Yes but I don't think you are claiming that Python code can use ^ for
> exponentials are you?
> Actually I'm moving towards opinion that I should just use "**"
> everywhere.That is a consistent way to go. Plus it will work in Fortran :-) > Alternatively, I could avoid Python code everywhere now that Stein > pointed out to me how to define functions w/o Python code... > > my_function(t) = 4*t -9 There might be some confusion. If you're writing code in the notebook or the command line, you can do this and it will work fine: sage: def f(x): ....: return x^2 ....: sage: f(10) 100 I.e., even "python functions" get their body's preparsed, so ^ works. The only problem is if you put code in an external .py file. Keep persisting -- I think there's some failure to communicate here there will get clarified with persistence. And the trail of this conversation will be useful to other people who find it later. William --~--~---------~--~----~------------~-------~--~----~ 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-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
