What's New in Manipulate in Mathematica 7

Lou D'Andria

Wolfram Research

Manipulate -- a high-level function for creating instant interfaces, and the basis for the Wolfram Demonstrations Project -- has grown a bit in Mathematica 7. We'll look at a few of the new and extended features, and then open the floor to questions.

Three main new and extended features

Annotations

Control

ContentSize

Extended in V7: Annotations

Manipulate[x,"Change the value:",{x,0,1}]

In V6

{Button, Dynamic, ExpressionCell, Item, Row, String, Style, Text, TextCell}

In V7

{Column,Grid,Item,Row,Framed,Labeled,Pane,Panel,Spacer,PaneSelector,ExpressionCell,Invisible,Magnify,Rotate,Style,Text,TextCell,ActionMenu,Button,ButtonBar,Hyperlink,PasteButton,Dynamic,DynamicModule,DynamicWrapper,FlipView,MenuView,OpenerView,PopupView,SlideView,TabView,Annotation,Deploy,Tooltip,Mouseover,StatusArea,PopupWindow}

Manipulate[x,{x,0,1},PopupWindow["Help…","Help goes here."]]

Use Item and ControlPlacement to place annotations

Manipulate[x,{x,0,1},Item[PopupWindow["Help…","Help goes here."],ControlPlacement -> Bottom]]

Advanced example

Manipulate[Grid[Take[data,h,w]],
{{data,RandomInteger[{0,1},{10,20}]},ControlType->None},
{{h,5},1,10,1},
{{w,10},1,20,1},
Panel[Dynamic[Grid[Table[With[{i=i,j=j},Checkbox[Dynamic[data[[i,j]]],{0,1}]],{i,h},{j,w}]]]]]

New in V7: Control

Manipulate[{x,y,z},{x,0,1},{y,0,1},{z,0,1}]

Manipulate[{x,y,z},{x,0,1,ControlType -> None},{y,0,1,ControlType -> None},{z,0,1,ControlType -> None},Row[{"x",Slider[Dynamic[x],{0,1}],"y",Slider[Dynamic[y],{0,1}],"z",Slider[Dynamic[z],{0,1}]},"   "]]

In V7

Manipulate[{x,y,z},Row[{{x,0,1},{y,0,1},{z,0,1}}]]

Manipulate[{x,y,z},Row[{Control[{x,0,1}],Control[{y,0,1}],Control[{z,0,1}]}]]

Outside Manipulate

Control[{x,0,1}]

OpenerView

Manipulate[Plot[amp f[freq x],{x,0,6},PlotStyle->{color,Dashing[dashing],Thickness[thickness]},Axes->axes,Frame->frame,AxesOrigin->axesorigin,PlotLabel->f],

{f,{Sin,Cos,Tan}},
OpenerView[{"More",Column[{
Item["Function variations",Alignment -> Center],
Control[{freq,1,5}],
Control[{amp,1,5}],
Item["Axes and Frames",Alignment -> Center],
Control[{axes,{True,False}}],
Control[{frame,{False,True}}],
Control[{axesorigin,{0,0},{6,1}}],
Item["Plot Style",Alignment -> Center],
Control[{color,Blue}],
Control[{dashing,0,0.1}],
Control[{thickness,0.001,0.1}]}]}]]

PaneSelector

Jeff Bryant

Manipulate[
cpts={{pt1,pt2,pt3,pt4},{pt5,pt6,pt7,pt8}};
Graphics3D[{BSplineSurface[cpts],Green,PointSize[.05],Point[cpts],Black,If[labels,{Text[1,pt1],Text[2,pt2],Text[3,pt3],Text[4,pt4],Text[5,pt5],Text[6,pt6],Text[7,pt7],Text[8,pt8]},{}]},ImageSize->{400,400},PlotRange->1],

{{labels,True,"show point labels"},{True,False}},

{{pt,1,"select control point"},{1,2,3,4,5,6,7,8}},

PaneSelector[{
1->Control[{{pt1,{0,0,0}},{-1,-1,-1},{1,1,1}}],2->Control[{{pt2,{-0.3,0.8,0.9}},{-1,-1,-1},{1,1,1}}],3->Control[{{pt3,{-0.2,0,0.6}},{-1,-1,-1},{1,1,1}}],4->Control[{{pt4,{0.3,0.7,-0.7}},{-1,-1,-1},{1,1,1}}],5->Control[{{pt5,{-0.4,0.9,-0.1}},{-1,-1,-1},{1,1,1}}],6->Control[{{pt6,{-0.4,-0.8,0.7}},{-1,-1,-1},{1,1,1}}],7->Control[{{pt7,{0.4,-0.1,0.2}},{-1,-1,-1},{1,1,1}}],8->Control[{{pt8,{0,-0.4,-0.5}},{-1,-1,-1},{1,1,1}}]},Dynamic[pt]],

TrackedSymbols->True]

New in V7: ContentSize

Manipulate[Fibonacci[n,z],{n,1,200,1}]

In V7

Manipulate[Fibonacci[n,z],{n,1,200,1},ContentSize -> {400,400}]

Manipulate[Graphics[Disk[],ImageSize -> n],{n,{Tiny,Small,Medium,Large}},ContentSize -> {400,400},FrameMargins -> 0]

New in V7: Non-headliners

DefaultControlPlacement

UnsavedVariables, UntrackedVariables

Experimental`TrackingFunction

Manipulate[Plot[Sin[x],{x,0,10}],{{pt,{0,0}},{0,-1},{100,1},Locator,Experimental`TrackingFunction -> ((pt={First[#],Sin[First[#]]})&)}]

Manipulate[Plot[f[x],{x,0,15},Filling->Bottom],{{pt,{0,0}},{0,0},{15,f[15]},Locator,Experimental`TrackingFunction -> ((pt={First[#],Min[f[First[#]],Last[#]]})&)},Initialization:>(f[x_]:=2 Sin[x]+x)]

Questions?