feat: maths folder -> newtykins/maths

This commit is contained in:
newt 2024-10-09 18:02:47 +01:00
parent 11c3e90c57
commit 72f3bc757f
21 changed files with 1 additions and 274 deletions

View file

@ -2,5 +2,4 @@
. "$(dirname "$0")/_/husky.sh"
npx pretty-quick --staged
.husky/scripts/pdfToPng.sh
git add .

View file

@ -1,22 +0,0 @@
#!/bin/bash
find . -print0 | while IFS= read -r -d '' file
do
if [ -f "$file" ]; then
if [[ $file == *pdf ]]; then
mkdir temp
gm convert "$file" +adjoin temp/temp%02d.png
for temp in ./temp/*.png
do
gm convert "$temp" -fuzz 80% -trim +repage -bordercolor white -border 50x25 "$temp"
done
readarray -d . -t arr <<< $file
gm convert -append ./temp/*.png "${arr[1]:1}.png"
rm -rf temp
rm "$file" "${arr[1]:1}.synctex.gz"
fi
fi
done

View file

@ -1,3 +0,0 @@
{
"recommendations": ["James-Yu.latex-workshop"]
}

View file

@ -12,7 +12,6 @@
"commitlint.config.js": true,
"**/pnpm-lock.yaml": true
},
"C_Cpp.errorSquiggles": "Disabled",
"files.associations": {
"*.tcc": "cpp",
"complex": "cpp",
@ -33,7 +32,5 @@
"ostream": "cpp",
"ratio": "cpp",
"streambuf": "cpp"
},
"latex-workshop.latex.autoBuild.run": "onSave",
"latex-workshop.latex.autoClean.run": "onBuilt"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

View file

