From help-request at octave dot org Tue Nov 9 10:12:58 2004 Subject: Re: average of a function From: Paul Kienzle To: "Fred J." Cc: help at octave dot org Date: Tue, 9 Nov 2004 04:16:17 -0500 On Nov 8, 2004, at 10:36 PM, Fred J. wrote: > I need to determine the average value of this function > which I expect > it to be -1.620993 but I am getting a different ans > and not sure if I am > using octave correctly. > > octave> function y=x(t), y = t^2 - 5*t + 6*cos(pi*t); > end; > octave> quad('x', -1, 5/2) > ans = -5.6735 octave:5> format long octave:6> quad('x', -1, 5/2)/(5/2 - -1) ans = -1.62099257606588 - Paul ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------