(*function to plot any circle with given ceneter>0 and radius>0*)
centerOfCircle[v10_,v20_,r0_]:=Module[{v1=v10,v2=v20,r=r0},Graphics[{Circle[{v1,v2}, r],
Blue,Thickness[0.007],Line[{( r)*{Cos[Pi/4],Sin[Pi/4]}+{v1,v2},{r*Cos[Pi/4]+v1,v2} }],
Red,Line[{{v1,v2},{r*Cos[Pi/4]+v1,v2} }],
Pink,PointSize[Large],Point[{v1,v2}],Dashed,Arrow[{{v1,v2},( r)*{Cos[Pi/4],Sin[Pi/4]}+{v1,v2}}],
Green,Point[( r)*{Cos[Pi/4],Sin[Pi/4]}+{v1,v2}],
Black,Style[Text["P=(x,y)",(( r)*{Cos[Pi/4],Sin[Pi/4]})+{v1,v2}+{0.15,0.15}],Medium],
Style[Text[If[v2==0,"y","y-k"],{(r*Cos[Pi/4]+v1+r*Cos[Pi/4]+v1)/2,(r*Sin[Pi/4]+v2+v2)/2}+{0.09,0}],Blue,Bold,Medium],
Style[Text[If[v1==0,"x","x-h"],{(v1+r*Cos[Pi/4]+v1)/2,(2v2)/2}+{0.,-0.07}],Red,Bold,Medium],Style[Text["r",(((( r(*2/3*))*{Cos[Pi/4],Sin[Pi/4]}+{v1,v2})+{v1,v2})/2)+{0.,0.07}],Medium],Style[Text[Which[v1==0&&v2==0,"C=(0,0)",v1==0,"C=(0,k)",v2==0,"C=(h,0)",v1≠ 0&&v2≠ 0,"C=(h,k)"],{v1,v2}+{0,-0.1}],Small] },Axes->True,AxesOrigin->{0,0},Ticks->None
]
]

(*function for substracting, where v0 is value*)
funForSub[v0_]:=Module[{v=v0},
If[v≥0, ToString[v],"("<>ToString[v]<>")"]
]

