SetDirectory[NotebookDirectory[]]
Needs["MaTeX`"];
SetOptions[MaTeX,FontSize -> 14]

Plot3D[4-(4x^2+y^2),{x,-2,2},{y,-2,2},
RegionFunction->Function[{x,y,z},z>0],
BoxRatios->{1,2,1},AxesLabel->MaTeX/@{"x","y","z"}]

ParametricPlot3D[{2s*Cos[t],s*Sin[t],4-4s^2},{t,0,2Pi},{s,0,1},
BoxRatios->{2,1,1},AxesLabel->MaTeX/@{"x","y","z"},BoundaryStyle->Black,
Ticks -> {
{{-2,MaTeX[-2]},{-1,MaTeX[-1]},{1,MaTeX[1]},{2,MaTeX[2]}},
{{-2,MaTeX[-2]},{-1,MaTeX[-1]},{1,MaTeX[1]},{2,MaTeX[2]}},
Table[{z,MaTeX[z]},{z,2,4,2}]
}]

Export["elliptical_paraboloid.png",%, ImageSize -> 600, RasterSize ->1200]

ParametricPlot3D[{2s*Cos[t],s*Sin[t],4-4s^2},{t,0,2Pi},{s,0,1},
ViewPoint->{0,0,8},PlotPoints ->64,
BoxRatios->{2,1,1},AxesLabel->MaTeX/@{"x","y",""},BoundaryStyle->Black,
Ticks -> {
{{-2,MaTeX[-2]},{-1,MaTeX[-1]},{1,MaTeX[1]},{2,MaTeX[2]}},
{{-2,MaTeX[-2]},{-1,MaTeX[-1]},{1,MaTeX[1]},{2,MaTeX[2]}},
Table[{z,MaTeX[z]},{z,2,4,2}]
}]

Export["elliptical_paraboloid_above.png",%, ImageSize -> 400, RasterSize ->1200]

ParametricPlot[{t,(1-s)(t^2-1)+s(t+1)},{s,0,1},{t,-1,2}]

im = Rasterize[Grid[{{
ParametricPlot[{t,r},{t,0,Pi/2},{r,0,3},
AspectRatio->Automatic,ImageSize -> {Automatic,350},
Ticks -> {{{Pi/2,MaTeX[Pi/2]}},{{3,MaTeX[3]}}},
PlotRange -> {{-0.2,2},{-0.2,3.6}},
AxesLabel->{MaTeX["\\theta"],MaTeX["r"]},
Mesh -> True, Frame-> False, Axes -> True, AxesOrigin->{0,0}],
ParametricPlot[{r Cos[t],r Sin[t]},{r,0,3},{t,0,Pi/2},
ImageSize -> {Automatic,350},PlotRange -> {{-0.2,3.5},{-0.2,3.5}},
Ticks -> {{{3,MaTeX[3]}},{{3,MaTeX[3]}}},
AxesLabel->{MaTeX["x"],MaTeX["y"]},
Mesh -> True, Frame-> False, Axes -> True, AxesOrigin->{0,0}]}},
Spacings->{6,0}], ImageResolution->1000];

Show[{im,Graphics[{
Arrow[{{2150,2500},{3800,2500}}],
Text[MaTeX["x=r\\cos(\\theta)", FontSize->20],{2900,3200}],
Text[MaTeX["y=r\\sin(\\theta)",FontSize->20],{2890,2900}],
Text[Style["Area is evenly distributed", FontSize -> 16],{1300,4100}],
Text[Style["Area is unevenly distributed after mapping", FontSize -> 16],{6000,4100}]
}]}, ImageSize->800]

Export["image.png",%]

im = Rasterize[Grid[{{
ParametricPlot[{t,r},{t,0,Pi/2},{r,0,3},
AspectRatio->Automatic,ImageSize -> {Automatic,350},
Ticks -> {{{Pi/2,MaTeX[Pi/2]}},{{3,MaTeX[3]}}},
PlotRange -> {{-0.2,2},{-0.2,3.6}},
AxesLabel->{MaTeX["\\theta"],MaTeX["r"]},
Mesh -> True, Frame-> False, Axes -> True, AxesOrigin->{0,0}],
ParametricPlot[{2r Cos[t],r Sin[t]},{r,0,3},{t,0,Pi/2},
ImageSize -> {Automatic,350},PlotRange -> {{-0.2,7.5},{-0.2,3.5}},
Ticks -> {{{3,MaTeX[3]}, {6,MaTeX[6]}},{{3,MaTeX[3]}}},
AxesLabel->{MaTeX["x"],MaTeX["y"]},
Mesh -> True, Frame-> False, Axes -> True, AxesOrigin->{0,0}]}},
Spacings->{6,0}], ImageResolution->1000];

