MSPManipulate
MSPManipulate[expr, {u, umin, umax}]
generates interactive web controls that allow interactive manipulation of the value of u
MSPManipulate[expr, {u, umin, umax,du}]
allows the value of u to vary between umin and umax in steps du
MSPManipulate[expr, {{u,uinit}, umin, umax,…}]
takes the initial value of u to be uinit
MSPManipulate[expr, {{u,uinit,ulbl}, umin, umax,…}]
labels the controls for u with ulbl
MSPManipulate[expr, {u, {u1, u2,…}}]
allows u to take on discrete values u1,u2,…
MSPManipulate[expr, {u,…}, {v, …}, …]
provides controls to manipulate each of the u, v, …
Details
- MSPManipulate provides a web version of the function Manipulate.
- You must load the MSPManipulate` package to use the webMathematica interactive tools.
- MSPManipulate automatically formats the expression expr into an image.
- MSPManipulate creates the following controls by default.
-
{u, min, max} slider ranging in value from min to max {u, min, max, step} slider ranging in value from min to max in increments of step {u, {True, False}} checkbox {u, {u1, u2, …}} setter bar for few elements; popup menu for more {u} blank input field {{u,uinit},…} control with initial value uinit {{u,uinit,ulbl}, …} control with label ulbl - MSPManipulate takes the following options.
-
ContainerStyle formatting for the web page container ControlPlacement placement of controls ControlType type of controls to use FormatType the type of formatting to use OutputSize the size in pixels for the entire interactive control - ControlType and ControlPlacement pos options can be given separately for each control.
- The option setting ControlPlacement pos specifies that controls should be placed at positionpos relative to expr. Possible settings forpos are Bottom, Left, Right, and Top.
- The option setting ContainerStyle {styles…} gives styles for the web container. Possible style settings are:
-
"BorderColor" Black color to draw the border "BorderThickness" 1 thickness for the border "BorderStyle" solid style to draw the border "PaddingTop" 10 padding on the top "PaddingBottom" 10 padding on the bottom "PaddingLeft" 10 padding on the left "PaddingRight" 10 padding on the right - The option setting ControlsRendering type specifies the style used to render sliders. The default setting forpos is "Generic" which gives standard Flash sliders. Alternatively, it can be set to "FrontEnd.Windows" or "FrontEnd.Macintosh" which will display with the sliders similar to those used by the notebook front end on Windows or Macintosh respectively. A setting of "FrontEnd" will display with Macintosh sliders in browsers on Macintosh platforms otherwise it will use the front end Windows style.
Examples
open allclose allBasic Examples (1)
The following creates an interactive plot controlled by a slider and a checkbox.
<msp:evaluate>
MSPManipulate[
Plot[ Cos[var+x], {x,0,2Pi}, Frame -> frame],
{var, 0,20}, {frame, {True,False}}]
</msp:evaluate>
You can change the default style of some of the controls using the ControlType option. The following example uses a PopupMenu to represent the choices; without the option a SetterBar would be used.
<msp:evaluate>
MSPManipulate[ Plot[ fun[x],{x,0,20}], {fun, {Sin, Cos}},
ControlType -> PopupMenu]
</msp:evaluate>
MSPManipulate always formats its argument into an image; by default it uses StandardForm. However, it can be changed to format into TraditionalForm; which is shown in the following.
<msp:evaluate>
MSPManipulate[ Integrate[ 1/(1^-num),x], {num, 1,20,1},
FormatType -> TraditionalForm]
</msp:evaluate>
The size of the finished interactive web output can be controlled by the OutputSize option. This has a default that tries to keep track of the number of controls. If there is not enough space then scrollbars will be added automatically. In the following example a size of 800 by 800 pixels is used.
<msp:evaluate>
MSPManipulate[ Integrate[ 1/(1^-num),x], {num, 1,20,1},
OutputSize -> {800,800}]
</msp:evaluate>
Scope (3)
Style (1)
Static Labels (1)
You can include static expressions that don't render to controls in the list. These are useful for labelling.
<msp:evaluate>
MSPManipulate[ Plot[Sin[ x+phase],{x,0,2Pi}],
"Control Parameter for Phase",
{phase, 0,2Pi}]
</msp:evaluate>
The label can be displayed in different styles using a Style specification.
<msp:evaluate>
MSPManipulate[ Plot[Sin[fact x+phase],{x,0,2Pi}],
Style[ "Control Parameter for Phase", FontFamily ->"Times"],
{phase, 0,2Pi},
Style[ "Control Parameter for Factor", FontFamily ->"Times"],
{fact, 1,20}]
</msp:evaluate>
Control Label Formatting (1)
Options (4)
ContainerStyle (1)
ControlPlacement (1)
The ControlPlacement option can be used to change the location of the controls.
<msp:evaluate>
MSPManipulate[ Plot[Sin[x+var],{x,0,2Pi}],
{var, 0,2Pi},ControlPlacement -> Left]
</msp:evaluate>
You can give settings to individual controls.
<msp:evaluate>
MSPManipulate[ Plot[Sin[fact x+var],{x,0,2Pi}],
{var, 0,2Pi,ControlPlacement -> Left},
{fact, 1,20,ControlPlacement -> Right}]
</msp:evaluate>
ControlsRendering (1)
The ControlsRendering option can be used to change the appearance of sliders. The following gives the appearance of a Macintosh type slider.
<msp:evaluate>
MSPManipulate[ Plot[Sin[x+var],{x,0,2Pi}],
{var, 0,2Pi},ControlsRendering -> "FrontEnd.Macintosh"]
</msp:evaluate>
The following use the front end style for Macintosh in browsers on Macintosh platforms. Otherwise it uses the front end style for Windows.
<msp:evaluate>
MSPManipulate[ Plot[Sin[x+var],{x,0,2Pi}],
{var, 0,2Pi},ControlsRendering -> "FrontEnd"]
</msp:evaluate>