[SciPy-User] I want to convert following matlab program into the python programme

Pramod pramo4d@gmail....
Sun Dec 19 11:28:43 CST 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


More information about the SciPy-User mailing list