[sympy] Re: Chop Polynomial Coefficients Close to Zero

2010-10-07 Thread Scott
On Oct 5, 11:55 pm, smichr smi...@gmail.com wrote: On Oct 5, 9:46 pm, Scott spectre...@gmail.com wrote: On Oct 4, 5:48 pm, Ondrej Certik ond...@certik.cz wrote:    return Add(term for term in expr.as_Add() if term.as_coeff_terms() Add wants items, not a generator:     return

Re: [sympy] Re: Chop Polynomial Coefficients Close to Zero

2010-10-07 Thread Aaron S. Meurer
On Oct 6, 2010, at 6:17 AM, Vinzent Steinberg wrote: On 6 Okt., 08:55, smichr smi...@gmail.com wrote: Add wants items, not a generator: return Add(*[term for term in expr.as_Add() if term.as_coeff_terms()[0] = tol]) To summarize: use Add(a,b,c) or Add(*[a,b,c]) or Add(*[x for

[sympy] Running collect() on indices

2010-10-07 Thread Nicholas Kinar
Hello, Working again with the FDTD re-arrangement of terms, I am wondering if there is any way to run collect() on indices of an IndexedBase object using the current master sympy git repository. Rather than having (n+1) expressed as a power, is it possible to run collect() in the manner

Re: [sympy] Running collect() on indices

2010-10-07 Thread Nicholas Kinar
def generate_fdtd(expr, nsolve): w = Wild('w') expr0 = expr.lhs - expr.rhs expr1 = expr0.expand() # this doesn't work to collect terms at timestep (n+1) print collect(expr1, p[w,w,n+1]) Pardon the unintentional indent, so the function should be: def