[SciPy-user] Usage of integrate.quadrature

Nils Wagner nwagner at mecha.uni-stuttgart.de
Wed Jun 8 09:00:46 CDT 2005


Hi all,

Is it possible to use integrate.quadrature with respect to a function that
returns a two-dimensional array ?

from scipy import *

l=0.1

def h(zeta):
#
#  Shape functions
#
   tmp = zeros(4,Float)
   tmp[0] = 1-3*zeta**2+2*zeta**3
   tmp[1] = (-zeta+2*zeta**2-zeta**3)*l
   tmp[2] = 3*zeta**2-2*zeta**3
   tmp[3] = (zeta**2-zeta**3)*l
   return tmp

def hd(zeta):
   tmp = zeros(4,Float)
   tmp[0] = -6*zeta+6*zeta**2
   tmp[1] = (-1+4*zeta-3*zeta**2)*l
   tmp[2] = 6*zeta-6*zeta**2
   tmp[3] = (2*zeta-3*zeta**2)*l
   return tmp

def hdd(zeta):
   tmp = zeros(4,Float)
   tmp[0] = -6+12*zeta
   tmp[1] = (4-6*zeta)*l
   tmp[2] = 6-12*zeta
   tmp[3] = (2-6*zeta)*l
   return tmp

def func(zeta):
#   print outerproduct(h(zeta),h(zeta))
   return outerproduct(h(zeta),h(zeta))

#
# This version doesn't work
#
val,err= integrate.quadrature(func, 0.0,1.0)

 
Nils




More information about the SciPy-user mailing list