A customer on Twitter recently asked why Maple gives the following result:

 

 


The issue here is that the t in f(t) is the same as the integration variable. 140 characters is not a lot to work with for a reply, so here is a longer explanation.

 

First, note that the process of integration treats the integration variable differently than the other variables, so that replacing another variable by the integration variable has a different effect depending on whether the replacement is done before or after the integration is performed. Consider this simple example:

 

a := int(t, t)

(1/2)*t^2

(4)

eval(a, t = x)

(1/2)*x^2

(5)

a := int(x, t)

x*t

(6)

   

eval(a, t = x)

x^2

(7)

 

In other words, integration does not commute with substitution. This is a fundamental property of integration and in fact, Maple's eval has special rules to take this into account when you ask it to replace the integration variable.  For example, if you evaluate the inert form of the integral at x = y, the substitution is performed explicitly:

 

 

eval(Int(x-t, t = 0 .. x), x = y)

Int(y-t, t = 0 .. y)

(8)

value(Int(y-t, t = 0 .. y))

(1/2)*y^2

(9)

 

However, if you try to evaluate at x = t, the evaluation is delayed until after the integral is evaluated:

 

eval(Int(x-t, t = 0 .. x), x = t)

eval(Int(x-t, t = 0 .. x), {x = t})

(10)

 

value(eval(Int(x-t, t = 0 .. x), {x = t}))

(1/2)*t^2

(11)

 

The eval command knows it shouldn't substitute into an integral when the substitution involves the variable of integration.

 

However, in the user's example, asking Maple for f(t) is equivalent to substitution directly before the integration is performed, like this:

 

subs(x = t, Int(x-t, t = 0 .. x))

Int(0, t = 0 .. t)

(12)

which of course gives:

 

value(%)

0

(13)

 

Another way to have the two t variables be considered distinct is to explicitly make the integration variable a dummy by declaring it local:

 

f := proc (x) local t; int(x-t, t = 0 .. x) end proc
 

Now the ts are treated differently:

 

f(t)

(1/2)*t^2

(14)

``

Austin Roche

Senior Math Developer

Maplesoft

 

Download integration_variables.mw


Please Wait...