why am i getting an error SyntaxError : invalid syntax for this code

Posted by eragon1189 on Stack Overflow See other posts from Stack Overflow or by eragon1189
Published on 2012-09-29T21:31:34Z Indexed on 2012/09/29 21:37 UTC
Read the original article Hit count: 171

Filed under:
|

This is a code in python which calculates f (x) =? ((-1)*x)/(x*x+n*n) n from 1 to infinite.... correct to 0.0001, for the range 1 < x < 100 in steps of 0.1.But i am getting an syntax error,as i am new to programming in python...

    from scipy import *
    from matplotlib.pyplot import *
    x=arange(0.1,100,0.1)
    f=zeros(len(x))
    s=-1
    for n in range (1,10000):
        t=s*x/(x*x+n*n)
        f +=t
        s =-s
        if max(abs(t))< 1e-4
            break
    for xx in c_[x,f]:
        print "%f    %f" % (xx[0],xx[1])

© Stack Overflow or respective owner

Related posts about python

Related posts about python-2.7