From e089b09dfd6346f0ba813c7f844e8a9f91de5d5d Mon Sep 17 00:00:00 2001 From: Aron T Date: Wed, 26 Nov 2025 17:49:43 +0200 Subject: [PATCH 1/9] Add comprehensive ellipse documentation with Documenter.jl LaTeX fixes - Add docs/src/Geometry/05 Ellipses.md with complete ellipse coverage * Definition, standard/translated equations * Key parameters: eccentricity, foci, relationships * Parametric and polar forms * Area, perimeter approximations, curvature * Directrix, reflective properties * Applications in astronomy, engineering, optics, nature * Construction methods and historical notes - Fix all LaTeX display blocks to attach 82485 directly to content (no newlines) - Apply consistent styling: bullet points start with text, equations inline with 'where:' - Update docs/make.jl to include Ellipses in Geometry section - Add critical Documenter.jl LaTeX formatting rules to copilot-instructions.md * 82485 blocks must not have blank lines between delimiters and content * Bullet points must start with text before LaTeX * Prefer inline equations with 'where:' followed by list --- .github/copilot-instructions.md | 11 ++ docs/make.jl | 3 +- docs/src/Geometry/05 Ellipses.md | 182 +++++++++++++++++++++++++++++++ 3 files changed, 195 insertions(+), 1 deletion(-) create mode 100644 docs/src/Geometry/05 Ellipses.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 75331bc..a582ccf 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -298,9 +298,20 @@ Documentation in `docs/src/` explains general math concepts (not code). Follow t **Mathematical Notation:** - Use LaTeX: `$$` for display equations, inline with `$...$` +- **CRITICAL**: `$$` display blocks in Documenter.jl MUST NOT have blank lines between delimiters and content + - ✅ **CORRECT**: `$$\begin{aligned}...content...\end{aligned}$$` (no newlines) + - ❌ **WRONG**: `$$\ncontent\n$$` (newlines break parser and cause cascade errors) + - ✅ **ALSO WORKS**: `$$equation$$` inline on same line +- **Bullet point style**: List items starting with `-` must begin with text, then LaTeX math + - ✅ **CORRECT**: `- $a$ is the semi-major axis` + - ❌ **WRONG**: `- semi-major axis: $a$` +- **Equation placement style**: Prefer inline equations with "where:" at end of sentence, followed by list + - ✅ **CORRECT**: `For an ellipse: $\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$ where:` + - ❌ **AVOID**: Blank line, then equation block, then blank line, then "where:" - LaTeX syntax for symbols: `^\circ` not `°`, `\frac{}{}` for fractions - Label variables clearly: "where: $r$ = radius, $θ$ = angle" - Use aligned equations: `\begin{aligned}...\end{aligned}` for multi-step derivations +- Use square brackets `[x, y]` for point coordinates consistently across documentation **MathWorld Links:** - Link every new mathematical term on first mention diff --git a/docs/make.jl b/docs/make.jl index 97eae71..17355e8 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -22,7 +22,8 @@ makedocs(; "Geometry/02 Quadrilaterals.md", "Geometry/03 Polygons.md", "Geometry/04 Circles.md", - # "Geometry/04 Hyperbola.md" # TODO: Uncomment when ready to show + "Geometry/05 Ellipses.md", + # "Geometry/06 Hyperbola.md" TODO: Uncomment when ready to show ], # "Linear Algebra" => [ # TODO: Uncomment when ready to show # "Linear Algebra/01 Systems of Equations.md", diff --git a/docs/src/Geometry/05 Ellipses.md b/docs/src/Geometry/05 Ellipses.md new file mode 100644 index 0000000..23e0f69 --- /dev/null +++ b/docs/src/Geometry/05 Ellipses.md @@ -0,0 +1,182 @@ +# Ellipses + +An [ellipse](https://mathworld.wolfram.com/Ellipse.html) is a curve that is the locus of all points in a plane for which the sum of distances from two fixed points (called [foci](https://mathworld.wolfram.com/Focus.html)) is constant. Ellipses are fundamental [conic sections](https://mathworld.wolfram.com/ConicSection.html) with applications in orbital mechanics, optics, engineering, and architecture. + +## Definition and Basic Properties + +### Geometric Definition + +An ellipse is defined by two fixed points $F_1$ and $F_2$ (the foci), separated by distance $2c$, such that for any point $P$ on the ellipse: $r_1 + r_2 = 2a$ where: + +- $r_1$ is the distance from $P$ to $F_1$ +- $r_2$ is the distance from $P$ to $F_2$ +- $a$ is the semi-major axis (half the longest diameter) + +### Standard Equation + +For an ellipse centered at the origin with axes aligned to the coordinate axes: $\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$ where: + +- $a$ is the semi-major axis (assuming $a \geq b$) +- $b$ is the semi-minor axis +- The relationship $b^2 = a^2 - c^2$ connects the semi-minor axis to the distance between foci + +### Translated Ellipse + +For an ellipse centered at point $[h, k]$: $\frac{(x-h)^2}{a^2} + \frac{(y-k)^2}{b^2} = 1$ + +## Key Parameters + +### Eccentricity + +The [eccentricity](https://mathworld.wolfram.com/Eccentricity.html) measures how "stretched" the ellipse is: $e = \frac{c}{a} = \sqrt{1 - \frac{b^2}{a^2}}$ where $0 \leq e < 1$: + +- $e = 0$ gives a circle (special case) +- $e \to 1$ gives an increasingly elongated ellipse + +### Foci + +The foci are located at distance $c$ from the center along the major axis: $c = ae = \sqrt{a^2 - b^2}$ + +For a horizontal major axis centered at origin: $F_1 = [-c, 0]$ and $F_2 = [c, 0]$ + +### Relationship Between Parameters + +$$\begin{aligned}b &= a\sqrt{1-e^2} \\ c &= ae \\ a^2 &= b^2 + c^2\end{aligned}$$ + +## Parametric Form + +Ellipses can be expressed parametrically, similar to circles but with different scalings: $$\begin{aligned}x(t) &= a\cos(t) \\ y(t) &= b\sin(t)\end{aligned}$$ where $t \in (0, 2\pi)$ is the parameter. + +For a translated ellipse centered at $[h, k]$: $$\begin{aligned}x(t) &= h + a\cos(t) \\ y(t) &= k + b\sin(t)\end{aligned}$$ + +## Polar Form (Focus at Origin) + +When using polar coordinates with the origin at a focus: $$r = \frac{a(1-e^2)}{1 + e\cos\theta}$$ + +This form is particularly useful in orbital mechanics, where celestial bodies follow elliptical orbits with the central body at one focus (Kepler's First Law). + +## Geometric Properties + +### Area + +The area enclosed by an ellipse is: $$A = \pi ab$$ + +This can be seen as a scaled version of a circle's area, where the circle of radius $a$ is compressed by factor $b/a$ in one direction. + +### Perimeter + +The perimeter (circumference) of an ellipse cannot be expressed in elementary functions. It is given by the complete [elliptic integral of the second kind](https://mathworld.wolfram.com/CompleteEllipticIntegraloftheSecondKind.html): $$p = 4aE(e)$$ + +where $E(e)$ is the complete elliptic integral with modulus $e$ (the eccentricity). + +#### Approximations + +Several useful approximations exist for the perimeter: + +**Ramanujan's Approximation** (very accurate): $$p \approx \pi(a+b)\left(1 + \frac{3h}{10 + \sqrt{4-3h}}\right)$$ where $h = \frac{(a-b)^2}{(a+b)^2}$ + +**Simpler Approximation**: $$p \approx \pi\sqrt{2(a^2 + b^2)}$$ + +**Ramanujan's Second Form**: $$p \approx \pi[3(a+b) - \sqrt{(a+3b)(3a+b)}]$$ + +### Curvature + +The curvature at parameter $t$ is: $$\kappa(t) = \frac{ab}{(b^2\cos^2 t + a^2\sin^2 t)^{3/2}}$$ + +Maximum curvature occurs at the ends of the minor axis: $\kappa_{\text{max}} = \frac{a}{b^2}$ + +Minimum curvature occurs at the ends of the major axis: $\kappa_{\text{min}} = \frac{b}{a^2}$ + +## Directrix + +Each focus has an associated [directrix](https://mathworld.wolfram.com/ConicSectionDirectrix.html), a line perpendicular to the major axis. The ratio of distances from any point on the ellipse to a focus and its corresponding directrix equals the eccentricity: $$\frac{r}{d} = e$$ + +The directrix is located at distance $\frac{a^2}{c} = \frac{a}{e}$ from the center. + +## Reflective Property + +A ray of light emanating from one focus will reflect off the ellipse and pass through the other focus. This property is used in: + +- **Whispering galleries**: Sound waves from one focus are audible at the other +- **Elliptical mirrors**: Used in certain telescope designs +- **Medical applications**: Lithotripsy uses elliptical reflectors to focus shock waves on kidney stones + +## Special Cases and Relationships + +### Circle as Special Case + +When $a = b$, the ellipse becomes a circle: + +- **Eccentricity** is $e = 0$ +- **Both foci** coincide at the center +- **All radii** are equal + +### Rotation to 3D + +- **Oblate spheroid**: Ellipse rotated about its minor axis (like Earth's shape) +- **Prolate spheroid**: Ellipse rotated about its major axis (like a rugby ball) + +### Relationship to Other Conics + +Ellipses are one of the four types of [conic sections](https://mathworld.wolfram.com/ConicSection.html): + +- **Circle:** Special case of ellipse with $e = 0$ +- **Parabola:** Limiting case as $e \to 1$ +- **Hyperbola:** When $e > 1$ + +## General Quadratic Form + +The general equation for a conic section is: $$ax^2 + 2bxy + cy^2 + 2dx + 2fy + g = 0$$ + +This represents an ellipse when: $$\begin{aligned}\Delta &= \begin{vmatrix} a & b & d \\ b & c & f \\ d & f & g \end{vmatrix} \neq 0 \\ J &= \begin{vmatrix} a & b \\ b & c \end{vmatrix} > 0 \\ \frac{\Delta}{I} &< 0, \quad \text{where } I = a + c\end{aligned}$$ + +## Applications + +### Astronomy and Orbital Mechanics + +- Planetary orbits are elliptical (Kepler's First Law) +- The Sun is at one focus of each planet's orbital ellipse +- Satellites, comets, and asteroids follow elliptical paths + +### Engineering and Architecture + +- Elliptical gears can rotate smoothly against each other +- Whispering galleries in architecture +- Elliptical arches distribute load efficiently + +### Optics + +- Elliptical mirrors focus light from one focus to another +- Used in certain telescope and reflector designs + +### Nature + +- Orbits of electrons in some atomic models (historically) +- Cross-sections of many biological structures +- Shadows cast by circles viewed at an angle + +## Construction Methods + +### String Method + +The classical method using the two-focus definition: + +1. Pin a string at both foci with total length $2a$ +2. Keep the string taut with a pencil +3. Move the pencil to trace the ellipse + +### Trammel Construction + +If endpoints of a segment move along two perpendicular lines, a fixed point on the segment traces an ellipse. + +## Historical Notes + +- **Menaechmus** (ca. 350 BCE): First studied ellipses +- **Apollonius** (ca. 200 BCE): Named the ellipse and studied its properties +- **Johannes Kepler** (1609): Discovered that planetary orbits are elliptical +- **Edmund Halley** (1705): Showed that Halley's Comet follows an elliptical orbit + +## See Also + +- [Circles](04 Circles.md) - Special case of ellipse +- [Conic Sections](https://mathworld.wolfram.com/ConicSection.html) From add2f21096c80f5053ffad13f9b4209aaf72baf8 Mon Sep 17 00:00:00 2001 From: Aron T Date: Fri, 28 Nov 2025 15:31:54 +0200 Subject: [PATCH 2/9] Restore Hyperbola.md as it was --- docs/src/Geometry/{05 Hyperbola.md => 06 Hyperbola.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/src/Geometry/{05 Hyperbola.md => 06 Hyperbola.md} (100%) diff --git a/docs/src/Geometry/05 Hyperbola.md b/docs/src/Geometry/06 Hyperbola.md similarity index 100% rename from docs/src/Geometry/05 Hyperbola.md rename to docs/src/Geometry/06 Hyperbola.md From e858c845bed0f7df84fc18fe4fb52cde9c76da07 Mon Sep 17 00:00:00 2001 From: Aron T Date: Fri, 28 Nov 2025 16:24:22 +0200 Subject: [PATCH 3/9] Fix bullet points to start with text before LaTeX math --- docs/src/Geometry/05 Ellipses.md | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/docs/src/Geometry/05 Ellipses.md b/docs/src/Geometry/05 Ellipses.md index 23e0f69..05ca021 100644 --- a/docs/src/Geometry/05 Ellipses.md +++ b/docs/src/Geometry/05 Ellipses.md @@ -8,16 +8,16 @@ An [ellipse](https://mathworld.wolfram.com/Ellipse.html) is a curve that is the An ellipse is defined by two fixed points $F_1$ and $F_2$ (the foci), separated by distance $2c$, such that for any point $P$ on the ellipse: $r_1 + r_2 = 2a$ where: -- $r_1$ is the distance from $P$ to $F_1$ -- $r_2$ is the distance from $P$ to $F_2$ -- $a$ is the semi-major axis (half the longest diameter) +- The distance from $P$ to $F_1$ is $r_1$ +- The distance from $P$ to $F_2$ is $r_2$ +- The semi-major axis (half the longest diameter) is $a$ ### Standard Equation For an ellipse centered at the origin with axes aligned to the coordinate axes: $\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$ where: -- $a$ is the semi-major axis (assuming $a \geq b$) -- $b$ is the semi-minor axis +- The semi-major axis (assuming $a \geq b$) is $a$ +- The semi-minor axis is $b$ - The relationship $b^2 = a^2 - c^2$ connects the semi-minor axis to the distance between foci ### Translated Ellipse @@ -30,8 +30,8 @@ For an ellipse centered at point $[h, k]$: $\frac{(x-h)^2}{a^2} + \frac{(y-k)^2} The [eccentricity](https://mathworld.wolfram.com/Eccentricity.html) measures how "stretched" the ellipse is: $e = \frac{c}{a} = \sqrt{1 - \frac{b^2}{a^2}}$ where $0 \leq e < 1$: -- $e = 0$ gives a circle (special case) -- $e \to 1$ gives an increasingly elongated ellipse +- A circle (special case) has $e = 0$ +- An increasingly elongated ellipse has $e \to 1$ ### Foci @@ -45,13 +45,19 @@ $$\begin{aligned}b &= a\sqrt{1-e^2} \\ c &= ae \\ a^2 &= b^2 + c^2\end{aligned}$ ## Parametric Form -Ellipses can be expressed parametrically, similar to circles but with different scalings: $$\begin{aligned}x(t) &= a\cos(t) \\ y(t) &= b\sin(t)\end{aligned}$$ where $t \in (0, 2\pi)$ is the parameter. +Ellipses can be expressed parametrically, similar to circles but with different scalings: -For a translated ellipse centered at $[h, k]$: $$\begin{aligned}x(t) &= h + a\cos(t) \\ y(t) &= k + b\sin(t)\end{aligned}$$ +$$\begin{aligned}x(t) &= a\cos(t) \\ y(t) &= b\sin(t)\end{aligned}$$ where $t \in (0, 2\pi)$ is the parameter. + +For a translated ellipse centered at $[h, k]$: + +$$\begin{aligned}x(t) &= h + a\cos(t) \\ y(t) &= k + b\sin(t)\end{aligned}$$ ## Polar Form (Focus at Origin) -When using polar coordinates with the origin at a focus: $$r = \frac{a(1-e^2)}{1 + e\cos\theta}$$ +When using polar coordinates with the origin at a focus: + +$$r = \frac{a(1-e^2)}{1 + e\cos\theta}$$ This form is particularly useful in orbital mechanics, where celestial bodies follow elliptical orbits with the central body at one focus (Kepler's First Law). From 29e0e1ac70b45365116b0549062395457aea752e Mon Sep 17 00:00:00 2001 From: Aron T Date: Tue, 2 Dec 2025 16:14:01 +0200 Subject: [PATCH 4/9] Expand ellipse documentation with derivations and clarify LaTeX formatting rules Ellipse documentation: - Add detailed derivation of standard form using Pythagorean theorem - Add Parts of an Ellipse section with all terminology - Add Midpoint Equation section with full algebraic derivation - Add Circle as Special Case derivation - Expand Summary Characteristics section - Fix subscript notation in LaTeX equations Copilot instructions: - Clarify that multi-line aligned blocks are allowed in $$ display - Show correct example with newlines inside aligned block - Emphasize no BLANK lines between $$ and content (not no newlines at all) --- .github/copilot-instructions.md | 26 +++-- docs/src/Geometry/05 Ellipses.md | 179 +++++++++++++++++++++++++++---- 2 files changed, 176 insertions(+), 29 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index a582ccf..251805a 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -298,13 +298,27 @@ Documentation in `docs/src/` explains general math concepts (not code). Follow t **Mathematical Notation:** - Use LaTeX: `$$` for display equations, inline with `$...$` -- **CRITICAL**: `$$` display blocks in Documenter.jl MUST NOT have blank lines between delimiters and content - - ✅ **CORRECT**: `$$\begin{aligned}...content...\end{aligned}$$` (no newlines) - - ❌ **WRONG**: `$$\ncontent\n$$` (newlines break parser and cause cascade errors) - - ✅ **ALSO WORKS**: `$$equation$$` inline on same line +- **CRITICAL**: `$$` display blocks in Documenter.jl must have `$$` directly attached to content (no blank lines or return after opening or before closing) + - ✅ **CORRECT** (multi-line aligned block): + ``` + $$\begin{aligned} + b &= a\sqrt{1-e^2} \\ + c &= ae \\ + a^2 &= b^2 + c^2 + \end{aligned}$$ + ``` + - ✅ **CORRECT** (single equation): `$$equation$$` + - ❌ **WRONG** (blank lines or return between `$$` and content): + ``` + $$ + + content + + $$ + ``` - **Bullet point style**: List items starting with `-` must begin with text, then LaTeX math - - ✅ **CORRECT**: `- $a$ is the semi-major axis` - - ❌ **WRONG**: `- semi-major axis: $a$` + - ✅ **CORRECT**: `- The semi-major axis is $a$` + - ❌ **WRONG**: `- $a$ is the semi-major axis` - **Equation placement style**: Prefer inline equations with "where:" at end of sentence, followed by list - ✅ **CORRECT**: `For an ellipse: $\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$ where:` - ❌ **AVOID**: Blank line, then equation block, then blank line, then "where:" diff --git a/docs/src/Geometry/05 Ellipses.md b/docs/src/Geometry/05 Ellipses.md index 05ca021..9955157 100644 --- a/docs/src/Geometry/05 Ellipses.md +++ b/docs/src/Geometry/05 Ellipses.md @@ -1,24 +1,155 @@ # Ellipses -An [ellipse](https://mathworld.wolfram.com/Ellipse.html) is a curve that is the locus of all points in a plane for which the sum of distances from two fixed points (called [foci](https://mathworld.wolfram.com/Focus.html)) is constant. Ellipses are fundamental [conic sections](https://mathworld.wolfram.com/ConicSection.html) with applications in orbital mechanics, optics, engineering, and architecture. +An [ellipse](https://mathworld.wolfram.com/Ellipse.html) is a plane figure that like a circle, also has curvilinear edges, but is more general. Ellipses are fundamental [conic sections](https://mathworld.wolfram.com/ConicSection.html) with applications in orbital mechanics, optics, engineering, and architecture. ## Definition and Basic Properties -### Geometric Definition +### Set/Geometric Definition -An ellipse is defined by two fixed points $F_1$ and $F_2$ (the foci), separated by distance $2c$, such that for any point $P$ on the ellipse: $r_1 + r_2 = 2a$ where: +An ellipse can be defined as the set of all points $P$ (the [locus](https://mathworld.wolfram.com/Locus.html)) in a plane such that the sum of the distances to two fixed points $F_1$ and $F_2$ (the foci--see below) is constant: $$\{P : |PF_1| + |PF_2| = 2a\}$$ where: -- The distance from $P$ to $F_1$ is $r_1$ -- The distance from $P$ to $F_2$ is $r_2$ -- The semi-major axis (half the longest diameter) is $a$ +- The distance from $P$ to $F_1$ is $|PF_1|$ +- The distance from $P$ to $F_2$ is $|PF_2|$ +- The constant sum $2a$ is the length of the major axis (see below) of the ellipse +- The semi-major axis (see below) is $a$ (half the major axis length) -### Standard Equation +### Parts of an Ellipse -For an ellipse centered at the origin with axes aligned to the coordinate axes: $\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$ where: +- **[Foci](https://mathworld.wolfram.com/Focus.html):** Two fixed points $F_1$ and $F_2$ inside the ellipse such that the sum of distances to any point on the ellipse is constant +- **Center:** The midpoint between the two foci +- **Major Axis:** The longest diameter of the ellipse, passing through both foci, with length $2r$ or $2a$ +- **Minor Axis:** The shortest diameter, perpendicular to the major axis at the center, with length $2b$ +- **Semi-Major Axis:** Half the length of the major axis, denoted $a$ +- **Semi-Minor Axis:** Half the length of the minor axis, denoted $b$ +- **Vertices:** The endpoints of the major axis, located at a distance $a$ from the center +- **Co-Vertices:** The endpoints of the minor axis, located at a distance $b$ from the center +### Standard Form Equation + +#### Derivation of Standard Form + +Let's derive the standard form of the ellipse equation using the Pythagorean theorem and the distance definition. An ellipse is formed from the set of all points $[x, y]$ for which the sum $r_1 + r_2$ of the distances to two fixed points $A = [a_1, a_2]$ and $B = [b_1, b_2]$ (called focal points) has a constant value $2r$. Using the Pythagorean theorem we get: + +$$\begin{aligned} +r_1 &= \sqrt{(x - a_1)^2 + (y - a_2)^2} \\ +r_2 &= \sqrt{(x - b_1)^2 + (y - b_2)^2} \\ +r_1 + r_2 &= 2r +\end{aligned}$$ + +For the sake of simplicity, assume that the two foci lie on the x-axis and that the center of the ellipse (center of the foci) is the origin $[0, 0]$: $A = [-c, 0]$ and $B = [c, 0]$, where $c > 0$. Substituting these values in the equation above we get: + +$$\sqrt{(x + c)^2 + y^2} + \sqrt{(x - c)^2 + y^2} = 2r (or 2a)$$ + +In this case the two _major vertices_ of the ellipse are the points $H_1 = [-r, 0]$ and $H_2 = [r, 0]$, the line of length $2r$ (or $2a$) connecting these points is called the _major axis_ of the ellipse $r$ (or $a$) is called the _major axis radius_. The two _minor vertices_ of the ellipse are then the points of the form $N_1 = [0, b]$ and $N_2 = [0, -b]$ on the ellipse-–that is, the points of intersection of such an ellipse with the y-axis. + +The points $N_1$ and $N_2$ are also the intersections of the circles of radius $r$ about either of the foci. Hence we can obtain from the Pythagorean theorem: + +$$\begin{aligned} +b^2 &= r^2 - c^2 \\ +b &= \sqrt{r^2 - c^2} \\ +\end{aligned}$$ + +Thus point $N_1 = [0, \sqrt{r^2 - c^2}]$ and $N_2 = [0, -\sqrt{r^2 - c^2}]$. The minor vertices form the minor axis of the ellipse and $b = \sqrt{r^2 - c^2}$ denotes the minor axis radius. + +#### Circle as Special Case + +When the two foci coincide at the center ($c = 0$), the elliptic equation becomes: + +$$\begin{aligned} +\sqrt{x^2 + y^2} + \sqrt{x^2 + y^2} &= 2r \text{ and then} \\ +2 \sqrt{x^2 + y^2} &= 2r \\ +\end{aligned}$$ + +Cancelling $2$ and then squaring both sides gives equation $x^2 + y^2 = r^2$, which is the standard equation of a circle with radius $r$ centered at the origin. + +### Midpoint Equation + +#### Deriving the Midpoint Equation + +By squaring and rearranging the standard form for the ellipse, we can derive the simplified midpoint equation. Starting from the standard form: + +$$\sqrt{(x + c)^2 + y^2} + \sqrt{(x - c)^2 + y^2} = 2r$$ + +Isolate one of the square roots: + +$$\sqrt{(x + c)^2 + y^2} = 2r - \sqrt{(x - c)^2 + y^2}$$ + +Now square both sides: + +$$(x + c)^2 + y^2 = (2r - \sqrt{(x - c)^2 + y^2})^2$$ + +Expanding the right side: + +$$(x + c)^2 + y^2 = 4r^2 - 4r\sqrt{(x - c)^2 + y^2} + (x - c)^2 + y^2$$ + +Cancel $y^2$ from both sides and rearrange: + +$$4r\sqrt{(x - c)^2 + y^2} = 4r^2 + (x - c)^2 - (x + c)^2$$ + +Simplifying the right side: + +$$4r\sqrt{(x - c)^2 + y^2} = 4r^2 - 4cx$$ + +Divide both sides by $4r$: + +$$\sqrt{(x - c)^2 + y^2} = r - \frac{cx}{r}$$ + +Now square both sides again: + +$$(x - c)^2 + y^2 = \left(r - \frac{cx}{r}\right)^2$$ + +Expanding the right side: + +$$(x - c)^2 + y^2 = r^2 - 2cx + \frac{c^2x^2}{r^2}$$ + +Rearranging gives: + +$$y^2 = r^2 - 2cx + \frac{c^2x^2}{r^2} - (x - c)^2$$ + +Expanding $(x - c)^2$: + +$$y^2 = r^2 - 2cx + \frac{c^2x^2}{r^2} - (x^2 - 2cx + c^2)$$ + +Simplifying: + +$$y^2 = r^2 - x^2 + \frac{c^2x^2}{r^2} - c^2$$ + +Combining like terms: + +$$y^2 = (r^2 - c^2) - x^2\left(1 - \frac{c^2}{r^2}\right)$$ + +Factoring: + +$$y^2 = (r^2 - c^2) - x^2\frac{r^2 - c^2}{r^2}$$ + +Dividing both sides by $(r^2 - c^2)$: + +$$\frac{y^2}{r^2 - c^2} + \frac{x^2}{r^2} = 1$$ + +Finally,since $b^2 = r^2 - c^2$, we have the simplified midpoint equation form of the ellipse equation (using the more standard $a$ for semi-major axis and $b$ for semi-minor axis): + +$$\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$$ + +#### Summary Characteristics of Standard Form and Midpoint Equation + +This equation describes an ellipse centered at the origin with: - The semi-major axis (assuming $a \geq b$) is $a$ - The semi-minor axis is $b$ - The relationship $b^2 = a^2 - c^2$ connects the semi-minor axis to the distance between foci +- The foci are located at $[-c, 0]$ and $[c, 0]$ +- The distance between the foci is $2c$ +- The major axis length is $2a$ +- The minor axis length is $2b$ +- The center is at the origin $[0, 0]$ +- The vertices are at $[-a, 0]$ and $[a, 0]$ +- The co-vertices are at $[0, -b]$ and $[0, b]$ +- If the major axis is vertical instead of horizontal, the equation is: $\frac{x^2}{b^2} + \frac{y^2}{a^2} = 1$ with foci at $[0, -c]$ and $[0, c]$ + +Some additional notes: + +- From the triangle inequality it follows that the distance between the foci ($2c$) must be smaller than $r_1 + r_2 = 2r$. This criterion shows how large we should choose the major axis radius $r$ at least in order to be able to construct an ellipse with given foci. +- If points are given on an ellipse to be constructed, unlike a circle, three points are generally not enough to define an ellipse. Four suitable points are needed. +- Ellipses are symmetrical figures with respect to the major and minor axes. ### Translated Ellipse @@ -41,23 +172,33 @@ For a horizontal major axis centered at origin: $F_1 = [-c, 0]$ and $F_2 = [c, 0 ### Relationship Between Parameters -$$\begin{aligned}b &= a\sqrt{1-e^2} \\ c &= ae \\ a^2 &= b^2 + c^2\end{aligned}$$ +$$\begin{aligned} +b &= a\sqrt{1-e^2} \\ +c &= ae \\ +a^2 &= b^2 + c^2 +\end{aligned}$$ ## Parametric Form Ellipses can be expressed parametrically, similar to circles but with different scalings: -$$\begin{aligned}x(t) &= a\cos(t) \\ y(t) &= b\sin(t)\end{aligned}$$ where $t \in (0, 2\pi)$ is the parameter. +$$\begin{aligned} +x(t) &= a\cos(t) \\ +y(t) &= b\sin(t) +\end{aligned}$$ where $t \in (0, 2\pi)$ is the parameter. For a translated ellipse centered at $[h, k]$: -$$\begin{aligned}x(t) &= h + a\cos(t) \\ y(t) &= k + b\sin(t)\end{aligned}$$ +$$\begin{aligned} +x(t) &= h + a\cos(t) \\ +(t) &= k + b\sin(t) +\end{aligned}$$ ## Polar Form (Focus at Origin) -When using polar coordinates with the origin at a focus: +When using polar coordinates with the origin at one of the foci: -$$r = \frac{a(1-e^2)}{1 + e\cos\theta}$$ +$$r(\theta) = \frac{a(1 - e^2)}{1 + e\cos(\theta)}$$ where $r$ is the distance from the chosen focus and $\theta$ is the angle from the major axis. This form is particularly useful in orbital mechanics, where celestial bodies follow elliptical orbits with the central body at one focus (Kepler's First Law). @@ -65,14 +206,13 @@ This form is particularly useful in orbital mechanics, where celestial bodies fo ### Area -The area enclosed by an ellipse is: $$A = \pi ab$$ +The area enclosed by an ellipse is: $$F = \pi ab$$ This can be seen as a scaled version of a circle's area, where the circle of radius $a$ is compressed by factor $b/a$ in one direction. ### Perimeter The perimeter (circumference) of an ellipse cannot be expressed in elementary functions. It is given by the complete [elliptic integral of the second kind](https://mathworld.wolfram.com/CompleteEllipticIntegraloftheSecondKind.html): $$p = 4aE(e)$$ - where $E(e)$ is the complete elliptic integral with modulus $e$ (the eccentricity). #### Approximations @@ -84,7 +224,6 @@ Several useful approximations exist for the perimeter: **Simpler Approximation**: $$p \approx \pi\sqrt{2(a^2 + b^2)}$$ **Ramanujan's Second Form**: $$p \approx \pi[3(a+b) - \sqrt{(a+3b)(3a+b)}]$$ - ### Curvature The curvature at parameter $t$ is: $$\kappa(t) = \frac{ab}{(b^2\cos^2 t + a^2\sin^2 t)^{3/2}}$$ @@ -95,7 +234,7 @@ Minimum curvature occurs at the ends of the major axis: $\kappa_{\text{min}} = \ ## Directrix -Each focus has an associated [directrix](https://mathworld.wolfram.com/ConicSectionDirectrix.html), a line perpendicular to the major axis. The ratio of distances from any point on the ellipse to a focus and its corresponding directrix equals the eccentricity: $$\frac{r}{d} = e$$ +Each focus has an associated [directrix](https://mathworld.wolfram.com/ConicSectionDirectrix.html), a line perpendicular to the major axis. The ratio of distances from any point on the ellipse to a focus and its corresponding directrix equals the eccentricity: $$\frac{a}{d} = e$$ The directrix is located at distance $\frac{a^2}{c} = \frac{a}{e}$ from the center. @@ -130,12 +269,6 @@ Ellipses are one of the four types of [conic sections](https://mathworld.wolfram - **Parabola:** Limiting case as $e \to 1$ - **Hyperbola:** When $e > 1$ -## General Quadratic Form - -The general equation for a conic section is: $$ax^2 + 2bxy + cy^2 + 2dx + 2fy + g = 0$$ - -This represents an ellipse when: $$\begin{aligned}\Delta &= \begin{vmatrix} a & b & d \\ b & c & f \\ d & f & g \end{vmatrix} \neq 0 \\ J &= \begin{vmatrix} a & b \\ b & c \end{vmatrix} > 0 \\ \frac{\Delta}{I} &< 0, \quad \text{where } I = a + c\end{aligned}$$ - ## Applications ### Astronomy and Orbital Mechanics From 79801d0113d0edf1e284d9ec1fb9f7395a01574c Mon Sep 17 00:00:00 2001 From: Aron T Date: Wed, 3 Dec 2025 12:13:56 +0200 Subject: [PATCH 5/9] Reorganize ellipse documentation: move derivations to appendix - Move Standard Form and Midpoint Equation derivations to Appendix section - Streamline main content for better readability - Keep derivations available for reference at end of document --- docs/src/Geometry/05 Ellipses.md | 156 ++++++++++++++++--------------- 1 file changed, 79 insertions(+), 77 deletions(-) diff --git a/docs/src/Geometry/05 Ellipses.md b/docs/src/Geometry/05 Ellipses.md index 9955157..18d4e9d 100644 --- a/docs/src/Geometry/05 Ellipses.md +++ b/docs/src/Geometry/05 Ellipses.md @@ -64,75 +64,8 @@ Cancelling $2$ and then squaring both sides gives equation $x^2 + y^2 = r^2$, w ### Midpoint Equation -#### Deriving the Midpoint Equation +The standard form of the ellipse centered at the origin with foci on the x-axis can be simplified to: $$\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$$ where: -By squaring and rearranging the standard form for the ellipse, we can derive the simplified midpoint equation. Starting from the standard form: - -$$\sqrt{(x + c)^2 + y^2} + \sqrt{(x - c)^2 + y^2} = 2r$$ - -Isolate one of the square roots: - -$$\sqrt{(x + c)^2 + y^2} = 2r - \sqrt{(x - c)^2 + y^2}$$ - -Now square both sides: - -$$(x + c)^2 + y^2 = (2r - \sqrt{(x - c)^2 + y^2})^2$$ - -Expanding the right side: - -$$(x + c)^2 + y^2 = 4r^2 - 4r\sqrt{(x - c)^2 + y^2} + (x - c)^2 + y^2$$ - -Cancel $y^2$ from both sides and rearrange: - -$$4r\sqrt{(x - c)^2 + y^2} = 4r^2 + (x - c)^2 - (x + c)^2$$ - -Simplifying the right side: - -$$4r\sqrt{(x - c)^2 + y^2} = 4r^2 - 4cx$$ - -Divide both sides by $4r$: - -$$\sqrt{(x - c)^2 + y^2} = r - \frac{cx}{r}$$ - -Now square both sides again: - -$$(x - c)^2 + y^2 = \left(r - \frac{cx}{r}\right)^2$$ - -Expanding the right side: - -$$(x - c)^2 + y^2 = r^2 - 2cx + \frac{c^2x^2}{r^2}$$ - -Rearranging gives: - -$$y^2 = r^2 - 2cx + \frac{c^2x^2}{r^2} - (x - c)^2$$ - -Expanding $(x - c)^2$: - -$$y^2 = r^2 - 2cx + \frac{c^2x^2}{r^2} - (x^2 - 2cx + c^2)$$ - -Simplifying: - -$$y^2 = r^2 - x^2 + \frac{c^2x^2}{r^2} - c^2$$ - -Combining like terms: - -$$y^2 = (r^2 - c^2) - x^2\left(1 - \frac{c^2}{r^2}\right)$$ - -Factoring: - -$$y^2 = (r^2 - c^2) - x^2\frac{r^2 - c^2}{r^2}$$ - -Dividing both sides by $(r^2 - c^2)$: - -$$\frac{y^2}{r^2 - c^2} + \frac{x^2}{r^2} = 1$$ - -Finally,since $b^2 = r^2 - c^2$, we have the simplified midpoint equation form of the ellipse equation (using the more standard $a$ for semi-major axis and $b$ for semi-minor axis): - -$$\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$$ - -#### Summary Characteristics of Standard Form and Midpoint Equation - -This equation describes an ellipse centered at the origin with: - The semi-major axis (assuming $a \geq b$) is $a$ - The semi-minor axis is $b$ - The relationship $b^2 = a^2 - c^2$ connects the semi-minor axis to the distance between foci @@ -151,15 +84,17 @@ Some additional notes: - If points are given on an ellipse to be constructed, unlike a circle, three points are generally not enough to define an ellipse. Four suitable points are needed. - Ellipses are symmetrical figures with respect to the major and minor axes. +The full (and quite complex) derivation of the midpoint equation is provided in the Appendix at the end of this document. + ### Translated Ellipse For an ellipse centered at point $[h, k]$: $\frac{(x-h)^2}{a^2} + \frac{(y-k)^2}{b^2} = 1$ -## Key Parameters +## Key Parameters of an Ellipse ### Eccentricity -The [eccentricity](https://mathworld.wolfram.com/Eccentricity.html) measures how "stretched" the ellipse is: $e = \frac{c}{a} = \sqrt{1 - \frac{b^2}{a^2}}$ where $0 \leq e < 1$: +The [eccentricity](https://mathworld.wolfram.com/Eccentricity.html) measures how "stretched" the ellipse is: $e = \frac{c}{a} = \sqrt{1 - \frac{b^2}{a^2}}$ where $0 \leq e < 1: - A circle (special case) has $e = 0$ - An increasingly elongated ellipse has $e \to 1$ @@ -169,6 +104,7 @@ The [eccentricity](https://mathworld.wolfram.com/Eccentricity.html) measures how The foci are located at distance $c$ from the center along the major axis: $c = ae = \sqrt{a^2 - b^2}$ For a horizontal major axis centered at origin: $F_1 = [-c, 0]$ and $F_2 = [c, 0]$ +For a vertical major axis centered at origin: $F_1 = [0, -c]$ and $F_2 = [0, c]$ ### Relationship Between Parameters @@ -176,9 +112,10 @@ $$\begin{aligned} b &= a\sqrt{1-e^2} \\ c &= ae \\ a^2 &= b^2 + c^2 +a = \sqrt{b^2 + c^2} \end{aligned}$$ -## Parametric Form +## Parametric Form of an Ellipse Ellipses can be expressed parametrically, similar to circles but with different scalings: @@ -194,14 +131,14 @@ x(t) &= h + a\cos(t) \\ (t) &= k + b\sin(t) \end{aligned}$$ -## Polar Form (Focus at Origin) - -When using polar coordinates with the origin at one of the foci: +## Polar Form -$$r(\theta) = \frac{a(1 - e^2)}{1 + e\cos(\theta)}$$ where $r$ is the distance from the chosen focus and $\theta$ is the angle from the major axis. +The most common form uses polar coordinates with the origin at one of the foci: $$r(\theta) = \frac{a(1 - e^2)}{1 + e\cos(\theta)}$$ where $r$ is the distance from the chosen focus and $\theta$ is the angle from the major axis. This form is particularly useful in orbital mechanics, where celestial bodies follow elliptical orbits with the central body at one focus (Kepler's First Law). +There is also a polar form with the center at the origin, but it is less commonly used: $$r(\theta) = \frac{ab}{\sqrt{(b\cos(\theta))^2 + (a\sin(\theta))^2}}$$ + ## Geometric Properties ### Area @@ -212,8 +149,7 @@ This can be seen as a scaled version of a circle's area, where the circle of rad ### Perimeter -The perimeter (circumference) of an ellipse cannot be expressed in elementary functions. It is given by the complete [elliptic integral of the second kind](https://mathworld.wolfram.com/CompleteEllipticIntegraloftheSecondKind.html): $$p = 4aE(e)$$ -where $E(e)$ is the complete elliptic integral with modulus $e$ (the eccentricity). +The perimeter (circumference) of an ellipse cannot be expressed in elementary functions. It is given by the complete [elliptic integral of the second kind](https://mathworld.wolfram.com/CompleteEllipticIntegraloftheSecondKind.html): $$p = 4aE(e)$$ where $E(e)$ is the complete elliptic integral with modulus $e$ (the eccentricity). #### Approximations @@ -319,3 +255,69 @@ If endpoints of a segment move along two perpendicular lines, a fixed point on t - [Circles](04 Circles.md) - Special case of ellipse - [Conic Sections](https://mathworld.wolfram.com/ConicSection.html) + +## Appendix: Derivation of Standard Form Equation + +By squaring and rearranging the standard form for the ellipse, we can derive the simplified midpoint equation. Starting from the standard form: + +$$\sqrt{(x + c)^2 + y^2} + \sqrt{(x - c)^2 + y^2} = 2r$$ + +Isolate one of the square roots: + +$$\sqrt{(x + c)^2 + y^2} = 2r - \sqrt{(x - c)^2 + y^2}$$ + +Now square both sides: + +$$(x + c)^2 + y^2 = (2r - \sqrt{(x - c)^2 + y^2})^2$$ + +Expanding the right side: + +$$(x + c)^2 + y^2 = 4r^2 - 4r\sqrt{(x - c)^2 + y^2} + (x - c)^2 + y^2$$ + +Cancel $y^2$ from both sides and rearrange: + +$$4r\sqrt{(x - c)^2 + y^2} = 4r^2 + (x - c)^2 - (x + c)^2$$ + +Simplifying the right side: + +$$4r\sqrt{(x - c)^2 + y^2} = 4r^2 - 4cx$$ + +Divide both sides by $4r$: + +$$\sqrt{(x - c)^2 + y^2} = r - \frac{cx}{r}$$ + +Now square both sides again: + +$$(x - c)^2 + y^2 = \left(r - \frac{cx}{r}\right)^2$$ + +Expanding the right side: + +$$(x - c)^2 + y^2 = r^2 - 2cx + \frac{c^2x^2}{r^2}$$ + +Rearranging gives: + +$$y^2 = r^2 - 2cx + \frac{c^2x^2}{r^2} - (x - c)^2$$ + +Expanding $(x - c)^2$: + +$$y^2 = r^2 - 2cx + \frac{c^2x^2}{r^2} - (x^2 - 2cx + c^2)$$ + +Simplifying: + +$$y^2 = r^2 - x^2 + \frac{c^2x^2}{r^2} - c^2$$ + +Combining like terms: + +$$y^2 = (r^2 - c^2) - x^2\left(1 - \frac{c^2}{r^2}\right)$$ + +Factoring: + +$$y^2 = (r^2 - c^2) - x^2\frac{r^2 - c^2}{r^2}$$ + +Dividing both sides by $(r^2 - c^2)$: + +$$\frac{y^2}{r^2 - c^2} + \frac{x^2}{r^2} = 1$$ + +Finally,since $b^2 = r^2 - c^2$, we have the simplified midpoint equation form of the ellipse equation (using the more standard $a$ for semi-major axis and $b$ for semi-minor axis): + +$$\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$$ \ No newline at end of file From e0f098fe4747a18061c6e70bf73206265c1bc25e Mon Sep 17 00:00:00 2001 From: Aron T Date: Wed, 3 Dec 2025 12:37:48 +0200 Subject: [PATCH 6/9] Minor edits to ellipse documentation --- docs/src/Geometry/05 Ellipses.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/src/Geometry/05 Ellipses.md b/docs/src/Geometry/05 Ellipses.md index 18d4e9d..66a3639 100644 --- a/docs/src/Geometry/05 Ellipses.md +++ b/docs/src/Geometry/05 Ellipses.md @@ -94,7 +94,7 @@ For an ellipse centered at point $[h, k]$: $\frac{(x-h)^2}{a^2} + \frac{(y-k)^2} ### Eccentricity -The [eccentricity](https://mathworld.wolfram.com/Eccentricity.html) measures how "stretched" the ellipse is: $e = \frac{c}{a} = \sqrt{1 - \frac{b^2}{a^2}}$ where $0 \leq e < 1: +The [eccentricity](https://mathworld.wolfram.com/Eccentricity.html) measures how "stretched" the ellipse is: $e = \frac{c}{a} = \sqrt{1 - \frac{b^2}{a^2}}$ where $0 \leq e < 1$: - A circle (special case) has $e = 0$ - An increasingly elongated ellipse has $e \to 1$ @@ -103,8 +103,7 @@ The [eccentricity](https://mathworld.wolfram.com/Eccentricity.html) measures how The foci are located at distance $c$ from the center along the major axis: $c = ae = \sqrt{a^2 - b^2}$ -For a horizontal major axis centered at origin: $F_1 = [-c, 0]$ and $F_2 = [c, 0]$ -For a vertical major axis centered at origin: $F_1 = [0, -c]$ and $F_2 = [0, c]$ +For a horizontal major axis centered at origin: $F_1 = [-c, 0]$ and $F_2 = [c, 0]$. For a vertical major axis centered at origin: $F_1 = [0, -c]$ and $F_2 = [0, c]$ ### Relationship Between Parameters @@ -149,17 +148,18 @@ This can be seen as a scaled version of a circle's area, where the circle of rad ### Perimeter -The perimeter (circumference) of an ellipse cannot be expressed in elementary functions. It is given by the complete [elliptic integral of the second kind](https://mathworld.wolfram.com/CompleteEllipticIntegraloftheSecondKind.html): $$p = 4aE(e)$$ where $E(e)$ is the complete elliptic integral with modulus $e$ (the eccentricity). +The perimeter (circumference) of an ellipse cannot be expressed in elementary functions and requires us of integral calculus and knowledge of elliptical integrals](https://mathworld.wolfram.com/EllipticIntegral.html). This is outside the scope of this document. -#### Approximations - -Several useful approximations exist for the perimeter: +There are, however, several useful approximations for the perimeter: **Ramanujan's Approximation** (very accurate): $$p \approx \pi(a+b)\left(1 + \frac{3h}{10 + \sqrt{4-3h}}\right)$$ where $h = \frac{(a-b)^2}{(a+b)^2}$ **Simpler Approximation**: $$p \approx \pi\sqrt{2(a^2 + b^2)}$$ -**Ramanujan's Second Form**: $$p \approx \pi[3(a+b) - \sqrt{(a+3b)(3a+b)}]$$ +**Another Approximation**: $$p \approx \pi \left(1.5 (a+b) - \sqrt{ab}\right)$$ + +**Ramanujan's Second Form**: $$p \approx \pi\left(3(a+b) - \sqrt{(a+3b)(3a+b)}\right)$$ + ### Curvature The curvature at parameter $t$ is: $$\kappa(t) = \frac{ab}{(b^2\cos^2 t + a^2\sin^2 t)^{3/2}}$$ From abf4d58d699bb5bbe514ad8f15198ec72f0f8c50 Mon Sep 17 00:00:00 2001 From: Aron T Date: Wed, 3 Dec 2025 13:21:52 +0200 Subject: [PATCH 7/9] Add Parabola.md place holder --- docs/make.jl | 4 +++- docs/src/Geometry/07 Parabola.md | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 docs/src/Geometry/07 Parabola.md diff --git a/docs/make.jl b/docs/make.jl index 17355e8..f5432bf 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -23,7 +23,9 @@ makedocs(; "Geometry/03 Polygons.md", "Geometry/04 Circles.md", "Geometry/05 Ellipses.md", - # "Geometry/06 Hyperbola.md" TODO: Uncomment when ready to show + # "Geometry/06 Hyperbola.md" TODO: Uncomment when ready to show, + # "Geometry/07 Parabola.md" TODO: Uncomment when ready to show + ], # "Linear Algebra" => [ # TODO: Uncomment when ready to show # "Linear Algebra/01 Systems of Equations.md", diff --git a/docs/src/Geometry/07 Parabola.md b/docs/src/Geometry/07 Parabola.md new file mode 100644 index 0000000..b2e0d8b --- /dev/null +++ b/docs/src/Geometry/07 Parabola.md @@ -0,0 +1 @@ +# Parabola \ No newline at end of file From f9c0a7b6f65296f824efbc84a4fcb62cac8d89c1 Mon Sep 17 00:00:00 2001 From: Aron T Date: Thu, 4 Dec 2025 18:38:41 +0200 Subject: [PATCH 8/9] Add ellipse example to notebook with GeometryBasics dependency - Add ellipse plotting example to Basics.ipynb - Add GeometryBasics.jl dependency to module - Minor documentation edits to ellipse page --- Project.toml | 3 +- docs/src/Geometry/05 Ellipses.md | 3 +- notebooks/Basics.ipynb | 160 +++++++++++++++++++++++-------- src/Math_Foundations.jl | 2 +- 4 files changed, 124 insertions(+), 44 deletions(-) diff --git a/Project.toml b/Project.toml index 9b48715..02db061 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Math_Foundations" -authors = ["Aron T"] version = "0.1.0" +authors = ["Aron T"] [deps] AMRVW = "233ec0c9-6b8d-4766-b9a2-a16e389fc38a" @@ -10,6 +10,7 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" DrWatson = "634d3b9d-ee7a-5ddf-bec9-22491ea816e1" FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a" +GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326" IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a" ImageShow = "4e3cecfd-b093-5904-9786-8bbb286a6a31" LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" diff --git a/docs/src/Geometry/05 Ellipses.md b/docs/src/Geometry/05 Ellipses.md index 66a3639..b63ccad 100644 --- a/docs/src/Geometry/05 Ellipses.md +++ b/docs/src/Geometry/05 Ellipses.md @@ -66,6 +66,7 @@ Cancelling $2$ and then squaring both sides gives equation $x^2 + y^2 = r^2$, w The standard form of the ellipse centered at the origin with foci on the x-axis can be simplified to: $$\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$$ where: +- $x$ and $y$ are the coordinates $[x,y]$ of any point on the ellipse - The semi-major axis (assuming $a \geq b$) is $a$ - The semi-minor axis is $b$ - The relationship $b^2 = a^2 - c^2$ connects the semi-minor axis to the distance between foci @@ -320,4 +321,4 @@ $$\frac{y^2}{r^2 - c^2} + \frac{x^2}{r^2} = 1$$ Finally,since $b^2 = r^2 - c^2$, we have the simplified midpoint equation form of the ellipse equation (using the more standard $a$ for semi-major axis and $b$ for semi-minor axis): -$$\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$$ \ No newline at end of file +$$\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$$ diff --git a/notebooks/Basics.ipynb b/notebooks/Basics.ipynb index fc40eb1..dcbdb0b 100644 --- a/notebooks/Basics.ipynb +++ b/notebooks/Basics.ipynb @@ -619,7 +619,7 @@ }, { "cell_type": "code", - "execution_count": 59, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -644,7 +644,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -662,59 +662,59 @@ "\n", "\n", "\n", - " \n", + " \n", " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", + " \n", " \n", " \n", "\n", - "\n", + "\n", "\n", - " \n", + " \n", " \n", " \n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" ], "text/html": [ "" ] }, - "execution_count": 6, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -2463,7 +2463,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -3863,7 +3863,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -4085,6 +4085,84 @@ " println(\"Each of you gets less pizza area with the ring pizza: \", round(F_slice - F_ring_slice; digits=3), \" cm² less per person. Decline offer!!\") \n", "end\n" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Parabola" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "calculate the ellipse ℰ through the point X = [x₁, x₂] = [6,4] with center [0,0] and major axis radius r = 10\n", + "point X = [6, 4]\n", + "major axis radius a = r = 10\n", + "equation of ellipse ℰ through point X: (x₁^2)/(a^2) + (x₂^2)/(b^2) = 1\n", + "solving for b gives b = sqrt( (x₂^2) / (1 - (x₁^2)/(a^2)) )\n", + "substituting x₁ = 6 and x₂ = 4 and a = r = 10 into this equation gives:\n", + "b = 5.0\n", + "Thus the ellipse ℰ through point X has major axis radius a = 10 and minor axis radius b = 5.0\n", + "The equation of the ellipse ℰ: (x₁^2)/(10^2) + (x₂^2)/(5.0^2) = 1\n", + "The focii of the ellipse ℰ are located at distance c = sqrt(a^2 - b^2) = 8.66 from the center along the major axis.\n", + "The minor vertices of the ellipse ℰ are at points [0, 5.0] and [0, -5.0]\n", + "Thus the focii are at points F₁ = [-8.66, 0] and F₂ = [8.66, 0]\n", + "To verify that point X lies on the ellipse ℰ, we check that the sum of distances from X to each focus equals 2a = 20\n", + "Distance from X to F₁: 15.196\n", + "Distance from X to F₂: 4.804\n", + "Sum of distances d₁ + d₂ = 20.0\n", + "Verification successful: point X lies on the ellipse ℰ since d₁ + d₂ ≈ 20\n", + "the parametric equations of the ellipse ℰ are: x₁(t) = a * cos(t), x₂(t) = b * sin(t) for t in [0, 2π]\n" + ] + } + ], + "source": [ + "println(\"calculate the ellipse ℰ through the point X = [x₁, x₂] = [6,4] with center [0,0] and major axis radius r = 10\")\n", + "X = GeometryBasics.Point(6, 4)\n", + "println(\"point X = \", X)\n", + "r = 10\n", + "println(\"major axis radius a = r = \", r)\n", + "println(\"equation of ellipse ℰ through point X: (x₁^2)/(a^2) + (x₂^2)/(b^2) = 1\")\n", + "println(\"solving for b gives b = sqrt( (x₂^2) / (1 - (x₁^2)/(a^2)) )\")\n", + "println(\"substituting x₁ = \", X[1], \" and x₂ = \", X[2], \" and a = r = \", r, \" into this equation gives:\")\n", + "b_value = sqrt( (X[2]^2) / (1 - (X[1]^2)/(r^2)) )\n", + "println(\"b = \", round(b_value; digits=3))\n", + "println(\"Thus the ellipse ℰ through point X has major axis radius a = \", r, \" and minor axis radius b = \", round(b_value; digits=3)) \n", + "println(\"The equation of the ellipse ℰ: (x₁^2)/(10^2) + (x₂^2)/(\", b_value, \"^2) = 1\")\n", + "c_value = sqrt(r^2 - b_value^2)\n", + "println(\"The focii of the ellipse ℰ are located at distance c = sqrt(a^2 - b^2) = \", round(c_value; digits=3), \" from the center along the major axis.\")\n", + "println(\"The minor vertices of the ellipse ℰ are at points [0, \", round(b_value; digits=3), \"] and [0, \", round(-b_value; digits=3), \"]\")\n", + "println(\"Thus the focii are at points F₁ = [\", round(-c_value; digits=3), \", 0] and F₂ = [\", round(c_value; digits=3), \", 0]\") \n", + "println(\"To verify that point X lies on the ellipse ℰ, we check that the sum of distances from X to each focus equals 2a = 20\")\n", + "F₁ = GeometryBasics.Point(-c_value, 0)\n", + "F₂ = GeometryBasics.Point(c_value, 0)\n", + "d₁ = norm(X - F₁)\n", + "d₂ = norm(X - F₂)\n", + "sum_distances = d₁ + d₂\n", + "println(\"Distance from X to F₁: \", round(d₁; digits=3))\n", + "println(\"Distance from X to F₂: \", round(d₂; digits=3))\n", + "println(\"Sum of distances d₁ + d₂ = \", round(sum_distances; digits=3))\n", + "if isapprox(sum_distances, 2*r; atol=1e-3)\n", + " println(\"Verification successful: point X lies on the ellipse ℰ since d₁ + d₂ ≈ 20\")\n", + "else\n", + " println(\"Verification failed: point X does not lie on the ellipse ℰ since d₁ + d₂ ≠ 20\")\n", + "end\n", + "println(\"the parametric equations of the ellipse ℰ are: x₁(t) = a * cos(t), x₂(t) = b * sin(t) for t in [0, 2π]\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { diff --git a/src/Math_Foundations.jl b/src/Math_Foundations.jl index 0bab949..c3f32cf 100644 --- a/src/Math_Foundations.jl +++ b/src/Math_Foundations.jl @@ -1,7 +1,7 @@ module Math_Foundations using Reexport -@reexport using Symbolics, Nemo, Plots, Latexify, LaTeXStrings, Dates, AMRVW, Polynomials +@reexport using Symbolics, Nemo, Plots, Latexify, LaTeXStrings, Dates, AMRVW, Polynomials, GeometryBasics # Configure plotting for both interactive and headless environments if haskey(ENV, "CI") || get(ENV, "GKSwstype", "") == "100" From 0b79ad8a28bea5772151ad71b146bbae48d11aff Mon Sep 17 00:00:00 2001 From: Aron T Date: Fri, 5 Dec 2025 15:28:03 +0200 Subject: [PATCH 9/9] Add additional ellipse example to notebook --- notebooks/Basics.ipynb | 52 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/notebooks/Basics.ipynb b/notebooks/Basics.ipynb index dcbdb0b..9e621a4 100644 --- a/notebooks/Basics.ipynb +++ b/notebooks/Basics.ipynb @@ -4159,10 +4159,56 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "At a summer barbecue, you notice that the 20-cm-diameter round hamburgers, when frozen,\n", + "meld together into an ellipse two-thirds the size (area), with a major-axis radius\n", + "twice the minor-axis radius. \n", + "The problem would not let you go:\n", + "You are dying to know what the major and minor axis radii of the resulting Burger ellipses are.\n", + "Diameter D of the original round hamburger is 20 cm\n", + "Radius r of the original round hamburger is 10.0 cm\n", + "Area F_circle of the original round hamburger is π * r^2 = 314.159 cm²\n", + "Area F_ellipse of the resulting Burger ellipse is (2/3) * F_circle = 209.44 cm²\n", + "Let the major axis radius be a and the minor axis radius be b.\n", + "Given that a = 2b, we can express the area of the ellipse as F = π * a * b = π * (2b) * b = 2π * b^2\n", + "Setting this equal to F_ellipse, we have 2π * b^2 = F_ellipse\n", + "Solving for b^2 gives b^2 = F_ellipse / (2π)\n", + "Taking the square root gives b = sqrt(F_ellipse / (2π))\n", + "Substituting the value of F_ellipse we calculated above, gives b = 5.774 cm\n", + "Solving for a gives a = 2 * b = 11.547 cm\n" + ] + } + ], + "source": [ + "println(\"At a summer barbecue, you notice that the 20-cm-diameter round hamburgers, when frozen,\")\n", + "println(\"meld together into an ellipse two-thirds the size (area), with a major-axis radius\")\n", + "println(\"twice the minor-axis radius. \")\n", + "println(\"The problem would not let you go:\")\n", + "println(\"You are dying to know what the major and minor axis radii of the resulting Burger ellipses are.\")\n", + "D = 20\n", + "println(\"Diameter D of the original round hamburger is \", D, \" cm\")\n", + "r_circle = D / 2\n", + "println(\"Radius r of the original round hamburger is \", r_circle, \" cm\")\n", + "F_circle = π * r_circle^2\n", + "println(\"Area F_circle of the original round hamburger is π * r^2 = \", round(F_circle; digits=3), \" cm²\")\n", + "F_ellipse = (2/3) * F_circle\n", + "println(\"Area F_ellipse of the resulting Burger ellipse is (2/3) * F_circle = \", round(F_ellipse; digits=3), \" cm²\")\n", + "println(\"Let the major axis radius be a and the minor axis radius be b.\")\n", + "println(\"Given that a = 2b, we can express the area of the ellipse as F = π * a * b = π * (2b) * b = 2π * b^2\")\n", + "println(\"Setting this equal to F_ellipse, we have 2π * b^2 = F_ellipse\")\n", + "println(\"Solving for b^2 gives b^2 = F_ellipse / (2π)\")\n", + "println(\"Taking the square root gives b = sqrt(F_ellipse / (2π))\")\n", + "b_burger = sqrt(F_ellipse / (2 * π))\n", + "println(\"Substituting the value of F_ellipse we calculated above, gives b = \", round(b_burger; digits=3), \" cm\")\n", + "a_burger = 2 * b_burger\n", + "println(\"Solving for a gives a = 2 * b = \", round(a_burger; digits=3), \" cm\")" + ] } ], "metadata": {