Variable Declarations

Q: How can I declare that a variable n is an integer so that, for instance, [Graphics:inoutagr1.gif] becomes [Graphics:inoutagr2.gif]?

The simplest way is to use pattern matching with conditional testing. For example:

[Graphics:inoutagr4.gif][Graphics:inoutagr3.gif]
[Graphics:inoutagr4.gif][Graphics:inoutagr5.gif]

More elaborate patterns can handle arbitrary expressions.

To demonstrate the validity of the substitution, we can simplify the right hand side using [Graphics:inoutagr6.gif].

[Graphics:inoutagr4.gif][Graphics:inoutagr7.gif]
[Graphics:inoutagr4.gif][Graphics:inoutagr8.gif]

For integral [Graphics:inoutagr9.gif], implemented via the substitution [Graphics:inoutagr10.gif], this expression equals [Graphics:inoutagr11.gif].

[Graphics:inoutagr4.gif][Graphics:inoutagr12.gif]
[Graphics:inoutagr4.gif][Graphics:inoutagr13.gif]