num

141 days ago by anonymTm

def P(n, x): if n==0: return 1; if n==1: return x; if n>=2: return (((2*n - 1)*x*P(n-1, x) - (n-1)*P(n-2, x))/n); 
       
def int_gew(f, n, k): return (2*(1-x_n(f, n, k)^2)/((n+1)^2 * P(n, x_n(f, n, k))^2)); 
       
def GL_int(f, n): sum = 0; for i in range (0,n): a = int_gew(f, i)* f.subs(x=x_n(f, n, i)); sum = sum + a; return sum; 
       
def x_n(f, n, k): xn=[]; for j in range (0,n): xn.append([j]); xn[0]= (cos((4*k + 3)* pi/ (4*n + 6))).n(); g = diff(f, x); for i in range (1,n-1): f_x = f.subs(x=xn[i-1]).n(); g_x = g.subs(x=xn[i-1]).n(); xn[i] = xn[i-1] - (f_x/g_x); return xn[k]; 
       
f = e^(-x^2); for i in range(0,50): print int_gew(f, 100, i); 
       
WARNING: Output truncated!  
full_output.txt



Traceback (click to the left of this block for traceback)
...
__SAGE__
WARNING: Output truncated!  
full_output.txt



Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_85.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZiA9IGVeKC14XjIpOwpmb3IgaSBpbiByYW5nZSgwLDUwKToKICAgIHByaW50IGludF9nZXcoZiwgMTAwLCBpKTs="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpRq02qA/___code___.py", line 4, in <module>
    exec compile(u'for i in range(_sage_const_0 ,_sage_const_50 ):\n    print int_gew(f, _sage_const_100 , i);
  File "", line 2, in <module>
    
  File "/tmp/tmpTVHfN1/___code___.py", line 4, in int_gew
    return (_sage_const_2 *(_sage_const_1 -x_n(f, n, k)**_sage_const_2 )/((n+_sage_const_1 )**_sage_const_2  * P(n, x_n(f, n, k))**_sage_const_2 ));
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P

...

  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
  File "/tmp/tmpJYaP2Y/___code___.py", line 9, in P
    return (((_sage_const_2 *n - _sage_const_1 )*x*P(n-_sage_const_1 , x) - (n-_sage_const_1 )*P(n-_sage_const_2 , x))/n);
KeyboardInterrupt
__SAGE__