value - Maple Programming Help

value

evaluate inert functions

 Calling Sequence value(f)

Parameters

 f - any mathematical expression

Description

 • When Maple has two functions of the same name where one begins with a capital letter and one with lower case, the capitalized function is frequently an inert representation of the lower case function. More generally, any function whose name starts with the % character, as in %F, is an inert representation for the function F. This feature provides inert representations for any Maple or user-defined function.
 • During computations, inert functions remain unevaluated (the operations they represent remain unperformed). The value command maps these inert functions, such as Int or %exp, into the corresponding active functions int and exp. Note that, irrespective of the value command, while computing with inert functions, the differentiation, expansion, and printing properties of the active functions they represent (when defined using extension mechanisms, such as routines like diff/F) are automatically taken into account by the system.
 • The value function can also be extended to evaluate any function call, say F, even if there is no active version of it, by defining a procedure named value/F which takes the same arguments as F (for example, F(x)) and returns the desired evaluation.

Examples

The active form of int returns the evaluated integral.

 > $\mathrm{int}\left(x,x\right)$
 $\frac{{{x}}^{{2}}}{{2}}$ (1)

The inert form (Int) returns the unevaluated integral.

 > $F≔\mathrm{Int}\left(x,x\right)$
 ${F}{≔}{\int }{x}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}$ (2)

Use value to evaluate the integral when desired.

 > $\mathrm{value}\left(F\right)$
 $\frac{{{x}}^{{2}}}{{2}}$ (3)

Some frequently used inert representations:

 > $G≔\mathrm{Limit}\left(\frac{\mathrm{sin}\left(x\right)}{x},x=0\right)$
 ${G}{≔}\underset{{x}{\to }{0}}{{lim}}{}\frac{{\mathrm{sin}}{}\left({x}\right)}{{x}}$ (4)
 > $\mathrm{value}\left(G\right)$
 ${1}$ (5)
 > $\mathrm{value}\left(\left(\mathrm{Sum}\left(i,i=1..n\right)\right)+5\right)$
 $\frac{{\left({n}{+}{1}\right)}^{{2}}}{{2}}{-}\frac{{n}}{{2}}{+}\frac{{9}}{{2}}$ (6)

In this example an evaluation rule is defined for $B$ even when there exists no corresponding active function

 > $\mathrm{value/B}≔\left(a,b\right)↦\mathrm{binomial}\left(a,b\right)$
 ${\mathrm{value/B}}{≔}\left({a}{,}{b}\right){↦}\left(\genfrac{}{}{0}{}{{a}}{{b}}\right)$ (7)
 > $\mathrm{value}\left(B\left(10,5\right)\right)$
 ${252}$ (8)

The value command understands any function whose name starts with the $%$ character as being an inert function

 > $F≔x↦{x}^{2}+1$
 ${F}{≔}{x}{↦}{{x}}^{{2}}{+}{1}$ (9)
 > $\mathrm{%F}\left(a\right)$
 ${\mathrm{%F}}{}\left({a}\right)$ (10)
 > $\mathrm{value}\left(\right)$
 ${{a}}^{{2}}{+}{1}$ (11)

The same inert representation mechanism works with any Maple function or procedure

 > $\mathrm{%GAMMA}\left(\frac{1}{2}\right)$
 ${\mathrm{%GAMMA}}{}\left(\frac{{1}}{{2}}\right)$ (12)
 > $\mathrm{value}\left(\right)$
 $\sqrt{{\mathrm{\pi }}}$ (13)
 > $\mathrm{intg}≔\mathrm{%intat}\left(\mathrm{exp}\left(x\right)+1,x=H\left(x\right)\right)$
 ${\mathrm{%intat}}{}\left({\mathrm{exp}}{}\left({x}\right){+}{1}{,}{x}{=}{H}{}\left({x}\right)\right)$ (14)
 > $\mathrm{value}\left(\mathrm{intg}\right)$
 ${H}{}\left({x}\right){+}{{ⅇ}}^{{H}{}\left({x}\right)}$ (15)

Any differentiation, expansion or printing rule defined using the extension mechanism (e.g routines diff/F) are automatically taken into account by the system

 > $\mathrm{diff}\left(\mathrm{%GAMMA}\left(x\right),x\right)$
 ${\mathrm{\Psi }}{}\left({x}\right){}{\mathrm{\Gamma }}{}\left({x}\right)$ (16)
 > $\mathrm{%diff}\left(\mathrm{\Gamma }\left(x\right),x\right)$
 ${\mathrm{%diff}}{}\left({\mathrm{Γ}}{}\left({x}\right){,}{x}\right)$ (17)
 > $\mathrm{value}\left(\right)$
 ${\mathrm{\Psi }}{}\left({x}\right){}{\mathrm{\Gamma }}{}\left({x}\right)$ (18)
 > $\mathrm{%eval}\left(\mathrm{%diff}\left(\mathrm{%exp}\left(x\right),x\right),x=0\right)$
 ${\mathrm{%eval}}{}\left({\mathrm{%diff}}{}\left({\mathrm{%exp}}{}\left({x}\right){,}{x}\right){,}{x}{=}{0}\right)$ (19)
 > $\mathrm{value}\left(\right)$
 ${1}$ (20)

With package commands, the mapping from inert to active is performed taking into account the last package loaded at the time of performing the operation. For instance, a Transpose command exists in different packages with different meanings; in this example LinearAlgebra is the last package loaded, so that LinearAlgebra:-Transpose is the active form of the inert %Transpose

 > $\mathrm{with}\left(\mathrm{LinearAlgebra},\mathrm{Transpose}\right):$
 > $A≔\mathrm{Matrix}\left(\left[\left[a,b\right],\left[c,d\right]\right]\right)$
 $\left[\begin{array}{cc}a& b\\ c& d\end{array}\right]$ (21)
 > $\mathrm{%Transpose}\left(A\right)$
 ${\mathrm{%Transpose}}{}\left(\left[\begin{array}{cc}a& b\\ c& d\end{array}\right]\right)$ (22)
 > $\mathrm{value}\left(\right)$
 $\left[\begin{array}{cc}a& c\\ b& d\end{array}\right]$ (23)

The inert representation also works with indexed functions, for instance as those used in the Physics package

 > $\mathrm{with}\left(\mathrm{Physics},\mathrm{KroneckerDelta}\right)$
 $\left[{\mathrm{KroneckerDelta}}\right]$ (24)
 > $\mathrm{%KroneckerDelta}\left[a,a\right]$
 ${{\mathrm{%KroneckerDelta}}}_{{a}{,}{a}}$ (25)
 > $\mathrm{value}\left(\right)$
 ${1}$ (26)
 >