[sympy] Re: what sort of polynomial is this?

2010-03-03 Thread Mateusz Paprocki
Hi, On Wed, Mar 03, 2010 at 10:28:04AM -0800, smichr wrote: > If you have a polynomial in x and you replace x with a polynomial in u > you might end up with something that doesn't factor in the traditional > sense, but finding the roots of it should be quite trivial, e.g. > factor((1+2*x + x**3).s

[sympy] Re: what sort of polynomial is this?

2010-03-05 Thread smichr
VERY helpful--thank you! Regarding the simplification issue, I ran this little script to show how much larger the roots are than they apparently have to be: ### p = -2 + 5*x**3 - 3*x**6 + x**9 tru = solve(p, x) d = decompose(p, x) p2roots=solve(d[1]-a,x) p1roots=solve(d[0],x) ans=[] for p2 in p2ro

[sympy] Re: what sort of polynomial is this?

2010-03-08 Thread smichr
Here's a draft of a Horner routine...any ideas where this might go? rewrite? def _horner(p, x, n=0): """recursive helper for horner.""" pow, co = p.TM[0], p.TC if pow == co == 0: return 0 else: t = co * Pow(x, pow) return Pow(x, pow - n)*(co + _horner(p -

[sympy] Re: what sort of polynomial is this?

2010-03-09 Thread Mateusz Paprocki
Hi, On Mon, Mar 08, 2010 at 08:43:42AM -0800, smichr wrote: > Here's a draft of a Horner routine...any ideas where this might go? > rewrite? > > def _horner(p, x, n=0): > """recursive helper for horner.""" > > pow, co = p.TM[0], p.TC > if pow == co == 0: > return 0 > els

Re: [sympy] Re: what sort of polynomial is this?

2010-03-08 Thread Ondrej Certik
On Mon, Mar 8, 2010 at 8:43 AM, smichr wrote: > Here's a draft of a Horner routine...any ideas where this might go? > rewrite? > > def _horner(p, x, n=0): >    """recursive helper for horner.""" > >    pow, co = p.TM[0], p.TC >    if pow == co ==  0: >        return 0 >    else: >        t = co *