m1[]:=DynamicModule[{log="log",a="a",b="b",x="x",y="y",f1,f2,f3,f4,f5,f6,f7,f8,f9,f10},Manipulate[
Pane[Text[Style[TraditionalForm@Switch[
button,
f1,logdef[b,x,y],
f2,logbase[b],
f3,logone[b],
f4,logproduct[b,x,y],
f5,logreciprocal[b,x],
f6,logdivision[b,x,y],
f7,logbasepower[b,x,y],
f8,logpower[b,x,y],
f9,logflip[a,b],
f10,logswitch[a,b,x]
],18,Black]],
ImageSize->{450,250}],{{button ,f1,"rule:"} , {f1->  "definition ", f2-> " (Subscript[log, b])(b) ", f3->" (Subscript[log, b])(1) ",f4->" (Subscript[log, b])(x y) ",f5->" (Subscript[log, b])((1/x)) ",f6->" (Subscript[log, b])((x/y)) ",f7->" (Subscript[log, b])((b^x)) ",f8->" (Subscript[log, b])((y^x)) ",f9->" (Subscript[log, a])(b) ",f10->" (Subscript[log, a])(x) "},ControlType->SetterBar}, SaveDefinitions->True ],

Initialization:>(

logdef[b_,x_,y_]:=Row[{
"Definition:\n",
"Assuming ", b>0, " and ",x>0,",\n\n",
y," = ",(Subscript[log, b])[x]," if and only if ",(b^y)," = ",x,".\n\n",
"In words: the log of ", x, " to the base ", b, "\nis the power of ", b, " needed to give ", x,".","\n\n",
"Short form: ",
(b^((Subscript[log, b])[x]))," = ", x
}];
logbase[b_]:=Row[{
"Since\n", Superscript[b,1]," = ", b,",\n\nit follows that\n", 
(Subscript[log, b])[b], " = ",1,"."
}];

logone[b_]:=Row[{
"Since\n", Superscript[b,0]," = ", 1,",\n\nit follows that\n", 
(Subscript[log, b])[1], " = ",0,"."
}];
logproduct[b_,x_,y_]:=Row[{
"Since\n",x y," = ", Superscript[b,(Subscript[log, b])[x]] Superscript[b,(Subscript[log, b])[y]]," = ",  Superscript[b,(Subscript[log, b])[x]+(Subscript[log, b])[y]],",\n\nit follows that\n", 
(Subscript[log, b])[x y], " = ",(Subscript[log, b])[x]+(Subscript[log, b])[y],"."
}];
logreciprocal[b_,x_]:=Row[{
"Since\n",(1/x)," = ",(1/( Superscript[b,(Subscript[log, b])[x]]))," = ",  Superscript[b,-(Subscript[log, b])[x]],",\n\nit follows that\n", 
(Subscript[log, b])[(1/x)], " = ",-(Subscript[log, b])[x],"."
}];
logdivision[b_,x_,y_]:=Row[{
"Since\n",(x/y)," = ",(( Superscript[b,(Subscript[log, b])[x]])/( Superscript[b,(Subscript[log, b])[y]]))," = ",  Superscript[b,(Subscript[log, b])[x]-(Subscript[log, b])[y]],",\n\nit follows that\n", 
(Subscript[log, b])[(x/y)], " = ",(Subscript[log, b])[x]-(Subscript[log, b])[y],"."
}];
logbasepower[b_,x_,y_]:=Row[{
"Since\n",(b^x)," = ",  Superscript[b,x ],",\n\nit follows that\n", 
(Subscript[log, b])[(b^x)], " = ",x ,"."
}];
logpower[b_,x_,y_]:=Row[{
"Since\n",(y^x)," = ", "(",Superscript[b,(Subscript[log, b])[y]],((")")^x)," = ",  Superscript[b,x (Subscript[log, b])[y]],",\n\nit follows that\n", 
(Subscript[log, b])[(y^x)], " = ",x (Subscript[log, b])[y],"."
}];
logflip[a_,b_]:=Row[{
"Since\n",a," = ",Superscript[a,1]," = ", Superscript[a,TraditionalForm[TraditionalForm@"(Subscript[log, a])(b)"/TraditionalForm@"(Subscript[log, a])(b) "]]," = ", "(",  Superscript[a,(Subscript[log, a])[b]],")"," = ",(b^(1/((Subscript[log, a])[b]))),",\n\nit follows that\n", 
(Subscript[log, b])[a], " = ",(1/((Subscript[log, a])[b])),"."
}];



logswitch[a_,b_,x_]:=Row[{"Since ",(Subscript[log, b])[x]," = ",(Subscript[log, b])[(a^((Subscript[log, a])[x]))]," = ",(Subscript[log, a])[x](Subscript[log, b])[a],",","\n\nit follows that, dividing by ", (Subscript[log, b])[a]," and switching sides,\n",(Subscript[log, a])[x]," = ",(((Subscript[log, b])[x])/((Subscript[log, b])[a])),"."}];
)
]

