[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Newbie question : plotting an integrated function



On 2/27/07, Philippe Saade wrote:
i'am very sorry about this basic question but i am trying to find the
easiest way to plot (with matplotlib, gnuplot, anything .... but not
Maple(tm)) an integrated function

For example, \int_{x}^{2x} \dfrac{1}{1+\atan(t)}dt ...

octave will do the job quite easily (and if you are familiar at all
with matlab, then you will be right at home).

$ sudo apt-get install octave octplot
$ octave
toggle_octplot
x = 1:10
f = @(t) 1/(1 + atan(t))
for n = 1:length(x)
I(n) = quad(f, x(n), 2*x(n))
end
plot(I)

if you don't do "toggle_octplot", gnuplot will be used instead (which
i think is too ugly to be usable).

i don't think python's scipy or numpy have integration routines;
however, you can always implement the midpoint, trapezoidal, or
simpsons rule easily yourself (bonus points if you implement Gaussian
quadrature as well).

mike



Reply to: