Figures for lecture 2

http://mathematica.stackexchange.com/questions/3506/calling-correct-function-for-plotting-diracdelta

F3

Plot[
0, (* plot nothing[x]=0, but add arrows at the end *)
{x,-2,2}, (* range *)
PlotStyle:>{Thick,Red},
(*AspectRatio:>1,GridLines:>{{-1,0,1,1},{1.0,0.5,-0.5,-1.0}},*)(*PlotLabel:>"Re(w) - Frequency Response",*)
AxesLabel:>{"x","P(x)"},
(*PlotRange->{Automatic,1.},*)
PlotRange->{{-2, 2},{0, 0.8}},Epilog->{Red,Thick,Arrow[{{-1,0},{-1,1/2}}],Arrow[{{1,0},{1,1/2}}]}]

F4

Plot[
0, (* plot nothing[x]=0, but add arrows at the end *)
{x,-3,3}, (* range *)
PlotStyle:>{Thick,Red},
(*AspectRatio:>1,GridLines:>{{-1,0,1,1},{1.0,0.5,-0.5,-1.0}},*)(*PlotLabel:>"Re(w) - Frequency Response",*)
AxesLabel:>{"x","P(x)"},
(*PlotRange->{Automatic,1.},*)
PlotRange->{{-3, 3},{0, 0.5}},
Epilog->{Red,Thick,
Arrow[{{-2,0},{-2,1/4}}],
Arrow[{{-0,0},{-0,1/2}}],
Arrow[{{2,0},{2,1/4}}]
}
]

F5

Plot[
0, (* plot nothing[x]=0, but add arrows at the end *)
{x,-4,4}, (* range *)
PlotStyle:>{Thick,Red},
(*AspectRatio:>1,GridLines:>{{-1,0,1,1},{1.0,0.5,-0.5,-1.0}},*)(*PlotLabel:>"Re(w) - Frequency Response",*)
AxesLabel:>{"x","P(x)"},
(*PlotRange->{Automatic,1.},*)
PlotRange->{{-4, 4},{0, 0.5}},
Epilog->{Red,Thick,
Arrow[{{-3,0},{-3,1/8}}],
Arrow[{{3,0},{3,1/8}}],
Arrow[{{-1,0},{-1,3/8}}],
Arrow[{{1,0},{1,3/8}}]
}
]

BarChart[
{{3, 6, 7}}
(*{{1,2,3},{1,3,2},{5,2}}*)
(*,ChartLabels->{"a","b","c"}*)
]

F7

http://mathematica.stackexchange.com/questions/13906/given-a-table-of-plots-with-some-parameter-how-would-i-mark-each-of-the-plots-w