im2 = Rasterize[Grid[{{
ParametricPlot[{t,r},{t,0,Pi/2},{r,0,3},
AspectRatio->Automatic,ImageSize -> {Automatic,350},
Ticks -> {{{Pi/2,MaTeX[Pi/2]}},{{3,MaTeX[3]}}},
PlotRange -> {{-0.2,2},{-0.2,3.6}},
AxesLabel->{MaTeX["t"],MaTeX["s"]},
Mesh -> True, Frame-> False, Axes -> True, AxesOrigin->{0,0}],
ParametricPlot[{2r Cos[t],r Sin[t]},{r,0,3},{t,0,Pi/2},
ImageSize -> {Automatic,350},PlotRange -> {{-0.2,7},{-0.2,3.5}},
Ticks -> {{{3,MaTeX[3]},{6,MaTeX[6]}},{{3,MaTeX[3]}}},
AxesLabel->{MaTeX["x"],MaTeX["y"]},
Mesh -> True, Frame-> False, Axes -> True, AxesOrigin->{0,0}]}},
Spacings->{6,0}], ImageResolution->1000]

Show[{im2,Graphics[{
Arrowheads[0.03],Arrow[{{2150,2500},{3800,2500}}],
Text[MaTeX["x=2\\,s\\cos(t)", FontSize->20],{2900,3200}],
Text[MaTeX["y=s\\sin(t)",FontSize->20],{2840,2900}](*,
Text[Style["Area is evenly distributed", FontSize -> 16],{1300,4100}],
Text[Style["Area is unevenly distributed after mapping", FontSize -> 16],{6000,4100}]*)
}]}, ImageSize->1000]

Export["image2.png",%]

Integrate[(4-(x^2+4y^2))Boole[4-(x^2+4y^2)>0],{x,-3,3},{y,-3,3}]

dom = ParametricPlot[{3s+t,s+3t},{s,0,1},{t,0,1}, Mesh->True];
bounds = ContourPlot[{3x-y==0,3y-x==0,3x-y==8,3y-x==8},
{x,-1,5},{y,-1,5}, ContourStyle -> Directive[Thick,Black]];
Show[{dom,bounds}, PlotRange -> {{-0.1,4.1},{-0.1,4.1}}, Frame -> False]

Export["parallogram.png",%]

Solve[{
x==3s+t,
y==s+3t
},{s,t}]

{x,y}/.Solve[{s==y/x,t==x y},{x,y}][[2]]//Expand

Solve[{s==3x-y,t==3y-x},{x,y}]

RegionPlot[0<3x-y<8&&0<3y-x<8,{x,0,4},{y,0,4}]

8Integrate[(3s+t)(s+3t),{s,0,1},{t,0,1}]

(1/8)Integrate[(((3s+t)/8))(((s+3t)/8)),{s,0,8},{t,0,8}]

8^3

%/36

Integrate[x*y*Boole[0<3x-y<8&&0<3y-x<8],{x,0,4},{y,0,4}]

RegionPlot[f[x,y]>0,{x,-3,3},{y,-3,3}]

f[x_,y_] = 36-(4x^2+9y^2);
Plot3D[f[x,y],{x,-3,3},{y,-3,3},
RegionFunction->Function[{x,y},f[x,y]>0],
BoxRatios->Automatic]

RegionPlot[-1<x+2y<1&&-1<x-2y<1,{x,-1,1},{y,-1,1}]

names

problems = Table[SeedRandom[name];
{a,e,c,f} = RandomInteger[{2,5},{4}];
lines = StringJoin[Riffle["${tex`"<>ToString@TeXForm[#]<>"`}"& /@ {a*x-y==0,a*x-y==e,c*y-x==0,c*y-x==f},{", ", ", ", ", and "}]];
text = "Your random parallelogram is bounded by the lines "<>lines<>".";
pts = Prepend[{x,y} /. (First/@{
Solve[{a*x-y==e, c*y-x==0},{x,y}],
Solve[{a*x-y==e, c*y-x==f},{x,y}],
Solve[{a*x-y==0, c*y-x==f},{x,y}]}),{0,0}];
svg = StringDrop[ExportString[Graphics[{
EdgeForm[{Thick,Black}],
LightGray,Polygon[pts]
},Axes -> True, AxesOrigin->{0,0}, Ticks -> {{{pts[[3,1]],MaTeX[pts[[3,1]]]}},{{pts[[3,2]],MaTeX[pts[[3,2]]]}}},
PlotRangePadding->Max[pts[[3]]]/10,
Prolog->{Dashed,Line[{{pts[[3,1]],0},pts[[3]],{0,pts[[3,2]]}}]}, Epilog->{PointSize[Medium],Point[pts[[3]]]}],"SVG"],39];
{"name" -> name,"text" ->text,"svg"->svg},
{name,names}];

problems[[1]]

Export["problems.json", problems]

names = Sort[{"mark","david","nathan","fritz","jordan","lize-alet","will","sara","samuel","kara","joshward","joslyn","benjamin","gus","alana","adrian","camille","matthew","Bitchin_Prius","arnold","jacob","james","nick","joshua","taylor","caleb","chase","veronica","alice","asher","hibraim","julianna","graham","zachary","monica","cole","mitchell","michael","sarah","julianne","audrey","sarahw","samuelp"}];

Point[pts[[3]]]

{Dashed,Line[{{pts[[3,1]],0},pts[[3]],pts[[3,2]]}]}

StringLength["<?xml version=\"1.0\" encoding=\"UTF-8\"?>"]

StringDrop[ExportString[pic,"SVG"],39]