f[]:=Rasterize@Column[{
color=RandomChoice[{Pink, LightGreen,LightBlue,LightGray, Yellow,LightBrown, LightMagenta,LightPurple,LightYellow}];,
"MATH&141  Precalculus 1, Algebra",
"Prof. Kelso",
" ",
" ",
Style["Circles",Bold, Orange,20],
" ",
Style["Definition",Bold, Black],
"Circle is a \!\(\*
StyleBox[\"set\",\nFontColor->RGBColor[1, 0, 0]]\) of all the points in a xy-plane: which are", (*ANNA 1: changed definition*)
"at a fixed distance r from a fixed point C=(h, k) in the plane.",
"The fixed point \!\(\*
StyleBox[\"C\",\nFontColor->RGBColor[1, 0, 0]]\) is called \!\(\*
StyleBox[\"centre\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\*
StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\*
StyleBox[\"of\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\*
StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\*
StyleBox[\"the\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\*
StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\*
StyleBox[\"circle\",\nFontColor->RGBColor[1, 0, 0]]\) and ",
"the fixed distance \!\(\*
StyleBox[\"r\",\nFontColor->RGBColor[1, 0, 0]]\) is called \!\(\*
StyleBox[\"radius\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\*
StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\*
StyleBox[\"of\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\*
StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\*
StyleBox[\"the\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\*
StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\*
StyleBox[\"circle\",\nFontColor->RGBColor[1, 0, 0]]\).",
" ",
Graphics[{Circle[{1/4,1/4}, 2/3],Pink,PointSize[Large],Point[{1/4,1/4}],Dashed,Arrow[{{1/4,1/4},(2/3)*{Cos[Pi/4],Sin[Pi/4]}+{1/4,1/4}}], Green,Point[(2/3)*{Cos[Pi/4],Sin[Pi/4]}+{1/4,1/4}],Black,Style[Text["P=(x,y)",((2/3)*{Cos[Pi/4],Sin[Pi/4]})+{1/4,1/4}+{0.15,0.15}],Medium],(*Anna, added \"=\" and changes p into P*)Style[Text["r",((((2/3)*{Cos[Pi/4],Sin[Pi/4]}+{1/4,1/4})+{1/4,1/4})/2)+{0.,0.07}],Medium],Style[Text["C=(h,k)",{1/4,1/4}+{0,-0.1}],Small] },Axes->True,AxesOrigin->{0,0},Ticks->None], (*Anna, added \"=\" and changes c into C*)
"",
"To define a equation for a circle we need to find",
"all points (x,y) on the xy-plane which are distinct ",
"for a fixed distance r from fixed point C.",
(*Anna added t1 and t2*)
t1=centerOfCircle[0,0,1];
t2=centerOfCircle[1/4,1/4,2/3];
" ",
(*Anna added new grid *)
Grid[{{"The equation of a circle\ncentered at the origin:","The general equation\nof a circle:"},{t1,t2},{TraditionalForm["\n(x^2) + \!\(\*SuperscriptBox[\(y\), \(\(2\)\(\\ \)\)]\) = (r^2)\n"],TraditionalForm["\n(x-h)^2 + (y-k\!\(\*SuperscriptBox[\()\), \(\(2\)\(\\ \)\)]\) = (r^2)\n"]}},Frame->All,Background->{None,{LightYellow,None}},FrameStyle->Directive[Black,Thickness[1],Dashing[4]]],
"",
"Therefore in general case using Phytagorean Theorem:",
"",
"d(P,C) = r ⟺ (x-h)^2+(y-k)^2 = (r^2)",
" ",
"where:",
"d(P,C) - distance between P and C,",
"fixed point C - centre of circle,",
"fixed distance r - readius of a circle ",
"and a set of all points P=(x,y) makes a cricle.", (*ANNA end 1*)
"",
Style["Circle: Boundary",Bold, Orange,20],
" ",
a=RandomInteger[{-2,2}];b=RandomInteger[{-2,2}];
r=RandomInteger[{1,2}];
ℛ=ImplicitRegion[(x-a)^2+(y-b)^2 == (r)^2, {x,y}];
Multicolumn[Table[pts=RandomPoint[ℛ,10*n];Graphics[{Orange,PointSize[Medium],Point[pts]},PlotLabel->ToString[10*n]<>"points",PlotRange->{{a-r,a+r},{b-r,b+r}}], {n,{1,3,10,20}}],2,Appearance->"Horizontal",Frame->All,FrameStyle->Directive[Green,Thickness[2],Dashing[4]]],
{x1,y1}=RandomChoice@pts; 
Row[{"Centre of circle:\n  ",{a,b}}],(*Anna added comment*)
Row[{"General condition for boundary points:\n",TraditionalForm[("x"-funForSub[a])^"2"],"+",TraditionalForm[("y"-funForSub[b])^"2" ],"=",TraditionalForm[ ToString[r]^"2"]}], (*Anna added commet + funForSub*)

Row[{"Sample point which satisfy above condition:\n",TraditionalForm[(ToString[x1]-funForSub[a])^"2"],"+",TraditionalForm[(ToString[y1]-funForSub[b])^"2" ],"=",ToString[(x1-a)^2+(y1-b)^2] ," = ", ToString[r]^"2"}],  (*Anna added commet + funForSub, TO DO: need to work about rounding here*)
" ",
" ",

Style["Circle: Interior",Bold, Orange,20],

a=RandomInteger[{-2,2}];b=RandomInteger[{-2,2}];
r=RandomInteger[{1,2}];
ℛ=ImplicitRegion[(x-a)^2+(y-b)^2 < (r-0.05)^2, {x,y}];
g=RegionPlot[ℛ,BoundaryStyle->{Black,Dashed},PlotStyle->Orange,Frame->None];
g1=Show[g,Graphics[{PointSize[Medium],Yellow,Point[{a,b}],Text[Style["center\n("<>ToString[a]<>", "<>ToString[b]<>")",Small],{a,b}+{0, 0.3}]}]];

pts=RandomPoint[ℛ,30]; 
g2=Graphics[{Orange,PointSize[Large],Point[pts],Black,Point[{a,b}],Text[Style["center\n("<>ToString[a]<>", "<>ToString[b]<>")",Medium],{a,b}+{0, 0.4}],Dashed,Circle[{a,b},r]}];


pts=RandomPoint[ℛ,300];
g3=Graphics[{Orange,PointSize[Large],Point[pts],Black,Point[{a,b}],Text[Style["center\n("<>ToString[a]<>", "<>ToString[b]<>")",Medium],{a,b}+{0, 0.4}],Dashed,Circle[{a,b},r]}];

pts=RandomPoint[ℛ,900];
g4=Graphics[{Orange,PointSize[Large],Point[pts],Black,Point[{a,b}],Text[Style["center\n("<>ToString[a]<>", "<>ToString[b]<>")",Medium],{a,b}+{0, 0.4}],Dashed,Circle[{a,b},r]}];

Multicolumn[{g2,g3,g4,g1},2,Appearance->"Horizontal",Frame->All,FrameStyle->Directive[Green,Thickness[2],Dashing[4]]],

{x1,y1}=RandomChoice@pts;
Row[{"Centre of circle:\n  ",{a,b}}],(*Anna added comment*)
Row[{"Gneral equation for interior points:\n  ",TraditionalForm[("x"-funForSub[a])^"2"],"+",TraditionalForm[("y"-funForSub[b])^"2" < ToString[r]^"2"]}], (*ANNA: added comment and changed ToString to funForSub*)
"Sample of point which satisfy the condition of above equation:",(*ANNA added comment line *)
Row[{TraditionalForm[(ToString[x1]-funForSub[a])^"2"],"+",TraditionalForm[(ToString[y1]-funForSub[b])^"2" ],"=",ToString[(x1-a)^2+(y1-b)^2] ," < ", ToString[r]^"2"}],
"",(*ANNA*)
Style["Circle: Exterior",Bold, Orange,20],

a=RandomInteger[{-2,2}];b=RandomInteger[{-2,2}];
r=RandomInteger[{1,2}];
rr=2;
range={{a-2*rr,a+2*rr},{b-2*rr,b+2*rr}};

ℛ=ImplicitRegion[(x-a)^2+(y-b)^2 > (r+0.1)^2&&a-2*rr<=x<=a+2*rr&&b-2*rr≤y≤b+2*rr, {x,y}];
g=RegionPlot[ℛ,BoundaryStyle->{Black,Dashed},PlotStyle->Orange,Frame->None,PlotRange->range,Axes->True];
g1=Show[g,Graphics[{PointSize[Medium],Black,Point[{a,b}],Text[Style["center\n("<>ToString[a]<>", "<>ToString[b]<>")",Medium],{a,b}+{0,1.3}]},PlotRange->range],PlotRange->range,Axes->True];

pts=RandomPoint[ℛ,30];
g2=Graphics[{Orange,PointSize[Large],Point[pts],Black,Point[{a,b}],Text[Style["center\n("<>ToString[a]<>", "<>ToString[b]<>")",Medium],{a,b}+{0,1.3}],Dashed,Circle[{a,b},r]},PlotRange->range,Axes->True];


pts=RandomPoint[ℛ,300];
g3=Graphics[{Orange,PointSize[Large],Point[pts],Black,Point[{a,b}],Text[Style["center\n("<>ToString[a]<>", "<>ToString[b]<>")",Medium],{a,b}+{0, 1.3}],Dashed,Circle[{a,b},r]},PlotRange->range,Axes->True];

pts=RandomPoint[ℛ,900];
g4=Graphics[{Orange,PointSize[Large],Point[pts],Black,Point[{a,b}],Text[Style["center\n("<>ToString[a]<>", "<>ToString[b]<>")",Medium],{a,b}+{0, 1.3}],Dashed,Circle[{a,b},r]},PlotRange->range,Axes->True];

Multicolumn[{g2,g3,g4,g1},2,Appearance->"Horizontal",Frame->All,FrameStyle->Directive[Green,Thickness[2],Dashing[4]]],

{x1,y1}=RandomChoice@pts;
Row[{"Centre of circle:\n  ",{a,b}}],(*Anna added comment*)
Row[{"General condition for exterior points:\n",TraditionalForm[("x"-funForSub[a])^"2"],"+",TraditionalForm[("y"-funForSub[b])^"2" > ToString[r]^"2"]}], (*ANNA*)
Row[{"Sample point which satisfy above condition:\n",TraditionalForm[(ToString[x1]-funForSub[a])^"2"],"+",TraditionalForm[(ToString[y1]-funForSub[b])^"2" ],"=",ToString[(x1-a)^2+(y1-b)^2] ," > ", ToString[r]^"2"}], (*ANNA*)


" ",
" ",




}]

f[]