# Thread: Filling graphics in Mathematica

1. ## Filling graphics in Mathematica

Dear friends hi again,

I am using the following code:
Code:
Manipulate[Plot[{p-Floor[k]^Floor[k]/(Floor[k]+1)^(Floor[k]+1)(Floor[k]-1),1,0},{p,0,2},PlotRange->{{0,2},{0,2}}],{k,1,10}]
The code above gives the following graphic:

My first question is how can I fill the graphic in the following form:

And the second question is how can I plot the following graphic?

Or simply, how can I put the graph of $\displaystyle x=1$ into the first graph?

Thanks.

2. I could do what I wanted with the following codes, I am giving them below.
Code:
kmax = 10;
Manipulate[
Show[Graphics[{White, Polygon[{{2, 0}, {0, 0}, {0, 1}, {2, 1}}]}],
Graphics[{Cyan,
Polygon[{{2, 0}, {k^k/(k + 1)^(k + 1) (k - l),
0}, {1 + k^k/(1 + k)^(k + 1) (k - l), 1}, {2, 1}}]}]], {k, 1,
kmax, 1}, {l, 0, k - 1, 1}]
Manipulate[
Show[Graphics[{White, Polygon[{{2, 0}, {0, 0}, {0, 1}, {2, 1}}]}],
Graphics[{Magenta, Line[{{1, 1}, {2, 1}}]}]], {k, 1, kmax, 1}, {l,
0, k - 1, 1}]
Manipulate[
Show[Graphics[{White, Polygon[{{2, 0}, {0, 0}, {0, 1}, {2, 1}}]}],
Graphics[Table[If[s == k - l, Line[{{1, 1}, {2, 1}}], If[s == 0,
Line[{{1, 0}, {1, 1}}],
Line[{{1, 1},
If[(k - l)/(k - l - s) > 2, {2, (2 s - k + l)/s}, {(k - l)/(
k - l - s), 0}]}]]], {s, 0, k - l}]]], {k, 1, kmax, 1}, {l,
0, k - 1, 1}]
Manipulate[
Show[Graphics[{White, Polygon[{{2, 0}, {0, 0}, {0, 1}, {2, 1}}]}],
Graphics[{Magenta, Polygon[{{2, 0}, {1, 0}, {1, 1}, {2, 1}}]}]], {k,
1, kmax, 1}, {l, 0, k - 1, 1}]
And all in one version
Code:
kmax = 10;
Manipulate[
Show[If[c == 1,
Show[Graphics[{White, Polygon[{{2, 0}, {0, 0}, {0, 1}, {2, 1}}]}],
Graphics[{Cyan,
Polygon[{{2, 0}, {k^k/(k + 1)^(k + 1) (k - l),
0}, {1 + k^k/(1 + k)^(k + 1) (k - l), 1}, {2, 1}}]}]],
If[c == 2,
Show[Graphics[{White, Polygon[{{2, 0}, {0, 0}, {0, 1}, {2, 1}}]}],
Graphics[{Cyan,
Polygon[{{2, 0}, {k^k/(k + 1)^(k + 1) (k - l),
0}, {1 + k^k/(1 + k)^(k + 1) (k - l), 1}, {2, 1}}]}],
Graphics[{Magenta, Line[{{1, 1}, {2, 1}}]}]],
If[c == 3,
Show[Graphics[{White,
Polygon[{{2, 0}, {0, 0}, {0, 1}, {2, 1}}]}],
Graphics[{Cyan,
Polygon[{{2, 0}, {k^k/(k + 1)^(k + 1) (k - l),
0}, {1 + k^k/(1 + k)^(k + 1) (k - l), 1}, {2, 1}}]}],
Graphics[
Table[If[s == k - l, Line[{{1, 1}, {2, 1}}], If[s == 0,
Line[{{1, 0}, {1, 1}}],
Line[{{1, 1},
If[(k - l)/(k - l - s) > 2, {2, (2 s - k + l)/s}, {(
k - l)/(k - l - s), 0}]}]]], {s, 0, k - l}]]],
Show[Graphics[{White,
Polygon[{{2, 0}, {0, 0}, {0, 1}, {2, 1}}]}],
Graphics[{Cyan,
Polygon[{{2, 0}, {k^k/(k + 1)^(k + 1) (k - l),
0}, {1 + k^k/(1 + k)^(k + 1) (k - l), 1}, {2, 1}}]}],
Graphics[{Magenta,
Polygon[{{2, 0}, {1, 0}, {1, 1}, {2, 1}}]}]]]]]], {k, 1, kmax,
1}, {l, 0, k - 1, 1}, {c, 1, 4, 1}]
Is there a way to simplify the latter code?

Thanks.