On Thursday, March 13, 2014 3:05:22 PM UTC-7, Lee Worden wrote:
>
> sage: s = symbolic_expression( 'a(x)' ) 
> sage: s.substitute_function( 
> sage.symbolic.function_factory.function('a'), 
> sage.symbolic.function_factory.function('A') ) 
> A(x) 
> sage: t = deepcopy( s ) 
>

Since symbolic expressions are not mutable, you shouldn't have a need to 
make deep copies of them. The behaviour does seem problematic, though.
The problem you are seeing stems from:

sage: sage.symbolic.function_factory.function('a') == s.operator()
True
sage: sage.symbolic.function_factory.function('a') == t.operator()
False

It looks like deep copy is a little too eager: it shouldn't make a copy of 
the function 'a', but it does. You end up with a different function 
(accessible via t.operator() ) which also prints as 'a' but isn't equal to 
the function 'a' you can create via 
sage.symbolic.function_factory.function. Basically, you got what you asked 
for: a COPY of the function, not the function itself.

Something fishy is going on, though, because

sage: a=s.operator()
sage: deepcopy(a)
a
sage: deepcopy(a) == a
True
sage: deepcopy(a) is a
False
sage: deepcopy(a)(x).substitute_function(
....: sage.symbolic.function_factory.function('a'),
....: sage.symbolic.function_factory.function('A') ) 
A(x)

so a function object by itself does get "deepcopied" correctly, but when 
it's sitting in an expression it is not.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to