[sympy] Re: Pattern matching.

2008-06-19 Thread Ondrej Certik
On Thu, Jun 19, 2008 at 3:14 AM, Roberto Nobrega [EMAIL PROTECTED] wrote: While checking SymPy wiki's tutorial about pattern matching, I ended up with the following: from sympy import * x = Symbol('x') p = Wild('p') q = Wild('q') (5*x**2 + 3*x).match(p*x**2 + q*x) I got the following

[sympy] Re: Matrix.evalf()

2008-06-19 Thread Ondrej Certik
Hi, On Thu, Jun 19, 2008 at 12:26 PM, Riccardo Gori [EMAIL PROTECTED] wrote: On Wednesday 18 June 2008 18:34:25 Ondrej Certik wrote: On Wed, Jun 18, 2008 at 6:06 PM, Riccardo Gori [EMAIL PROTECTED] wrote: Hello, how about adding this function to the Matrix class? I find it very useful.

[sympy] Confused about basics

2008-06-19 Thread tom
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) And get: Traceback (most recent call last): File input, line 1,

[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] __str__ and __repr__ confusion

2008-06-19 Thread Riccardo Gori
Hello, I'm working at fixing issue 888. It is easy to fix but I don't understand why in sympy/utilities/lambdify.py I found that lambdastr function does use __str__ for expr. def lambdastr(args, expr): Returns a string that can be evaluated to a lambda function. from sympy

[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]:

[sympy] Re: Pattern matching.

2008-06-19 Thread Roberto Nobrega
I'm running latest hg version: [EMAIL PROTECTED]:~/Projects/sympy$ hg tip changeset: 2143:ccebd03423df tag: tip user:Riccardo Gori [EMAIL PROTECTED] date:Wed Jun 18 17:47:53 2008 +0200 summary: Matrix-number multiplication speedup 700% [EMAIL

[sympy] Re: Productive coding, or What is your work flow?

2008-06-19 Thread Kirill Smelkov
Hi Brian, All, On Wed, Jun 18, 2008 at 04:52:34PM -0600, Brian Jorgensen wrote: For years, I've been hearing that effective text editing is essential to productive coding, but I'd never really taken the time to move beyond Notepad++, Text Mate, and gedit. I've recently started using vim, and