python - object of type 'int' has no len() -


i have seen other posts on here no 1 me yet. i'm confused. please comment if know what's going on here.

my code:`

from scipy.integrate import quad  sympy.mpmath import *  k=0.0 i=0.0  def i_2(x, k):         return cos(2*pi*k/sqrt(1-(1-k**2)*cos(x)**2))-1  while k<=0.2:          k = k +         result = quad(i_2, 0, pi, k, args=())         print(result)         i=0.1` 

the wild import use here :

from sympy.mpmath import * 

shadows quad imported here:

from scipy.integrate import quad  

see:

from scipy.integrate import quad sympy.mpmath import * print(quad.__module__)  # sympy.mpmath.calculus.quadrature 

instead, flip import order:

from sympy.mpmath import * scipy.integrate import quad print(quad.__module__)  # scipy.integrate.quadpack 

or (much) better yet (and preferred) avoid using wild import altogether:

from scipy.integrate import quad sympy.mpmath import cos, pi, sqrt print(quad.__module__)  # scipy.integrate.quadpack 

also, you'll need remove args=() code work:

from scipy.integrate import quad sympy.mpmath import cos, pi, sqrt  k=0.0 i=0.0  def i_2(x, k):     return cos(2*pi*k/sqrt(1-(1-k**2)*cos(x)**2))-1  while k<=0.2:     k = k +     result = quad(i_2, 0, pi, k)     print(result)     i=0.1 

output:

 (0.0, 0.0) (-1.8582851152906286, 8.932955791447448e-09) (-3.376947682538414, 1.3760007564395206e-08) (-4.297856700579023, 2.455769416130881e-12) 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -