[SciPy-user] question about scipy.polynomial.poly1d

David M. Cooke cookedm at physics.mcmaster.ca
Wed Dec 21 10:44:55 CST 2005


On Dec 16, 2005, at 13:39 , Travis Oliphant wrote:

> Alan G Isaac wrote:
>
>> On Fri, 16 Dec 2005, Michael Blazej apparently wrote:
>>
>>
>>> Is there a way to get different variables into poly1d such
>>> as 'y' or 'lamda'.
>>>
>>>
>>
>>
>>
> I think he may mean in printing.  In other-words can you get it to  
> print
> with a different variable.   Right now, no.  But, it wouldn't be that
> hard to change (at least for single-character replacements).

Quite simple, actually. The _raise_power() helper routine doesn't  
need to know the length of the variable, so it's s a simple matter of  
using a different string for it:

 >>> q = poly1d([1.,2,3], variable='y')
 >>> print q
    2
1 y + 2 y + 3
 >>> q = poly1d(q, variable='lambda')
 >>> print q
         2
1 lambda + 2 lambda + 3

This is in the current SVN now.

-- 
|>|\/|<
/------------------------------------------------------------------\
|David M. Cooke              http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca



More information about the SciPy-user mailing list