@ -1,53 +0,0 @@
\documentclass{style}
\usepackage{amsmath}
\usepackage{breqn}
\usepackage{mathtools}
\begin{document}
\begin{center}
Suppose we have an $n$th degree polynomial, such that $f(x) = c_{n}x^{n} + c_{n-1}x^{n-1} + c_{n-2}x^{n-2} + ... + c_{0} = \sum_{i=0}^{n}c_{n-i}x^{n-i}$
\hfill
By the power rule of differentiation, we can conclude that the first derivative of $f(x)$ is as follows
\begin{dmath*}
f'(x) = nc_{n}x^{n-1} + (n-1)c_{n-1}x^{n-2} + (n-2)c_{n-2}x^{n-3} + ... + c_{1} = \sum_{i=0}^{n-1}(n-i)c_{n-i}x^{n-i-1}
\end{dmath*}
And the second derivative is
\begin{dmath*}
f''(x) = n(n-1)c_{n}x^{n-2} + (n-1)(n-2)c_{n-1}x^{n-3} + (n-2)(n-3)c_{n-2}x^{n-4} + ...+ c_{2} = \sum_{i=0}^{n-2}(i-n)(i-n+1)a_{n-i}x^{n-i-2}
\end{dmath*}
After starting with an initial guess, the next iteration of Halley's method is given by $x_k - \frac{2f(x_k)f'(x_k)}{2[f'(x_k)]^2 - f(x_k)f''(x_k)}$.
This means that we must first find $f(x)f'(x)$, $[f'(x)]^2$, and $f(x)f''(x)$. These all consist of the multiplication of two series - there is a nice general form to this problem stated below
\begin{dmath*}
(\sum_{i=0}^{n}x_{i})(\sum_{j=0}^{m}y_{j}) = \sum_{i=0}^{n}\sum_{j=0}^{m}x_iy_j
\end{dmath*}
\newpage
From this, we can conclude that:
\begin{dmath*}
f(x)f'(x) = (\sum_{i=0}^{n}c_{n-i}x^{n-i})(\sum_{i=0}^{n-1}(n-i)c_{n-i}x^{n-i-1}) = \sum_{i=0}^{n}\sum_{j=0}^{n-1}(n-j)c_{n-i}c_{n-j}x^{2n-i-j-1}
\end{dmath*}
\begin{dmath*}
[f'(x)]^2 = (\sum_{i=0}^{n-1}(n-i)c_{n-i}x^{n-i-1})(\sum_{i=0}^{n-1}(n-i)c_{n-i}x^{n-i-1}) = \sum_{i=0}^{n-1}\sum_{j=0}^{n-1}(n-i)(n-j)c_{n-i}c_{n-j}x^{2(n-1)-i-j}
\end{dmath*}
\begin{dmath*}
f(x)f''(x) = (\sum_{i=0}^{n}c_{n-i}x^{n-i})(\sum_{i=0}^{n-2}(i-n)(i-n+1)a_{n-i}x^{n-i-2}) = \sum_{i=0}^{n}\sum_{j=0}^{n-2}(j-n)(j-n+1)c_{n-i}c_{n-j}x^{2(n-1)-i-j}
\end{dmath*}
And all that is left to do is to plug it into the formula for Halley's method, leaving us with the following:
\begin{align*}
x_{k+1} = x_{k} - \dfrac{2\sum_{i=0}^{n}\sum_{j=0}^{n-1}(n-j)c_{n-i}c_{n-j}x^{2n-i-j-1}}{\splitdfrac{2\sum_{i=0}^{n-1}\sum_{j=0}^{n-1}(n-i)(n-j)c_{n-i}c_{n-j}x^{2(n-1)-i-j}}{- \sum_{i=0}^{n}\sum_{j=0}^{n-2}(j-n)(j-n+1)c_{n-i}c_{n-j}x^{2(n-1)-i-j}}}
\end{align*}
\end{center}
\end{document}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -1,12 +0,0 @@
\documentclass{style}
\usepackage{amsmath}
\begin{document}
\begin{gather*}
f(x) = x^k - s \\
f'(x) = kx^{k - 1}
\end{gather*}
\begin{gather*}
x_{n + 1} = x_n - \frac{x_n^k - s}{kx_n^{k - 1}} = \frac{x_n(k - 1) + sx_n^{1 - k}}{k}
\end{gather*}
\end{document}

View file

@ -1,11 +0,0 @@
\LoadClass[17pt]{extarticle}
\pagenumbering{gobble}
\usepackage{geometry}
\geometry{a4paper, portrait, margin=1in}
\newcommand{\euler}{\begin{gather*}
\text{By Euler's formula:} \\
e^{i\theta} = cos(\theta) + i\sin(\theta) \\
e^{-i\theta} = cos(\theta) - i\sin(\theta)
\end{gather*}}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

View file

@ -1,27 +0,0 @@
\documentclass{../style}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\euler
\begin{gather*}
\therefore \cos(\theta) = \frac{e^{i\theta} + e^{-i\theta}}{2}
\end{gather*}
\begin{gather*}
\text{let} \quad \cos(\theta) = x \\
2x = e^{i\theta} + e^{-i\theta} \\
2xe^{i\theta} = (e^{i\theta})^2 + 1 \\
(e^{i\theta})^2 + (-2x)e^{i\theta} + 1 = 0
\end{gather*}
\begin{gather*}
e^{i\theta} = \frac{-(-2x) \pm \sqrt{(-2x)^2 - 4}}{2} = x \pm \sqrt{x^2 - 1} \\
i\theta = \ln(x \pm \sqrt{x^2 - 1}) \\
\theta = -i\ln(x \pm \sqrt{x^2 - 1})
\end{gather*}
\begin{gather*}
\therefore \arccos(\theta) = -i\ln(\theta \pm \sqrt{\theta^2 - 1})
\end{gather*}
\end{document}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

View file

@ -1,29 +0,0 @@
\documentclass{../style}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\euler
\begin{gather*}
\therefore \sin(\theta) = \frac{e^{i\theta} - e^{-i\theta}}{2i} \\
\cos(\theta) = \frac{e^{i\theta} + e^{-i\theta}}{2} \\
\tan(\theta) = \frac{\sin(\theta)}{\cos{\theta}} = -\frac{i(-1 + e^{2i\theta})}{1 + e^{2i\theta}} \\
\cot(\theta) = \frac{1}{\tan(\theta)} = -\frac{1 + e^{2i\theta}}{i(-1 + e^{2i\theta})}
\end{gather*}
\begin{gather*}
\text{let} \quad \cot(\theta) = x \\
x(i + ie^{2i\theta}) = -1(1 + e^{2i\theta}) \\
ix + ixe^{2i\theta} = -e^{2i\theta} - 1 \\
ixe^{2i\theta} + e^{2i\theta} = -1 - ix \\
(ix + 1)e^{2i\theta} = -1 - ix \\
e^{2i\theta} = -\frac{1 - ix}{1 + ix} \\
2i\theta = \ln(\frac{x + i}{x - i}) \\
i\theta = \frac{1}{2}\ln(\frac{x + i}{x - i}) \\
\theta = -\frac{i}{2}\ln(\frac{x + i}{x - i})
\end{gather*}
\begin{gather*}
\therefore \text{arccot}(\theta) = -\frac{i}{2}\ln(\frac{\theta + i}{\theta - i})
\end{gather*}
\end{document}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

View file

@ -1,28 +0,0 @@
\documentclass{../style}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\euler
\begin{gather*}
\therefore \sin(\theta) = \frac{e^{i\theta} - e^{-i\theta}}{2i} \\
\csc(\theta) = \frac{1}{\sin(\theta)} = \frac{2i}{e^{i\theta} - e^{-i\theta}}
\end{gather*}
\begin{gather*}
\text{let} \quad \csc(\theta) = x \\
\frac{2i}{x} = e^{i\theta} - e^{-i\theta} \\
\frac{2i}{x}e^{i\theta} = (e^{i\theta})^2 - 1 \\
(e^{i\theta})^2 + (-\frac{2i}{x})e^{i\theta} - 1 = 0
\end{gather*}
\begin{gather*}
e^{i\theta} = \frac{-(\frac{2i}{x}) \pm \sqrt{(\frac{2i}{x})^2 - 4(-1)}}{2} = x^{-1}i \pm \sqrt{1 - x^2} \\
i\theta = \ln(x^{-1}i \pm \sqrt{1 - x^2}) \\
\theta = -i\ln(x^{-1}i \pm \sqrt{1 - x^2})
\end{gather*}
\begin{gather*}
\therefore \text{arccsc}(\theta) = -i\ln(i\theta^{-1} \pm \sqrt{1 -\theta^2})
\end{gather*}
\end{document}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

View file

@ -1,29 +0,0 @@
\documentclass{../style}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\euler
\begin{gather*}
\therefore \cos(\theta) = \frac{e^{i\theta} + e^{-i\theta}}{2} \\
\sec(\theta) = \frac{1}{\cos(\theta)} = \frac{2}{e^{i\theta} + e^{-i\theta}}
\end{gather*}
\begin{gather*}
\text{let} \quad \sec(\theta) = x \\
x(e^{i\theta} + e^{-i\theta}) = 2 \\
e^{i\theta} + e^{-i\theta} = \frac{2}{x} \\
(e^{i\theta})^2 + 1 = \frac{2}{x}e^{i\theta} \\
(e^{i\theta})^2 + (-\frac{2}{x})e^{i\theta} + 1 = 0
\end{gather*}
\begin{gather*}
e^{i\theta} = \frac{-(-\frac{2}{x}) \pm \sqrt{(-\frac{2}{x})^2 - 4}}{2} = x^{-1} \pm \sqrt{x^{-2} - 1} \\
i\theta = \ln(x^{-1} \pm \sqrt{x^{-2} - 1}) \\
\theta = -i\ln(x^{-1} \pm \sqrt{x^{-2} - 1})
\end{gather*}
\begin{gather*}
\therefore \text{arcsec}(\theta) = -i\ln(\theta^{-1} \pm \sqrt{\theta^{-2} - 1})
\end{gather*}
\end{document}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9 KiB

View file

@ -1,27 +0,0 @@
\documentclass{../style}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\euler
\begin{gather*}
\therefore \sin(\theta) = \frac{e^{i\theta} - e^{-i\theta}}{2i}
\end{gather*}
\begin{gather*}
\text{let} \quad \sin(\theta) = x \\
2ix = e^{i\theta} - e^{-i\theta} \\
2ixe^{i\theta} = (e^{i\theta})^2 - 1 \\
(e^{i\theta})^2 + (-2ix)e^{i\theta} - 1 = 0
\end{gather*}
\begin{gather*}
e^{i\theta} = \frac{-(-2ix) \pm \sqrt{(-2ix)^2 - 4(-1)}}{2} = ix \pm \sqrt{1 - x^2} \\
i\theta = \ln(ix \pm \sqrt{1 - x^2}) \\
\theta = -i\ln(ix \pm \sqrt{1 - x^2})
\end{gather*}
\begin{gather*}
\therefore \arcsin(\theta) = -i\ln(i\theta \pm \sqrt{1 -\theta^2})
\end{gather*}
\end{document}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

View file

@ -1,28 +0,0 @@
\documentclass{../style}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\euler
\begin{gather*}
\therefore \sin(\theta) = \frac{e^{i\theta} - e^{-i\theta}}{2i} \\
\cos(\theta) = \frac{e^{i\theta} + e^{-i\theta}}{2} \\
\tan(\theta) = \frac{\sin(\theta)}{\cos{\theta}} = -\frac{i(-1 + e^{2i\theta})}{1 + e^{2i\theta}}
\end{gather*}
\begin{gather*}
\text{let} \quad \tan(\theta) = x \\
x(1 + e^{2i\theta}) = -i(-1 + e^{2i\theta}) \\
x + xe^{2i\theta} = i - ie^{2i\theta} \\
xe^{2i\theta} + ie^{2i\theta} = i - x \\
e^{2i\theta}(i + x) = i - x \\
e^{2i\theta} = \frac{i - x}{i + x} \\
2i\theta = \ln(\frac{i - x}{i + x}) \\
i\theta = \frac{1}{2}\ln(\frac{i - x}{i + x}) \\
\theta = -\frac{i}{2}\ln(\frac{i - x}{i + x})
\end{gather*}
\begin{gather*}
\therefore \arctan(\theta) = -\frac{i}{2}\ln(\frac{i - \theta}{i + \theta})
\end{gather*}
\end{document}