Parameters - Maple Help

Physics[Parameters] - set symbols to work as constant parameters

 Calling Sequence Parameters( ) Parameters(a, b, ...)

Parameters

 a, b, ... - names

Description

 • The Parameters command allows you to define the parameters of a theory in such a way that no functionality can be attached to them. For example, if $m$ is defined as a parameter through Parameters(m), then $m\left(t\right)$ returns $m$, without any functionality.
 • To know which names are defined as parameters at some point in a session, call Parameters() without any arguments; the result is a set with the required information.
 • The cancellation of a parameter definition can be done by unassigning the variable. The unassignment is automatically taken into account in all subsequent calculations, as well as in any Parameters() requests for information.

Examples

 > $\mathrm{with}\left(\mathrm{Physics}\right):$
 > $\mathrm{Setup}\left(\mathrm{mathematicalnotation}=\mathrm{true}\right)$
 $\left[{\mathrm{mathematicalnotation}}{=}{\mathrm{true}}\right]$ (1)
 > $F≔kx$
 ${F}{≔}{k}{}{x}$ (2)

Notice that functionality has been attached to $k$ automatically.

 > $F\left(t\right)$
 ${k}{}\left({t}\right){}{x}{}\left({t}\right)$ (3)
 > $\mathrm{diff}\left(,t\right)$
 $\stackrel{{\mathbf{.}}}{{k}}{}\left({t}\right){}{x}{}\left({t}\right){+}{k}{}\left({t}\right){}\stackrel{{\mathbf{.}}}{{x}}{}\left({t}\right)$ (4)

In a model where $k$ is a constant, the above, with$\frac{ⅆk}{ⅆt}$, is undesired. You would like to be able to define $F$ in the simple way it has been done, and then have $F\left(t\right)$ return a result with $k$, not $k\left(t\right)$. This situation is addressed by the Parameters command. For example:

 > $\mathrm{Parameters}\left(k\right)$
 $\left\{{k}\right\}$ (5)

In this way, instead of the undesired result $k\left(t\right)$, you now have the constant $k$ defined as a parameter, with no functionality attached.

 > $F\left(t\right)$
 ${k}{}{x}{}\left({t}\right)$ (6)
 > $\mathrm{diff}\left(,t\right)$
 ${k}{}\stackrel{{\mathbf{.}}}{{x}}{}\left({t}\right)$ (7)

A typical use for the Parameters command is when computing equations of motion departing from a Lagrangian or a Hamiltonian (the Energy). Consider a harmonic oscillator of mass $m$, and $k$ is a constant parametrizing the restoring force. The Energy (Hamiltonian) in terms of the momentum $p$ and position $q$ is given by:

 > $\mathrm{Parameters}\left(m,k\right)$
 $\left\{{k}{,}{m}\right\}$ (8)
 > $H≔\frac{{p}^{2}}{2m}+\frac{1}{2}k{q}^{2}$
 ${H}{≔}\frac{{{p}}^{{2}}}{{2}{}{m}}{+}\frac{{k}{}{{q}}^{{2}}}{{2}}$ (9)

where in the above, $p$ and $q$ represent functions of time, while $m$ and $k$ represent constant parameters. Because $m$ and $k$ have been set by the Parameters command, no functionality is attached to them.

 > $H\left(t\right)$
 $\frac{{{p}{}\left({t}\right)}^{{2}}}{{2}{}{m}}{+}\frac{{k}{}{{q}{}\left({t}\right)}^{{2}}}{{2}}$ (10)

Now you can compute the Hamilton equations directly.

 > $\mathrm{eq}\left[1\right]≔\mathrm{diff}\left(q\left(t\right),t\right)=\mathrm{diff}\left(H\left(t\right),p\left(t\right)\right)$
 ${{\mathrm{eq}}}_{{1}}{≔}\stackrel{{\mathbf{.}}}{{q}}{}\left({t}\right){=}\frac{{p}{}\left({t}\right)}{{m}}$ (11)
 > $\mathrm{eq}\left[2\right]≔\mathrm{diff}\left(p\left(t\right),t\right)=-\mathrm{diff}\left(H\left(t\right),q\left(t\right)\right)$
 ${{\mathrm{eq}}}_{{2}}{≔}\stackrel{{\mathbf{.}}}{{p}}{}\left({t}\right){=}{-}{k}{}{q}{}\left({t}\right)$ (12)

It is now easy to see that the Energy of this oscillator is a constant; that is, it does not depend on $t$: differentiate the Energy (the Hamiltonian $H$), and introduce the equations of motion that were previously derived.

 > $\mathrm{diff}\left(H\left(t\right),t\right)$
 $\frac{{p}{}\left({t}\right){}\stackrel{{\mathbf{.}}}{{p}}{}\left({t}\right)}{{m}}{+}{k}{}{q}{}\left({t}\right){}\stackrel{{\mathbf{.}}}{{q}}{}\left({t}\right)$ (13)
 > $\mathrm{eval}\left(,\left[\mathrm{eq}\left[1\right],\mathrm{eq}\left[2\right]\right]\right)$
 ${0}$ (14)

The same computation can be performed without using Parameters. Define $H$ as a mapping, then you must use more complicated syntax to specify the parameters. See the last example in the help page for D for a demonstration of this method.

To query about the objects defined as parameters at any moment, enter the Parameters command with no arguments.

 > $\mathrm{Parameters}\left(\right)$
 $\left\{{k}{,}{m}\right\}$ (15)

To unset the symbol $k$ as a parameter, it suffices to unassign it.

 > $k≔'k'$
 ${k}{≔}{k}$ (16)

Now $k$ is not in the list of parameters, and it depends on $t$ in the function $H$.

 > $\mathrm{Parameters}\left(\right)$
 $\left\{{m}\right\}$ (17)
 > $H\left(t\right)$
 $\frac{{{p}{}\left({t}\right)}^{{2}}}{{2}{}{m}}{+}\frac{{k}{}\left({t}\right){}{{q}{}\left({t}\right)}^{{2}}}{{2}}$ (18)
 >