m2[]:=DynamicModule[{log="log",a="a",b="b",x="x",y="y",f1,f2,f3,f4,f5,f6,f7,f8,f9,f10},Manipulate[
Pane[Text[Style[TraditionalForm@Switch[
button,
f1,productsamebase[a,mm,nn],
f2,divisionsamebase[a,mm,nn],
f3,powersamebase[a,mm,nn],
f4,productsamepower[a,b,mm],
f5,dividesamepower[a,b,mm],
f6,zeropower[a],
f7,minusonepower[a],
f8,negativepower[a,mm],
f9,reciprocalpower[a,mm]
],14,Black]],
ImageSize->{510,360}],
{{mm,2,"m ≥ 0"},0,9,1,Appearance->"Labeled",Enabled->Not[button===f6||button=== f7]},
{{nn,5,"n ≥ 0"},0,9,1,Appearance->"Labeled",Enabled->button==f1||button==f1||button==f2||button==f3} , {{button ,f1,"laws, assuming a, b > 0:"} , {f1->  "(a^m)(a^n) ", f2-> " ((a^m)/(a^n)) ", f3->" ((a^m))^n ",f4->" (a b)^m ",f5->TraditionalForm[((((a/b)))^m)],f6->" (a^0) ",f7->" (a^(-1)) ",f8->"(a^(-m))",f9->" (a^(1/m)) "},ControlType->SetterBar}, SaveDefinitions->True,

Initialization:>(

divisionsamebase[a_,m_,n_]:=Row[{
(a^m)," ÷ ",(a^n),
"  = ",
Overscript[Overscript[Row@If[m===0,{1},Riffle[Table[a,{m}]," × "]],⏞],Row[{m,If[m==1," time"," times"]}]],
"  ÷  ",
Overscript[Overscript[Row@If[n===0,{1},Riffle[Table[a,{n}]," × "]],⏞],Row[{n,If[n==1," time"," times"]}]],
" \n\n =   ",
Switch[
Sign[m-n],
1,
Row[{Overscript[Overscript[Row@Riffle[Table[a,{m-n}]," × "],⏞],Row[{m-n,If[m-n==1," time"," times"]}]],"  \n\n =   ",(a^(m-n))}],
-1,
Row[{1/Underscript[Underscript[Row@Riffle[Table[a,{n-m}]," × "],⏟],Row[{n-m,If[n-m==1," time"," times"]}]],"  \n\n =   ",(a^(m-n))}],
0,
1
]
}];

productsamebase[a_,m_,n_]:=Row[{
(a^m)," × ",(a^n),
"  = ",
Overscript[Overscript[Row@If[m===0,{1},Riffle[Table[a,{m}]," × "]],⏞],Row[{m,If[m==1," time"," times"]}]],
"  ×  ",
Overscript[Overscript[Row@If[n===0,{1},Riffle[Table[a,{n}]," × "]],⏞],Row[{n,If[n==1," time"," times"]}]],
" \n\n =   ",
Overscript[Overscript[Row@If[m+n===0,{1},Riffle[Table[a,{m+n}]," × "]],⏞],Row[{m+n,If[m+n==1," time"," times"]}]],
"  \n\n =   ",
(a^(m+n))
}];

powersamebase[a_,m_,n_]:=Row[{
HoldForm[((((a^m)))^n)],
"  = ",
Row[If[n===0,{1},Riffle[
Table[
Overscript[
Overscript[Row@If[m===0,{1},Riffle[Table[a,{m}]," × "]],⏞
],
Row[{m,If[m==1," time"," times"]}]
],
{n}
],
"  ×  "
]]
],
Row[{"   ( " ,n,If[n==1," time"," times"], " )"}],
"  \n\n =   ",
Row@If[m n===0,{1},Riffle[Table[a,{m n}]," × "]],Row[{"   ( " ,m n,If[m n==1," time"," times"], " )"}],
"  \n\n =   ",
(a^(m n))
}];


productsamepower[a_,b_,m_]:=Row[{
HoldForm[(((a b))^m)],
"  = ",
Overscript[Overscript[Row@If[m===0,{1},Riffle[Riffle[Table[a,{m}],Table[b,{m}]]," × "]],⏞],Row[{m,If[m==1," time"," times"]}]],
"  \n\n =   ",
Overscript[Overscript[Row@If[m===0,{1},Riffle[Table[a,{m}]," × "]],⏞],Row[{m,If[m==1," time"," times"]}]],
"  ×  ",
Overscript[Overscript[Row@If[m===0,{1},Riffle[Table[b,{m}]," × "]],⏞],Row[{m,If[m==1," time"," times"]}]],
"  \n\n =   ",
If[m===0,1,Row[{(a^m)," ",(b^m)}]]
}];

dividesamepower[a_,b_,m_]:=Row[{
HoldForm[((((a/b) ))^m)],
"  = ",
Overscript[Overscript[Row[Riffle[Table[TraditionalForm[(a/b)],{m}]," × "]],⏞],Row[{m,If[m==1," time"," times"]}]],
" \n\n =   ",
1/Underscript[Underscript[Row@Riffle[Table[b,{m}]," × "],⏟],Row[{m,If[m==1," time"," times"]}]]Overscript[Overscript[Row@Riffle[Table[a,{m}]," × "],⏞],Row[{m,If[m==1," time"," times"]}]],
"  \n\n =   ",
((a^m)/(b^m))
}];

zeropower[a_]:=Row[{
"Add up the exponents to get\n\n",
HoldForm[a]," × ",TraditionalForm[(a^("0"))]," =  ",,TraditionalForm[(a^("1"))]," × ",TraditionalForm[(a^("0"))]," =  ",(a^(TraditionalForm["1" +"0"]))," =  ",TraditionalForm[(a^("1"))],," =  ",TraditionalForm[a], ".","  \n\n",
"Dividing both sides by ", a, ",  \n\n",
TraditionalForm[(a^("0"))], " =  ",1,"."
}];


minusonepower[a_]:=Row[{
"Extending the addition of exponents to negative integers, \n\n",
a," × ",Superscript[a,-1]," =  ",TraditionalForm[(a^1)]," × ",Superscript[a,-1]," =   ",(a^(TraditionalForm["1" - "1 "]))," =  ",TraditionalForm[(a^("0"))]," =  ",1, ".","  \n\n",
"Dividing both sides by a, \n\n",
Superscript[a,-1], " =  ",TraditionalForm[(1/a)],"."
}];

negativepower[a_,m_]:=Row[{
Superscript[a,-m]," =  ","(",Superscript[a,-1],((")")^m)," =  ","(",(1/a),((")")^m)," =  ",((Superscript[1,m])/(a^m))," =  ",(1/(a^m)), "."
}]/;m>1;


negativepower[a_,0]:=Row[{
"(1/m) is not defined for m = 0."
}];

negativepower[a_,1]:=minusonepower[a];


reciprocalpower[a_,0]:=Row[{Superscript[a,Row[{"-",0}]], " = ",Superscript[a,0]," = ", 1,"."
}];

reciprocalpower[a_,1]:=Row[{"This case is trivial: \n\n",
(a^(1/(TraditionalForm[1])))," =  ",TraditionalForm@(a^1)," =  ",a,"."
}];


reciprocalpower[a_,m_]:=Row[{"Simplify \n\n",
Superscript[Row[{"(",(a^(1/(TraditionalForm[m]))),")"}],m]," =  ",Superscript[a,Row[{TraditionalForm[(("1")/(ToString[m]<>" "))ToString[m]]}]]," =  ",TraditionalForm[(a^1)]," =  ",a,".  \n\n",
"Take the ",
Switch[
m,
2,
Row[{"square"}],
3,
Row[{"cube"}],
4,
Row[{"fourth"}],
5,
Row[{"fifth"}],
_,
 Row[{m,"th"}]
]," root of both sides to get \n\n",
(a^(1/(TraditionalForm[m])))," =  ", (a^(1/m)),"."
}]/;m>1;



) ]

]