ClearAll[lblPlot];
Options[lblPlot]={maxArrowedLbls->5,maxNonArrowedLbls->5,optLblsO->{}};
lblPlot[s_Graphics,myStyle_List: {FontFamily->"Times",16},OptionsPattern[]]:=(*Thanks to@WReach, @jVincent and@chris@Rojo for their useful help and code*)(*Errors,bugs and bad coding due to belisarius*)Module[{myLabel,copyToNewNB,exportLbls,printLbls,u,plotRsrv,safeGuard={"FeboAsoma"},optLbls},myLabel[{str_,{p1_,p2_,p3_}}]:={Thick,Arrow@BezierCurve[{p3,p2,p1}],Inset[Style[str,myStyle],p3,Background->White]};
myLabel[{str_,p1:{_,_}}]:={Thick,Inset[Style[str,myStyle],p1,Background->White]};
copyToNewNB[plot_,list_]:=Module[{nb},nb=NotebookCreate[];
NotebookWrite[nb,Cell[BoxData@ToBoxes@plot,"Output"]];
printLbls[nb,list];];
exportLbls[list_]:=Module[{nb},nb=NotebookCreate[];
printLbls[nb,list];];
printLbls[nb_,list_]:=(NotebookWrite[nb,Cell["Reserve the following expression in your Notebook to restore your Labels and Arrows the next time you need to include them in the Plot","Subsection",CellMargins->{{50,50},Inherited}]];
NotebookWrite[nb,Cell[BoxData@ToBoxes@Join[safeGuard,list,safeGuard],"Output"]];);
u=Array[(PlotRange/.Options[s,PlotRange])[[All,1]]+Flatten[Differences/@(PlotRange/.Options[s,PlotRange])/4] #&,3];
optLbls=OptionValue[optLblsO];
Panel@DynamicModule[{pts1={},pts2={},lbl1={},lbl2={},varRsrv="Label Import Area"},If[Head[optLbls]==List&&Length@optLbls==6&&optLbls[[1]]==optLbls[[-1]]==safeGuard[[1]],{pts1=optLbls[[2]],pts2=optLbls[[3]],lbl1=optLbls[[4]],lbl2=optLbls[[5]]}];
Column[{Dynamic@Show[plotRsrv=Show[s,Epilog->myLabel/@Join@@{MapIndexed[{lbl1[[#2[[1]]]],#1}&,Partition[pts1,3]],MapIndexed[{lbl2[[#2[[1]]]],#1}&,pts2]},ImageSize->500],Graphics[{Dynamic@MapIndexed[With[{i=#2[[1]]},Locator[Dynamic[pts1[[i]]]]]&,pts1],Dynamic@MapIndexed[With[{i=#2[[1]]},Locator[Dynamic[pts2[[i]]]]]&,pts2]},PlotRange->{{0,1},{0,1}}]],InputField[Dynamic@varRsrv,FieldSize->55,FieldHint->"Label Import Area"],Row[{Button["Add Labeled Arrow",If[Length@pts1<3 OptionValue[maxArrowedLbls],AppendTo[lbl1,"Arrow"];pts1=pts1~Join~(u)]],Button["Add Label",If[Length@pts2<OptionValue[maxNonArrowedLbls],(AppendTo[lbl2,"Label"];
AppendTo[pts2,u[[2]]])]],Button["Copy to new .nb",copyToNewNB[plotRsrv,{pts1,pts2,lbl1,lbl2}]],Button["Export Labels",exportLbls[{pts1,pts2,lbl1,lbl2}]],Button["Import Labels",(*validate the labels set,then import*)If[Head[varRsrv]==List&&Length@varRsrv==6&&varRsrv[[1]]==varRsrv[[-1]]==safeGuard[[1]],{pts1=varRsrv[[2]],pts2=varRsrv[[3]],lbl1=varRsrv[[4]],lbl2=varRsrv[[5]]},MessageDialog["You're trying to Import a label set not created by \"Export Labels\""],MessageDialog[{Head[varRsrv],varRsrv[[1]]==varRsrv[[-1]]==safeGuard}]];]}],Dynamic@Grid[Transpose[{(*arrows*){""}~Join~PadRight[Row[{#,InputField[Dynamic[lbl1[[#]]],String],Button["Delete"<>ToString@#,(lbl1=Drop[lbl1,{#,#}];
pts1=Drop[pts1,{3 #-2,3 #}])]}]&/@Range@(Length@pts1/3),Max[Length@lbl1,Length@lbl2],""],(*non-arrows*){""}~Join~PadRight[Row[{#,InputField[Dynamic[lbl2[[#]]],String],Button["Delete"<>ToString@#,(lbl2=Drop[lbl2,{#,#}];
pts2=Drop[pts2,{#}])]}]&/@Range@(Length@pts2),Max[Length@lbl1,Length@lbl2],""]}],ItemSize->30]}]]]


Clear[f]
f[y_, alpha_] = -y + alpha Log[y] ;
s=Plot[
Evaluate@Table[
f[y,alpha],{alpha,{(*0,1,*)3, 7, 15, 20}}],{y,1, 30}
(*,PlotRange->{0,10}*)
] ;
lblPlot[s,{FontFamily->"xkcd",16}]

F8

Clear[i, α]
i = Integrate[ E^(-(y-α)^2/(2α)), {y, 0, Infinity}]  ;
FullSimplify[i,α > 0]
Plot[ Erf[x], {x, 0, 3}, PlotRange ->Full, AxesLabel->{x, Erf[x]}]