Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: MapleV: using evalhf with infinite integral.
Replies: 2   Last Post: Dec 6, 1996 1:53 AM

 Messages: [ Previous | Next ]
 Dave Seaman Posts: 2,446 Registered: 12/6/04
Re: MapleV: using evalhf with infinite integral.
Posted: Dec 5, 1996 10:26 AM

In article <m0viahuy1k.fsf@flash.bfr.co.il>,
David Klein <dklein@math.huji.ac.il> wrote:
>I would like to integrate a function like
>
>f:=exp(-x^2);
>
>evalhf(f,x=-infinity..infinity));

Since you said you were trying to integrate the function, I will assume you
meant to evaluate

evalhf(int(f,x=-infinity..infinity));

I would suggest you evaluate it as follows:

> int(f,x=-infinity..infinity);

1/2
Pi

> evalhf(");

1.772453850905516

As you can see, the first step is to evaluate the integral and get an
exact, symbolic result. No floating point computations are involved
here, and insisting on using floating point will only slow it down and
get a less precise answer. The second step, evaluating Pi^(1/2), is
the only place where floating point arithmetic is needed.

>but with a more time consuming integrand, f.
>
>evalf instead of evalhf works, but I am trying to be faster.

If the integral is one that Maple doesn't handle symbolically, then you
should try the following:

Digits := trunc(evalhf(Digits));
evalf(Int(f,x=-infinity..infinity));

With this setting of Digits, evalf and evalhf should give similar
results, though it is not clear whether the timing will be the same for
expressions on which both are applicable. With the simple f :=
exp(x^2), this method is MUCH slower than symbolic integration.

--
Dave Seaman dseaman@purdue.edu
++++ stop the execution of Mumia Abu-Jamal ++++
++++ if you agree copy these lines to your sig ++++
++++ see http://www.xs4all.nl/~tank/spg-l/sigaction.htm ++++

Date Subject Author
12/5/96 David Klein
12/5/96 Dave Seaman
12/6/96 Robert Israel