On Jun 22, 2010, at 12:03 AM, Øyvind Jensen wrote:

> 
>>> Aren't some results dependent on assumptions?  I don't see how you can 
>>> cache independent of assumptions and not have problems.
>> 
>> For example:
>> 
>> 1) check that there are no global or local assumptions set
>> 2) store the expression
>> 
>> 
>> retrieve:
>> 
>> * check 1)
>> * use cache
> 
> How about:
> 0) generate and store global_assumptions_hash whenever global
> assumptions are changed.
> 1) generate expr_hash from (expression, local_assumtions)
> 2) construct cache key as (expr_hash, global_assumtions_hash)
> 3) use cache
> 
> Øyvind
> 

This is similar to what I had in my mind.  The only problem is that it can be 
inefficient.  If you make a computation on an expression containing only x, 
then change the assumptions on y, the computation on x will no longer be 
cached.  I think we can probably "assume" that computations on an expression 
not containing a symbol, say y, do not need to be cached separately if the 
assumptions on y change.  So we should rather hash each symbol in the 
expression and store that with the result somehow (I can't think of the correct 
data structure for this right now).  

Things get more complicated when the new Assumptions system allows assumptions 
one expressions, not just symbols (like Assume(x - y, Q.Positive)).  Perhaps in 
this case, we will have to just resort to the more naive method, because you 
can't know that just because the assumed expression isn't contained directly in 
an expression that it won't pop up inside the computation.  

Also maybe the SAT engine that Christian is working on could assist with this 
somehow (?).

Aaron Meurer

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to