m3[]:=DynamicModule[{},

Manipulate[
Pane[
Text@Style[
Which[
gs=="number base",
Row[{Style[ToString[b]^ToString[e],Lighter[Blue]], " = ",
If[e==1, Style[b, Lighter[Red]],
If[e≥1,
Style[Grid[{Riffle[Flatten@Table[{ToString[b*(n/n)]},{n,1,e}],"×"]},Alignment -> {Center,Center}],Lighter[Red]],
If[e==0,Style[Grid[{ {ToString[b]^ToString[1],"×"  ,ToString[b]^ToString[-1],Style[" = ",Black],ToString[b^1] ,"×"  ,ToString[ b^-1]}},Alignment->{Center,Center}] ,Lighter[Red]],

Style[Grid[{Riffle[Flatten@Table[{ToString[b^(-1)*(n/n)]},{n,e,-1}],"×"]},Alignment -> {Center,Center}],Lighter[Red]]
]]]," = ",
 Style[(b^e),Lighter[Purple]]}],
gs=="variable base",
Row[{Style[Style["a",Italic]^ToString[e],Lighter[Blue]], " = ",
If[e==1, Style[Style["a",Italic], Lighter[Red]],
If[e≥1,
Style[Grid[{Riffle[Flatten@Table[{Style["a",Italic]},{n,1,e}],"×"]},Alignment -> {Center,Center}],Lighter[Red]],
If[e==0,Style[Row[ {Style["a",Italic]^ToString[1]," × "  ,Style["a",Italic]^ToString[-1],Style[" = ",Black],Style["a",Italic] ," × "  ,Style["a",Italic]^-1},Alignment->{Center,Center}] ,Lighter[Red]],

Style[Grid[{Riffle[Flatten@Table[{Style["a",Italic]^(-1)},{n,e,-1}],"×"]},Alignment -> {Center,Center}],Lighter[Red]]
]]]," = ",
 Style[((Style["a",Italic])^e),Lighter[Purple]]}]]
,20],

{550,250},Alignment->{Center,Center}],
{{gs,"number base","investigation"},{"variable base","number base"},ControlType-> SetterBar},
{{b,4,"base"},1,12,1, Appearance->"Labeled",Enabled:>Not@(gs==="variable base")},
{{e,0,"exponent"},-6,6,1,Appearance->"Labeled"}]
]

