From owner-help-octave at bevo dot che dot wisc dot edu Wed Nov 29 03:27:49 1995 Subject: How to quad("sin(a*sin(x))*sin(x)",0,pi/2)? From: Francesco Potorti` To: Ian Searle Cc: niles at axp745 dot gsfc dot nasa dot gov, help-octave@bevo.che.wisc.edu Date: Wed, 29 Nov 1995 10:25 +0100 (MET) > for (i in 1:4) { quadr ("sin(p1*sin(x)).*sin(x)", 0, pi/2,1.e-6,0,i).Q } 0.691 0.906 0.533 -0.104 The above is a piece of Rlab code that does what you want (I think). The point is: I translated quadr from Matlab source. It is written by Kirill K. Pankratov (kirill at plume dot mit dot edu) I found the following in the matlab archives, form the contribution/integration directory or some like that, if I am not wrong. They should be public domain. I also have the sources. =================================================================== Index for integration =================================================================== nit: =================================================================== Numerical Integration Toolbox MATLAB Toolbox for 1-D, 2-D, and n-D Numerical Integration The original 1-D routines were obtained from NETLIB and were written by Howard Wilson Department of Engineering Mechanics University of Alabama Box 870278 Tuscaloosa, Alabama 35487-0278 Phone 205 348-1617 Email address: HWILSON at UA1VM.UA.EDU The rest of the routines were written by Bryce Gardner Ray W. Herrick Laboratories Purdue University West Lafayette, IN 47906 Phone: 317-494-0231 Fax: 317-494-0787 Email: gardner at ecn dot purdue dot edu These are the general purpose integration routines: quadg.m -- High accuracy replacement for QUAD and QUAD8 (1-D) quad2dg.m -- 2-D integration over a rectangular region quad2dggen.m -- 2-D integration over a general region quadndg.m -- n-D integration over a n-D hyper-rectangular region =================================================================== misc: Integration of math expressions =================================================================== dquad.m: DQUAD Numerically integrates an expression using QUAD. I = DQUAD('1/(1+x^3)',a,b) approximates, a / | 1 | ----------- dX | 3 | (1 + x ) / b D. Thomas 2/93 dethomas at athena dot mit dot edu dquad8.m: DQUAD Numerically integrates an expression using QUAD8. I = DQUAD8('exp(-x^2)/(1+x^(1/2))',a,b) approximates, a / 2 | exp(- x ) | --------- dx | 1/2 / 1 + x b D. Thomas 2/93 dethomas at athena dot mit dot edu trapz.m: a = trapz(y,x) find the area under the curve y = f(x) using the trapezoidal rule x = vector containing the independent variable data points the elements of x need not be equally spaced y = f(x) = vector of the function values corresponding to the elements in x a = the area under f(x) in the interval defined by x Written by: Duane Hanselman, University of Maine, (207)-581-2246