I have ran into a caching problem while working on my project for the 
vector calcculus module. This occurred while I was debugging the express 
method on vector (this isn't really relevant though).

So, I have a symbol theta and another symbol phi.

>>> cs.theta
cs.theta

>>> cs.phi
cs.phi

cs is an instance of the CoordSysSph class (again, not really relevant to 
the problem at hand).

The problem:
>>> sin(cs.theta) * sin(cs.phi)
sin(cs.theta) ** 2

Well, in the definition for the cacheit decorator, the dicitionary 
func_cache_it_cache exists. Now, when sin(cs.theta) is called, a key, value 
pair gets added to the dictionary:

*((sin, <class 'sympy.core.function.FunctionClass'>), (cs.theta, <class 
'sympy.vector.vector.BaseScalar'>))  :* *sin(cs.theta)*
*
*
Now, when SymPy needs to calculate sin(cs.phi), the cacheit decorator is 
called again. The lookup key for sin(cs.phi) is generated as:
*((sin, <class 'sympy.core.function.FunctionClass'>), (cs.phi, <class 
'sympy.vecto**r.vector.BaseScalar'>))*

At this point, the func_cache_it_cache *does not* have the key 
correspondind to sin(cs.phi), as it shouldn't. But, here's the catch: 
running the has_key method on func_cache_it_cache for this second key (for 
sin(cs.phi)) returns True. That means, the cache returns sin(cs.theta). And 
that is what is causing the problem.

What can I possibly do here? For the time being, I am going to proceed with 
the debugging. When there is a solution for this problem, we can go ahead 
and fix this.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to