I was trying out a program for legendre's function as given below, but it showed some error. I'm not used to arrays in Python, but know them in C++.
from math import *
j = 0
arr = [0 for i in range (6)]
k= 3.75
arr[0]= 1
arr[1] = 1
x0= -1
xf = 1
x= x0
h= 0.1
f1 = open('leg.dat', 'w')
while x< xf:
for j in range(0,5):
arr[j+2]= (arr[j] *(j*j + j -k)/((j+2)*(j+1)))
print >>f1, x,(x**j)*(((j+2)(j+1)*arr[j]) - (j*(j-1)*arr[j]) - (2*j*arr[j]) + k*arr[j])
x = x+h
f1.close ()
error shown :
print>>f1, x,(x**j)*(((j+2)(j+1)*arr[j]) - (j*(j-1)*arr[j]) - (2*j*arr[j]) + k*arr[j])
TypeError: 'int' object is not callable