# Re: Newbie question : plotting an integrated function

On 2/27/07, Michael Gilbert <michael.s.gilbert@gmail.com> wrote:

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;

scipy does for sure, and might even use the same routines as octave.
( Philippe, if you're interested in the scipy route, I can provide
more details. Which way you go depends on what you're familiar with
and what your future plans are. The octave solution seems rather
easy.)

however, you can always implement the midpoint, trapezoidal, or
simpsons rule easily yourself (bonus points if you implement Gaussian
quadrature as well).
mike
--
To UNSUBSCRIBE, email to debian-science-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

**Reply to:**