You can get all the variables in an expression using expr.free_symbols. I hope that helps.
Aaron Meurer On Mon, Jun 24, 2013 at 3:37 PM, Shawn Garbett <[email protected]> wrote: > Here's a simpler example: > > from numpy import * > from sympy import * > > x = array([(1.1, 2.2), (3.3, 4.4), (5.5, 6.6)], dtype=[('s0', '<f8'), ('s1', > '<f8')]) > > eq = 2.0 * Symbol('s0') - Symbol('s1') > > 2.0*x['s0']-x['s1'] # Gives correct result at command prompt > > eq.evalf(x) # Fails > > The constraints are that the symbols in the equation are unknown, and there > is a random number of them that can be huge, like thousands of variables as > symbols. What is provided is the time course data x and the equation eq > which contains matching variables. I.e., The code has no way of knowing > beforehand what the variables are going to be, nor how many so a predefined > lambda will not solve the problem. > > -- > 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. > > -- 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.