m4[]:=DynamicModule[{x},

Manipulate[
If[plottype==1,Grid[Map[Tooltip[#[FunctionF[x,a][[fff]] ,{x,minx,maxx},
ImageSize->250,PlotRange->All,Axes->False,Frame->True,ImagePadding->{{30,5},{15,5}}],ToString[#]]&,{{Plot,LogLinearPlot},{LogPlot,LogLogPlot}},{2}],
Frame->All],
Grid[Map[Tooltip[#[Table[FunctionF[x,a][[fff]] ,{x,minx,maxx,.2}],
ImageSize->250,PlotRange->All,Axes->False,Frame->True,ImagePadding->{{30,5},{15,5}}],ToString[#]]&,{{ListPlot,ListLogLinearPlot},{ListLogPlot,ListLogLogPlot}},{2}],
Frame->All]],{{fff,2,"function"},{1->"a",2->"ln(a x)",3->"a x",4->TraditionalForm@Sqrt["a"/"x"],5->"(a x)^2", 6-> "(x^a)",7-> "(a^x)"},ControlType->Setter},
{{minx,1,"min x"},1/2,5,Appearance->"Labeled"},
{{maxx,15,"max x"},6,20,Appearance->"Labeled"},
{{a,1,"a"},1/2,4,Appearance->"Labeled"},
{{plottype,1,"plot type"},{1->"continuous",2->"discrete"},ControlType->Setter},
SaveDefinitions->True],
Initialization:>(FunctionF[x_,a_]:= {a,Log[a x],a x, (Sqrt[a x]),(((a x))^2),(x^a),(a^x)};
SetOptions[EvaluationNotebook[],PrivateNotebookOptions->{"PluginToolbarEnabled"->False},DockedCells->Cell[BoxData[ToBoxes[Row[{Column[{Image[,ImageSize->125],"Prof. Kelso"},ItemSize->{20,Automatic}],Column[{"Magnify",PopupMenu[Dynamic[CurrentValue[EvaluationNotebook[],"Magnification"]],Range[0.5,3,0.5]]}],"           ",Image[,ImageSize->90]},Spacer[5]]]],"DockedCell"]];)
]

m5[]:=DynamicModule[{},


Manipulate[
multiplyusinglogs[First[u],First[v]],
{{u,{3,0}},{.01,0},{100,0},Locator},
{{v,{4,0}},{.01,0},{100,0},Locator},
SaveDefinitions->True
]

,
Initialization:>(multiplyusinglogs[x1_,x2_]:=
Column[{

"Drag the orange locators with x coordinates u and v. The parallelogram adds the logarithms of u and v. The line parallel to the x axis intersects the graph of the logarithm at the point with x coordinate u v.",

ToString[x1]<>" × "<>ToString[x2]<>" = "<>ToString[x1 x2],

Plot[
Log[x],
{x,0,Max[x1,x2,x1 x2]+1},
PlotRange->{{0,Max[x1,x2,x1 x2]+1},{-6,6}},
ImagePadding->30{{1,1},{1,1}},
Epilog->{
{
RGBColor[.67,.75,.15],
Arrowheads[.02],
Line[{{x1,0},{x1,Log[x1]}}],
Line[{{x2,0},{x2,Log[x2]}}],
Arrow[{{x1,0},{x2,Log[x2]}}],
Line[{{x2,0},{x2,Log[x1 x2]}}],
Arrow[{{x1,Log[x1]},{x2,Log[x1 x2]}}],
Line[{{x2,Log[x1 x2]},{x1 x2,Log[x1 x2]}}],
Line[{{x1 x2,0},{x1 x2,Log[x1 x2]}}]
},
{
RGBColor[.67,.75,.15],PointSize[.01],
Point[{x1,Log[x1]}],
Point[{x1 x2,Log[x1 x2]}],
RGBColor[1,.47,0],PointSize[.02],
Point[{x1,0}],
Point[{x2,0}],
RGBColor[.33,.26,.78],
Point[{x1 x2,0}]
}
},
ImageSize->500
]},
Center
])

]

Column[{m2[],m3[],m1[],m5[],m4[]}]