+++ title = "Problems" displayTitle = "24 Birthday Problems" tikzajax = "true" releaseDate = "2025-01-01T00:00:00" mathjax = "true" +++ #+OPTIONS: todo:nil #+begin_export html #+end_export {{< collapse folded="false" >}} ** DONE Q1 :PROPERTIES: :CUSTOM_ID: q1 :CLOSED: [2025-12-14 Sun 12:43] :note: - State "DONE" from "TODO" [2025-12-14 Sun 12:43] :END: {{< m2prob marks="4" >}} Given that \(A\) and \(B\) are sets like so:
$A$ and $B$ are non-empty sets
{{< tikztwo >}} \begin{document} \begin{tikzpicture}[scale=1.5, transform shape] % Define natural colors \definecolor{AColor}{RGB}{120, 180, 140} \definecolor{BColor}{RGB}{200, 160, 120} % Draw rectangle border \draw[thick, rounded corners=8pt] (-3.2,-2.2) rectangle (3.2,2.2); % Draw A - B (left crescent) \begin{scope} \clip (-1,0) circle (1.6cm); \fill[AColor] (-1,0) circle (1.6cm); \fill[white] (1,0) circle (1.6cm); \end{scope} % Draw B - A (right crescent) \begin{scope} = \clip (1,0) circle (1.6cm); \fill[BColor] (1,0) circle (1.6cm); \fill[white] (-1,0) circle (1.6cm); \end{scope} % Draw circle borders \draw[thick] (-1,0) circle (1.6cm); \draw[thick] (1,0) circle (1.6cm); % Labels \node at (-1,0) {\(A\)}; \node at (1,0) {\(B\)}; \end{tikzpicture} \end{document} {{< /tikztwo >}}The Gamma Function
{{< tikztwo >}} \usepackage{pgfplots} \pgfplotsset{compat=1.16} \begin{document} % --- Gamma via Lanczos (real x, handles negatives via reflection) --- \pgfmathdeclarefunction{gammalanczos}{1}{% \begingroup \pgfmathsetmacro{\z}{#1-1}% % g=7, n=9 coefficients (Numerical Recipes / common Lanczos set) \pgfmathsetmacro{\x}{0.99999999999980993 + 676.5203681218851/(\z+1) - 1259.1392167224028/(\z+2) + 771.32342877765313/(\z+3) - 176.61502916214059/(\z+4) + 12.507343278686905/(\z+5) - 0.13857109526572012/(\z+6) + 0.000009984369578019572/(\z+7) + 0.00000015056327351493116/(\z+8)}% \pgfmathsetmacro{\t}{\z+7.5}% \pgfmathparse{sqrt(2*pi) * (\t)^( \z+0.5 ) * exp(-\t) * \x}% \pgfmathsmuggle\pgfmathresult \endgroup } \pgfmathdeclarefunction{Gamma}{1}{% \begingroup % reflection for x < 0.5 : Gamma(x) = pi / (sin(pi x) Gamma(1-x)) % NOTE: pgf trig uses degrees, so sin(pi x) = sin(180*x) \pgfmathparse{ifthenelse(#1<0.5, pi/( sin(180*#1) * gammalanczos(1-#1) ), gammalanczos(#1) )}% \pgfmathsmuggle\pgfmathresult \endgroup } \pgfmathdeclarefunction{gammapdf}{3}{% \pgfmathparse{(#3^#2) * (#1)^(#2-1) * exp(-#3*#1) / Gamma(#2)}% } \begin{tikzpicture}[scale=2.1, transform shape] \begin{axis}[ xmin=-10.2, xmax=10.2, ymin=-6, ymax=6, axis lines=middle, axis line style={-latex}, xlabel={$x$}, ylabel={$\Gamma(x)$}, smooth, restrict y to domain=-6:6, unbounded coords=jump, ] % positive side \addplot[red, very thick, domain=0.02:10, samples=400] {Gamma(x)}; % negative intervals between poles: (-10,-9),...,(-1,0) \foreach \n in {-10,...,-1} { \pgfmathsetmacro{\a}{\n} \pgfmathsetmacro{\b}{\n+1} \addplot[red, very thick, domain=\a+0.02:\b-0.02, samples=260] {Gamma(x)}; } % vertical asymptotes at non-positive integers \foreach \k in {0,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10} { \addplot[densely dashed, thin, domain=-6:6, samples=2] ({\k}, x); } \end{axis} \end{tikzpicture} \end{document} {{< /tikztwo >}}2D Unit Square
{{< tikztwo >}} \begin{document} \begin{tikzpicture}[scale=3.5] % Draw the square \draw[thick, blue!60] (0,0) rectangle (1,1); % Draw the diagonal \draw[very thick, red, ->] (0,0) -- (1,1); % Label vertices \node[below left] at (0,0) {$(0,0)$}; \node[above right] at (1,1) {$(1,1)$}; % Label sides \node[below] at (0.5,0) {$1$}; \node[left] at (0,0.5) {$1$}; % Label diagonal \node[above left, red] at (0.5,0.5) {$\sqrt{2}$}; % Add grid \draw[very thin, gray!30] (0,0) grid[step=0.2] (1,1); \end{tikzpicture} \end{document} {{< /tikztwo >}}3D Unit Cube
{{< tikztwo >}} \usepackage{tikz-3dplot} \begin{document} \begin{tikzpicture} [scale=2.5, cube/.style={thick,blue!60}, grid/.style={very thin,gray!30}, axis/.style={->,blue,thick}] % Draw the bottom face \draw[cube] (0,0,0) -- (1,0,0) -- (1,1,0) -- (0,1,0) -- cycle; % Draw the top face \draw[cube] (0,0,1) -- (1,0,1) -- (1,1,1) -- (0,1,1) -- cycle; % Draw the vertical edges \draw[cube] (0,0,0) -- (0,0,1); \draw[cube] (1,0,0) -- (1,0,1); \draw[cube] (0,1,0) -- (0,1,1); \draw[cube] (1,1,0) -- (1,1,1); % Draw the space diagonal \draw[very thick, dashed, red, ->] (0,0,1) -- (1,1,0); % Label key vertices \node[below left] at (0,0,1) {$A=(0,0,0)$}; \node[above right] at (1,1,0) {$B=(1,1,1)$}; % Label edge lengths \node[below] at (0.5,0,0) {$1$}; \node[left] at (0,0.5,0) {$1$}; \node[right] at (0,0,0.5) {$1$}; % Label diagonal \node[above, red] at (0.5,0.6,0.6) {$\sqrt{3}$}; \end{tikzpicture} \end{document} {{< /tikztwo >}}