[SciPy-User] Want to write Matlab program in python

V Pramod pramo4d at gmail.com
Sat Dec 18 11:41:20 EST 2010


Hi Friends  I Want to Convert following matlab code into the python code 
using scipy 

Highleted part : i am not geeting idea How to handle chebshev polynomial in 
scipy

Anyone sugest How to write this in python 

Nmax = 50; E = zeros(3,Nmax);
for N = 1:Nmax;
[D,x] = cheb(N);   what is syntax in scipy for this 
v = abs(x).^3; vprime = 3*x.*abs(x); % 3rd deriv in BV
E(1,N) = norm(D*v-vprime,inf);
v = exp(-x.^(-2)); vprime = 2.*v./x.^3; % C-infinity
E(2,N) = norm(D*v-vprime,inf);
v = 1./(1+x.^2); vprime = -2*x.*v.^2; % analytic in [-1,1]
E(3,N) = norm(D*v-vprime,inf);
v = x.^10; vprime = 10*x.^9; % polynomial
E(4,N) = norm(D*v-vprime,inf);
end

I tried in Ipython following error I am getting :
for i in range(1,20):
   ....:     [D,i]=scipy.special.chebyu(3)(0.2)

ERROR IS :'numpy.float64' object is not iterable

Thanks in Advance 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20101218/b7841671/attachment.html>


More information about the SciPy-User mailing list