On Sep 4, 2009, at 1:27 PM, Nils Bruin wrote:

> On Sep 4, 12:30 pm, Maurizio <[email protected]> wrote:
>> I beg your pardon for asking silly questions... would you please
>> explain which is the reason for having different variables with the
>> same name... and even more, with different domains?
>
> In an interactive session this would probably be a bad idea. However,
> in an automated procedure one may have to come up with a temporary
> variable. For instance
>
> def derivative(f,x):
>   delta=temporary_symbolic_variable
>   return limit( (f(x+delta)-f(x))/delta, delta=0 )
>
> I've been intentionally vague in how to obtain the
> temporary_symbolic_variable, but it is pretty clear that that variable
> should be independent of any other assumptions you have made. One way
> to do that is to allow it to be a distinct variable with the name
> "delta", regardless of other deltas in the system.

I think it would make a lot of sense to have a global variables  
cache, the same way we cache certain rings. Especially as the  
"difference" between two similarly-named variables would not be  
preserved through calls to maxima.

As for temporary_symbolic_variable, how about SR.new_variable() which  
would always produce a variable that's never been used before?

> It is also in step with sage's policy of allowing distinct objects to
> have the same print name, to whatever confusion that may lead:
>
> sage: R.<x>=GF(3)[]
> sage: S.<x>=GF(5)[]
> sage: R.0
> x
> sage: S.0
> x
> sage: R.0 == S.0
> False

Here the two lie in entirely different rings, and are actually very  
different mathematical objects

sage: -R.0
2*x
sage: -S.0
4*x

- Robert


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

Reply via email to