# Q on handling integral with upper limit = infinity

0 views

### Axel Vogt

Apr 25, 2003, 4:16:20 PM4/25/03
to
Hi,

on using 'simplify' on an integral with upper limit = infinity
i have problems with the symbolic calculation:

int( (y-K) *q(y),y=K..infinity); simplify(%) assuming real;
gives me 0 for 1/2*exp(-1/2*(ln(1/y)-1/2)^2)*2^(1/2)/Pi^(1/2)/y
taken as q(y) (this is a lognormal pdf).

But numerical it works correct, the example gives 0.3829249225:
Int( (y-K) *q(y),y=K..infinity); eval(%, [K=1.0]): evalf(%);

Did i make a handling error or is there a work around?

Axel

### Carl Devore

Apr 26, 2003, 4:07:55 PM4/26/03
to
Axel Vogt <ma...@axelvogt.de> wrote:
> on using 'simplify' on an integral with upper limit = infinity
> i have problems with the symbolic calculation:
>
> int( (y-K) *q(y),y=K..infinity); simplify(%) assuming real;
> gives me 0 for 1/2*exp(-1/2*(ln(1/y)-1/2)^2)*2^(1/2)/Pi^(1/2)/y
> taken as q(y) (this is a lognormal pdf).
>
> But numerical it works correct, the example gives 0.3829249225:
> Int( (y-K) *q(y),y=K..infinity); eval(%, [K=1.0]): evalf(%);

Surely the 0 answer is a bug. But I did not track it down. Rather,
1. Try to avoid global assumptions like "real", which the apply to all
functions and variables. Rather make assumptions about specific
variables.
2. It is sometimes useful to make the assumption that a variable of
integration or summation is between its limits. Also, for summation,
it is sometimes useful to assume the summation variable is integer.
Of course, Maple should make these assumptions automatically, but it
does not.

Putting these ideas together, the assumptions that work the best for
me in this case are
With this, Maple can do the original integral symbolically:

> restart;
> q:= y-> 1/2*exp(-1/2*(ln(1/y)-1/2)^2)*2^(1/2)/Pi^(1/2)/y:
> int((y-K)*q(y), y=K..infinity):
> simplify(%):
> combine(%);

K~ 1/2
1/2 - ---- - 1/2 erf((1/2 ln(K~) - 1/4) 2 )
2

1/2
+ 1/2 K~ erf((1/2 ln(K~) + 1/4) 2 )

### Axel Vogt

Apr 26, 2003, 5:32:32 PM4/26/03
to

Thank you for working out a work around! And sorry, i forgot
to include solutions.

does not work. Does that mean one has to be aware, that Maple
may use y as a bounded variable (in the sense: it is not local
in a formula int(f(y),y=...), i dont know how to express it
more exactly) ?

### Carl Devore

Apr 26, 2003, 8:03:58 PM4/26/03
to Axel Vogt

On Sat, 26 Apr 2003, Axel Vogt wrote:
> Does that mean one has to be aware, that Maple may use y as a bounded
> variable (in the sense: it is not local in a formula int(f(y),y=...),
> i dont know how to express it more exactly) ?

The phrase is "bound variable"; "bounded variable" means something else.
But I understand what you mean, and the answer is unfortunately yes, to
the consternation of the mathematical logic and theoretical computer
science purists: An assumption made outside the binding scope (1) can
affect the results of the command that uses the variable as bound, and (2)
this is often useful. Both of these are IMO design flaws of Maple and
both are I think pretty easy to fix.