def generate_fdtd(expr, nsolve):
w = Wild('w')
expr0 = expr.lhs - expr.rhs
expr1 = expr0.expand()
expr2 = collect(expr1, w**nsolve)
expr2 = expr2.expand()
Why are you expanding after you collect? This will undo what you just collected.
Ah, you are right, Chris; thanks for pointing this out.
You got all the 1+n power terms as you asked for...what would you rather have
or what is the problem in what you got?
/c
Yes, you are right about this. My confusion was due to a
misunderstanding of my own mathematics. As Oyvind suggests, I've tested
the function again with a simpler expression:
expr1 = Eq(p[3,1]**(n+1) + p[2,1]**n, A*p[3,1]**(n+1)*p[3,3]**n - p[3,3]**n)
The function outputs the expected algebraic re-arrangement:
p[3, 1]**(1 + n)*(1 - A*p[3, 3]**n) == -p[2, 1]**n - p[3, 3]**n
This is precisely what I wanted, and I think that most of my confusion
was due to the mistaken belief that I couldn't solve for (1 - A*p[3,
3]**n) if it was on the LHS of the expression. However, I see that it
does indeed belong on the LHS of the expression, and not the RHS.
So thank you very much, Oyvind and Chris, for taking a look at this
code, since I would have pondered on this problem for a very long time
if I hadn't made a posting on this mailing list. At least there is help
for those who are perpetually dazed and confused.
Many thanks,
Nicholas
--
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.