I have a new SymPy type that serves to represent a unit of computation 
(contains an expression/expressions that is/are being computed). I'd like 
to be able to alias queries on the assumptions of the element to 
assumptions of the underlying expression it represents. Example:

>>> a, b, c = symbols('a, b, c', integer=True)
>>> expr = a + b + c

# Create the tree element
>>> r = Routine((a, b, c), (expr))

# r now represents a computational routine.
# We can use this as a function in other expressions.
>>> new_expr = 1 + 2 + r(a, b, c)
>>> new_expr
1 + 2 + r(a, b, c)

# The following should work
>>> new_expr.is_integer
True
>>> r(1, 2, 3).is_integer
True

For `Routine` objects with multiple returns, the results are indexed to 
select the output element:

>>> exprs = (a + b + c, a*b*c + 4.1)
>>> r = Routine((a, b, c), exprs)

# Use it in a new expression
>>> (1 + r(1, 2, 3)[0]).is_integer
True
>>> (1 + r(1, 2, 3)[1]).is_integer
False

Any idea how to go about doing this? I have little to no understanding of 
the assumption system, so before I start digging through the code I thought 
I'd ask if anyone had thoughts on how to tackle this. The `Routine` type, 
the `AppliedRoutine` type, and the results/arguments are all done. I just 
need to figure out (if possible) how I can make this play well with the 
assumption system.

-Jim

-- 
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 sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/9bfa51e7-6f05-4d85-83cb-873e78bdc473%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to