~upd~ — Geometrylessonsgithub

~upd~ — Geometrylessonsgithub

~upd~ — Geometrylessonsgithub

## Installation See `installation.md`.

### **3. Sample Lesson: `lessons/01_points_lines/lesson_notes.md`**

line = Line(dot_a.get_center(), dot_b.get_center(), color=YELLOW) ray = Line(dot_a.get_center(), RIGHT * 4, color=GREEN, stroke_width=6) segment = Line(dot_a.get_center(), dot_b.get_center(), color=PURPLE) geometrylessonsgithub

def slope(p1, p2): """Slope of line through p1 and p2.""" dx = p2[0] - p1[0] if dx == 0: return float('inf') return (p2[1] - p1[1]) / dx

## Interactive Demo (in `interactive.ipynb`) Use widgets to plot points and toggle line/ray/segment. ## Installation See `installation

self.play(FadeIn(dot_a, label_a), FadeIn(dot_b, label_b)) self.wait() self.play(Create(line)) self.wait() self.play(Transform(line, ray)) self.wait() self.play(Transform(line, segment)) self.wait() </code></pre> <hr> <h3><strong>5. Sample Interactive Notebook: <code>lessons/01_points_lines/interactive.ipynb</code></strong> (JSON-like snippet)</h3> <pre><code class="language-json">{ "cells": [ { "cell_type": "markdown", "source": [ "# Interactive Geometry: Points & Lines" ] }, { "cell_type": "code", "source": [ "import matplotlib.pyplot as plt\n", "import ipywidgets as widgets\n", "from IPython.display import display\n", "\n", "def plot_points(x1, y1, x2, y2, draw_line):\n", " plt.figure(figsize=(5,5))\n", " plt.scatter([x1, x2], [y1, y2], color='red')\n", " if draw_line:\n", " plt.plot([x1, x2], [y1, y2], 'b-')\n", " plt.xlim(-5,5); plt.ylim(-5,5)\n", " plt.grid(True)\n", " plt.show()\n", "\n", "widgets.interact(plot_points,\n", " x1=(-5,5,0.5), y1=(-5,5,0.5),\n", " x2=(-5,5,0.5), y2=(-5,5,0.5),\n", " draw_line=False)" ] } ] } </code></pre> <hr> <h3><strong>6. <code>tools/geometry_utils.py</code></strong></h3> <pre><code class="language-python">import math

## Running Animations ```bash manim lessons/03_triangles/animations/pythagorean_visual.py PythagoreanTheorem -p </code></pre> <h2>Using Jupyter Notebooks</h2> <pre><code class="language-bash">jupyter lab lessons/01_points_lines/interactive.ipynb </code></pre> <h2>Writing Your Own Lessons</h2> <p>Add a new folder under <code>lessons/</code> with <code>lesson_notes.md</code>, <code>interactive.ipynb</code>, and <code>animations/</code>.</p> <pre><code> --- &lt;code&gt;tests/test_geometry_utils

def circle_equation(center, radius): """Returns (h,k,r) for (x-h)^2 + (y-k)^2 = r^2.""" return (center[0], center[1], radius) </code></pre> <hr> <h3><strong>7. <code>tests/test_geometry_utils.py</code></strong></h3> <pre><code class="language-python">from tools.geometry_utils import distance, slope

Go to Top