Attraction and Repulsion in Dynamical Systems

fmn[a_,b_,m_,n_,r_]:=-a
m
r
+b
n
r
;​​fmnxy[a_,b_,m_,n_,x_,y_]:=Module[{r},​​r=Sqrt[
2
x
+
2
y
];​​fmn[a,b,m,n,r]​​];
Manipulate[​​Module[{p2d,p3d},​​Switch[preset,​​1,{m=-1,n=-2,a=1000,b=10000,hRange=200,vRange=30},​​2,{m=-1,n=-2,a=5000,b=100000,hRange=200,vRange=70},​​3,{m=-1,n=-4,a=300,b=80000,hRange=100,vRange=25},​​4,{m=-2,n=-4,a=500,b=2500,hRange=50,vRange=30},​​5,{m=-3,n=-6,a=500,b=2500,hRange=50,vRange=30},​​6,{m=-6,n=-12,a=1000,b=10000,hRange=10,vRange=25}​​];​​preset=0;​​If[m≤n,n=m-1];​​p2d=Plot[fmn[a,b,m,n,r],{r,0.0,2hRange},PlotStyle{Orange,Thick},PlotRange{-vRange,vRange/2},FrameTrue,FrameStyleDirective[GrayLevel[.5]],AxesStyleDirective[GrayLevel[.75]],BackgroundNone,ImageSize{375,280},PlotLabelStyle[TraditionalForm[-a
m
r
+b
n
r
],"DisplayFormula",14]];​​p3d=Plot3D[​​fmnxy[a,b,m,n,x,y],{x,-hRange,hRange},{y,-hRange,hRange},PlotRange{-vRange,2},ImageSize{375,280},BoxStyleDirective[Dashed,GrayLevel[.8]],​​PlotLabelStyle[TraditionalForm[-a
m
r
+b
n
r
],"DisplayFormula",14],ImagePadding{{10,10},{10,25}}​​];​​Switch[ctrl,1,p2d,2,p3d]],​​{{m,-1,"m"},{-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11,-12},ControlTypeSetter,ControlPlacementTop},​​{{n,-1,"n"},{-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11,-12},ControlTypeSetter,ControlPlacementTop},​​{{a,1000,"a"},1,5000,1,Appearance"Labeled",ControlPlacementTop},​​{{b,10000,"b"},1,100000,1,Appearance"Labeled",ControlPlacementTop},​​{{preset,0,"presets"},{​​0"select",​​1"1: m= -1, n= -2, a=1000, b= 10000",​​2"2: m= -1, n= -2, a=5000, b=100000",​​3"3: m= -1, n= -4, a= 300, b= 80000",​​4"4: m= -2, n= -4, a= 500, b= 2500",​​5"5: m= -3, n= -6, a= 500, b= 2500",​​6"6: m= -6, n=-12, a=1000, b= 10000"​​},ControlTypePopupMenu,ControlPlacementTop},​​{{ctrl,2,""},{1"2D",2"3D"}},​​Style["ranges",Bold],​​{{hRange,200,"horizontal"},10,500,10,Appearance"Labeled",ImageSizeTiny},​​{{vRange,30,"vertical"},2,100,2,Appearance"Labeled",ImageSizeTiny},​​SaveDefinitionsTrue,ControlPlacementLeft​​]
​
m
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
n
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
a
1000
b
10000
presets
select
2D
3D
ranges
horizontal
200
vertical
30

CAPTION


DETAILS


THIS NOTEBOOK IS THE SOURCE CODE FROM
"Attraction and Repulsion in Dynamical Systems " from the Wolfram Demonstrations Project http://demonstrations.wolfram.com/AttractionAndRepulsionInDynamicalSystems/
◼
Contributed by: Stefan Ganev
A full-function Wolfram Mathematica system (Version 6 or higher) is required to edit this notebook.​GET WOLFRAM MATHEMATICA »
© Wolfram Demonstrations Project & Contributors|Terms of Use|Make a new version of this Demonstration »