[sympy] Re: Confused about basics

2008-06-19 Thread Ondrej Certik
On Thu, Jun 19, 2008 at 1:21 PM, tom [EMAIL PROTECTED] wrote: I was just trying out sympy to try and make a few bits of hand-algebra easier, and avoid mistakes, but am having some trouble. I'm trying to factor out one variable, so tried (having set up a and b as symbols): factor(a*b+b, b)

[sympy] Re: Confused about basics

2008-06-19 Thread Ondrej Certik
On Thu, Jun 19, 2008 at 1:34 PM, Ondrej Certik [EMAIL PROTECTED] wrote: On Thu, Jun 19, 2008 at 1:21 PM, tom [EMAIL PROTECTED] wrote: I was just trying out sympy to try and make a few bits of hand-algebra easier, and avoid mistakes, but am having some trouble. I'm trying to factor out one

[sympy] Re: Confused about basics

2008-06-19 Thread tom
On Jun 19, 12:34 pm, Ondrej Certik [EMAIL PROTECTED] wrote: however, generally the factor function is fragile, as you have find out. Ok, fair enough. Thanks - 'collect' does appear to do what I want here. I know factorisation is a tricky problem in general, I just wanted to get the hang of

[sympy] Re: Confused about basics

2008-06-19 Thread tom
On Jun 19, 1:20 pm, Ondrej Certik [EMAIL PROTECTED] wrote: Right. I think you are doing it right. The other (maybe simple) option is to use solve, here is my session where I tried that: In [1]: vin, vout, r1, r2 = symbols([Vin, Vout, R1, R2]) In [2]: a = (vin-vout)/r1 + (0-vout)/r2 In

[sympy] Re: Confused about basics

2008-06-19 Thread Mateusz Paprocki
Hi, I see the problem was solved, however a few comments are needed. I'm trying to factor out one variable, so tried (having set up a and b as symbols): collect() works, but the same can be achieved with factor(), e.g.: In [4]: factor(a*b+b, (a, b)) Out[4]: b*(1 + a) or else In [7]: