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

Charles R Harris charlesr.harris at gmail.com
Mon Dec 20 12:36:56 EST 2010


On Sun, Dec 19, 2010 at 10:28 AM, Pramod <pramo4d at gmail.com> wrote:

> 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 :
>
>
> That code is a complete mess. What is it trying to accomplish?

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20101220/6727e90f/attachment.html>


More information about the SciPy-User mailing list