Compare commits

..

3 Commits

22 changed files with 459 additions and 971 deletions

View File

@ -13,9 +13,8 @@ Yes. Consider sharing it with your classmates ;)
Here's a quick rundown of how to build from source: Here's a quick rundown of how to build from source:
1) download or clone the repository ```git clone https://git.sasserisop.com/Sasserisop/MATH201``` 1) download or clone the repository ```git clone https://git.sasserisop.com/Sasserisop/MATH201```
2) make sure you have hugo installed 2) make sure you have hugo installed
3) if you are using localhost, inside of themes/zettels/assets/js/search.js set 'const localhost' to true. 3) open a command prompt in the MATH201/ directory and run the command ```hugo server --disableFastRender```
4) open a command prompt in the MATH201/ directory and run the command ```hugo server --disableFastRender``` 4) visit your site by opening http://localhost:1313 on your browser.
5) visit your site by opening http://localhost:1313 on your browser.
Now if you want to host it on a live website, you can run: Now if you want to host it on a live website, you can run:
```hugo``` ```hugo```

View File

@ -1,37 +1,42 @@
# Bernoulli's equation: # Bernoulli's equation:
### $$\frac{ dy }{ dx } +P(x)y=Q(x)y^n \quad\quad n\in\mathbb{R},\quad n\ne0,1$$ ### $$\frac{ dy }{ dx } +P(x)y=Q(x)y^n \quad\quad n\in\mathbb{R},\quad n\ne0,1$$
>I'm calling this #de_b_type1. This is in standard form btw. >For now, I'll tag and refer to these as #de_bernoulli. This is in standard form btw.
It looks almost like a linear equation! In fact if $n=0$ it is by definition. We will see further that if $n=1$ you get a separable equation. So we ignore the cases when $n=0,1$ as these can be solved with prior tools. It looks almost like a linear equation! In fact if $n=0$ it is by definition. We will see further that if $n=1$ you get a separable equation. So we ignore the cases when $n=0,1$ as these can be solved with prior tools.
Bernoulli's equations are important as you will see it in biology and in engineering. Bernoulli's equations are important as you will see it in biology and in engineering.
If $y$ is $+$ then $y(x)=0$ is a solution to the equation: Our goal is to find the general solution to $y$ which is some function of $x$. We should expect one arbitrary constant in our final answer for $y$ since this is a first order differential equation.
$\frac{dy}{dx}+0=0\quad\Rightarrow \quad0=0$ Notice there's an easy solution! $y(x)=0$ is a trivial solution to any Bernoulli equation.
You can verify that by plugging in $y(x)=0$ to the original expression:
$\frac{dy}{dx}+0=0\quad \implies \quad0=0$
Now let's find the general solution.
Let's move the y to the LHS: Let's move the y to the LHS:
$y^{-n}\frac{ dy }{ dx }+P(x)y^{1-n}=Q(x)$ $y^{-n}\frac{ dy }{ dx }+P(x)y^{1-n}=Q(x)$
notice that $y(x)=0$ is no longer a solution! It was lost due to dividing by zero. So from here on out we will have to remember to add it back in our final answers. notice that $y(x)=0$ is no longer a solution! It was lost due to dividing by zero. So from here on out we will have to remember to add it back in our final answers.
let $y^{1-n}=u$ let $y^{1-n}=u$
Differentiating this with respect to x gives us: Differentiating this with respect to $x$ gives us:
$(1-n)y^{-n}\frac{ dy }{ dx }=\frac{du}{dx}$ $(1-n)y^{-n}\frac{ dy }{ dx }=\frac{du}{dx}$
$y^{-n}\frac{ dy }{ dx }=\frac{ du }{ dx }{\frac{1}{1-n}}$ $y^{-n}\frac{ dy }{ dx }=\frac{ du }{ dx }{\frac{1}{1-n}}$
substituting in we get: substituting in we get:
$y^{-n}\frac{ dy }{ dx }+P(x)u=Q(x)=\frac{ du }{ dx }{\frac{1}{1-n}+P(x)u}$ $y^{-n}\frac{ dy }{ dx }+P(x)u=Q(x)=\frac{ du }{ dx }{\frac{1}{1-n}+P(x)u}$
and we get a linear equation again: (Handy formula if you wanna solve Bernoulli equations quick. Just remember that once you find $u(x)$, substitute it back for $y(x)^{1-n}=u(x)$ to get your solution for y.) And that is a linear equation again, which can be solved with prior tools.
Here's a handy formula if you wanna solve Bernoulli equations quick:
$$\frac{1}{1-n}\frac{ du }{ dx }+P(x)u=Q(x)\quad \Box$$ $$\frac{1}{1-n}\frac{ du }{ dx }+P(x)u=Q(x)\quad \Box$$
Just remember that once you find $u(x)$, substitute it back for $y(x)^{1-n}=u(x)$ to get your solution for y, and don't forget to add $y(x)=0$ with your final answer!
>Remember when I said that when n=1 the equation becomes a separable equation?: >Remember when I said that when n=1 the equation becomes a separable equation?:
>$y^{-n}\frac{ dy }{ dx }+P(x)y^{1-n}=Q(x)$ >$y^{-n}\frac{ dy }{ dx }+P(x)y^{1-n}=Q(x)$
>let $n=1$ >let $n=1$
>$y^{-1}\frac{ dy }{ dx }+P(x)=Q(x)$ >$y^{-1}\frac{ dy }{ dx }+P(x)=Q(x)$
>$y^{-1}dy=dx(Q(x)-P(x))$ <-This is indeed a separable equation #de_s_type1 >$y^{-1}dy=dx(Q(x)-P(x))$ <-This is indeed a separable equation #de_separable
--- ---
# Examples of Bernoulli's equation: # Examples of Bernoulli's equation:
#ex #de_b_type1 Find the general solution to: #ex #de_bernoulli Find the general solution to:
$y'+y=(xy)^2$ $y'+y=(xy)^2$
Looks like a Bernoulli equation because when we distribute the $^2$ we get $x^2y^2$ on the RHS. This also tells us that n=2 Looks like a Bernoulli equation because when we distribute the $^2$ we get $x^2y^2$ on the RHS. This also tells us that n=2
$y'+y=x^2y^2$ $y'+y=x^2y^2$
$y'y^{-2}+y^{-1}=x^2$ $y'y^{-2}+y^{-1}=x^2$
>Note that we lost the y(x)=0 solution here, we will have to add it back in the end. >Note that we lost the $y(x)=0$ solution here, we will have to add it back in the end.
let $u=y^{1-n}=y^{-1}$ let $u=y^{1-n}=y^{-1}$
Differentiating wrt. $x$ we get: $\frac{du}{dx}=-y^{-2}{\frac{dy}{dx}}$ Differentiating wrt. $x$ we get: $\frac{du}{dx}=-y^{-2}{\frac{dy}{dx}}$

View File

@ -6,7 +6,7 @@ $dF=\frac{ \partial F }{ \partial x }dx+\frac{ \partial F }{ \partial y }dy=0$ s
so $F(x,y)=C$ so $F(x,y)=C$
the solution to these exact equations is given by $F()$ but how do we recover $F$ from it's partial derivatives? the solution to these exact equations is given by $F()$ but how do we recover $F$ from it's partial derivatives?
Equation of the form: $$M(x,y)dx+N(x,y)dy=0$$ Equation of the form: $$M(x,y)dx+N(x,y)dy=0$$
>I'm calling this #de_e_type1 >I'm calling this #de_exact
is called exact if $M(x,y)=\frac{ \partial F }{ \partial x }$ and $N(x,y)=\frac{ \partial F }{ \partial y }$ for some function $F(x,y)$ is called exact if $M(x,y)=\frac{ \partial F }{ \partial x }$ and $N(x,y)=\frac{ \partial F }{ \partial y }$ for some function $F(x,y)$
then differentiating we get: then differentiating we get:
@ -31,7 +31,7 @@ $F(x,y)=\int M(x,y) \, dx+g(y)$ where g is any function of y. The constant of in
now 2nd condition: $N=\frac{ \partial F }{ \partial y }=\frac{ \partial }{ \partial y }\int M(x,y) \, dx+g'(y)=N(x,y)$ now 2nd condition: $N=\frac{ \partial F }{ \partial y }=\frac{ \partial }{ \partial y }\int M(x,y) \, dx+g'(y)=N(x,y)$
to reiterate, first test if equation is exact, then take m or n and integrate with x or y respectively then differentiate with respect to y or x respectively. to reiterate, first test if equation is exact, then take m or n and integrate with x or y respectively then differentiate with respect to y or x respectively.
#ex #de_e_type1 #ex #de_exact
$$\underbrace{( 2xy+3 )}_{ M }dx+\underbrace{ (x^2-1) }_{N}dy=0$$ $$\underbrace{( 2xy+3 )}_{ M }dx+\underbrace{ (x^2-1) }_{N}dy=0$$
$\frac{ \partial M }{ \partial y }=2x=\frac{ \partial N }{ \partial x }=2x$ so its exact! $\frac{ \partial M }{ \partial y }=2x=\frac{ \partial N }{ \partial x }=2x$ so its exact!
$\frac{ \partial F }{ \partial y }=N(x,y)=x^2-1$ $\frac{ \partial F }{ \partial y }=N(x,y)=x^2-1$

View File

@ -83,7 +83,7 @@ $\phi \approx 0.9273\dots$
$$y(t)=\frac{5}{4}e^{-3t}\sin(4t+\phi)$$ $$y(t)=\frac{5}{4}e^{-3t}\sin(4t+\phi)$$
Important take away: We computed $\phi$ and $A$ in this example. We found a way to know the envelope of the amplitude of the oscillating system and it's phase shift. Important take away: We computed $\phi$ and $A$ in this example. We found a way to know the envelope of the amplitude of the oscillating system and it's phase shift.
"I know engineers love calculators, I know mathematicians hate calculators, and that's probably the only difference between mathematicians and engineers." -Prof (referring to calculating arctan(4/3) on an exam) <i>"I know engineers love calculators, I know mathematicians hate calculators, and that's probably the only difference between mathematicians and engineers."</i> -Prof (referring to a student question on calculating arctan(4/3) on an exam. Btw the answer is no, you wouldn't need to evaluate that on an exam.)
3.) b=10 3.) b=10
$r_{1,2}=-\frac{10}{2}\pm \frac{\sqrt{ 10^2-4*25 }}{2}=-5$ (repeated root, critically damped) $r_{1,2}=-\frac{10}{2}\pm \frac{\sqrt{ 10^2-4*25 }}{2}=-5$ (repeated root, critically damped)
$y(t)=(c_{1}+c_{2}t)e^{-5t}$ $y(t)=(c_{1}+c_{2}t)e^{-5t}$

View File

@ -2,7 +2,7 @@
#start of lecture 4 #start of lecture 4
## Linear coefficients equations ## Linear coefficients equations
$$(a_{1}x+b_{1}y+c_{1})dx+(a_{2}x+b_{2}y+c_{2})dy=0 \qquad a_{1},b_{1},c_{1},a_{2},b_{2},c_{2}\in \mathbb{R}$$ $$(a_{1}x+b_{1}y+c_{1})dx+(a_{2}x+b_{2}y+c_{2})dy=0 \qquad a_{1},b_{1},c_{1},a_{2},b_{2},c_{2}\in \mathbb{R}$$
> I'm calling this #de_LC_type1 > I'm calling this #de_LC
imagine $c_{1},c_{2}=0$ It becomes a homogenous equation! #de_h_type2 imagine $c_{1},c_{2}=0$ It becomes a homogenous equation! #de_h_type2
@ -19,7 +19,7 @@ if $\det\begin{pmatrix}a_{1} & b_{1} \\a_{2} & b_{2}\end{pmatrix}\ne0$ the syste
if $\det\begin{pmatrix}a_{1} & b_{1} \\a_{2} & b_{2}\end{pmatrix}=0 \Rightarrow$ the system is unsolvable but we get an equation of type $\frac{ dy }{ dx }=G(ax+by)$ (also homogenous) if $\det\begin{pmatrix}a_{1} & b_{1} \\a_{2} & b_{2}\end{pmatrix}=0 \Rightarrow$ the system is unsolvable but we get an equation of type $\frac{ dy }{ dx }=G(ax+by)$ (also homogenous)
### Example ### Example
#ex #de_LC_type1 #ex #de_LC
$$(-3x+y+6)dx+(x+y+2)dy=0$$ $$(-3x+y+6)dx+(x+y+2)dy=0$$
let $x=u+k$ let $x=u+k$
$y=v+l$ $y=v+l$

View File

@ -3,7 +3,7 @@
# Linear equation: # Linear equation:
$$a(x)\frac{ dy }{ dx }+b(x)y=f(x)$$ $$a(x)\frac{ dy }{ dx }+b(x)y=f(x)$$
>I'm calling this #de_L_type1 >I'm calling this #de_linear_intro
if we assume $b(x)=a'(x)$ it kinda starts to look like a product rule if we assume $b(x)=a'(x)$ it kinda starts to look like a product rule
$a(x)y'+a'(x)y=f(x)=(ay)'$ $a(x)y'+a'(x)y=f(x)=(ay)'$
@ -11,7 +11,7 @@ $ay=\int f(x) \, dx$ <-yay! We can find the solutions to y.
we can rewrite the linear equation in what's called standard form: we can rewrite the linear equation in what's called standard form:
$$\frac{ dy }{ dx }+P(x)y=Q(x)$$ $$\frac{ dy }{ dx }+P(x)y=Q(x)$$
>I'm calling this #de_L_type2 ) >I'm calling this #de_linear )
we will define a function $\mu(x)$ called the integration factor, also expressed as $I(x)$ we will define a function $\mu(x)$ called the integration factor, also expressed as $I(x)$
Multiply both sides by $\mu(x)$ Multiply both sides by $\mu(x)$
@ -29,10 +29,10 @@ finally we get that $\mu(x)=I(x)=e^{\int P(x) \, dx}\quad \Box$ #remember
--- ---
#end of lecture 2 #start of lecture 3 #end of lecture 2 #start of lecture 3
# Examples of linear equations: # Examples of linear equations:
#ex #de_L_type2 Find the general solution to the equation: #ex #de_linear Find the general solution to the equation:
## $$(1+\sin(x))y'+2\cos(x)y=\tan(x)$$ ## $$(1+\sin(x))y'+2\cos(x)y=\tan(x)$$
let $a(x)=1+sin(x)\qquad b(x)=2\cos(x)$ let $a(x)=1+sin(x)\qquad b(x)=2\cos(x)$
we can see that $b(x)\ne a'(x)$ :( so we cant use #de_L_type1 we can see that $b(x)\ne a'(x)$ :( so we cant use #de_linear_intro
let's rearrange it into standard form: let's rearrange it into standard form:
$y'+\frac{{2\cos(x)}}{1+\sin(x)}=\frac{\tan(x)}{1+\sin(x)}$ $y'+\frac{{2\cos(x)}}{1+\sin(x)}=\frac{\tan(x)}{1+\sin(x)}$
$P(x):=\frac{2\cos(x)}{1+\sin(x)} \qquad Q(x)=\frac{\tan(x)}{1+\sin(x)}$ $P(x):=\frac{2\cos(x)}{1+\sin(x)} \qquad Q(x)=\frac{\tan(x)}{1+\sin(x)}$
@ -58,7 +58,7 @@ Albeit a bit ugly, we have found the general solution to the DE:
$$y=\frac{1}{(1+\sin(x))^2}(\ln\mid sec(x)\mid+\ln\mid sec(x)+\tan(x)\mid-\sin(x)+C)$$ $$y=\frac{1}{(1+\sin(x))^2}(\ln\mid sec(x)\mid+\ln\mid sec(x)+\tan(x)\mid-\sin(x)+C)$$
--- ---
#ex #IVP #de_L_type2 #ex #IVP #de_linear
## $$y'+\tan(x)y=\cos^2(x) \qquad y\left( \frac{\pi}{4} \right)=\frac{1}{2}$$ ## $$y'+\tan(x)y=\cos^2(x) \qquad y\left( \frac{\pi}{4} \right)=\frac{1}{2}$$
Looks like a linear equation with an initial value. Looks like a linear equation with an initial value.
$P(x)=\tan(x) \qquad Q(x)=\cos^2(x) \qquad I(x)=e^{\int \tan(x) \, dx}$ $P(x)=\tan(x) \qquad Q(x)=\cos^2(x) \qquad I(x)=e^{\int \tan(x) \, dx}$

View File

@ -13,14 +13,14 @@ $v\cancelto{ 0 }{ (y_{1}''+p(x)y_{1}'+q(x)y_{1}) }+v''y_{1}+(2y_{1}'+p(x)y_{1})v
$y_{1}v''+(2y_{1}'+p(x)y_{1})=f(x)$ $y_{1}v''+(2y_{1}'+p(x)y_{1})=f(x)$
$v''+\left( \frac{2y_{1}'}{y_{1}}+p(x) \right)v'=\frac{f(x)}{y_{1}}$ $v''+\left( \frac{2y_{1}'}{y_{1}}+p(x) \right)v'=\frac{f(x)}{y_{1}}$
substitute $v'=u$ substitute $v'=u$
$u'+\left( \frac{2y_{1}'}{y_{1}}+p(x) \right)u=\frac{f(x)}{y_{1}}$<- This is now a linear first order equation #de_L_type2 $u'+\left( \frac{2y_{1}'}{y_{1}}+p(x) \right)u=\frac{f(x)}{y_{1}}$<- This is now a linear first order equation #de_linear
This can be solved with prior tools now, We compute the integrating factor $\mu$ This can be solved with prior tools now, We compute the integrating factor $\mu$
$\mu=e^{\int(2y_{1}'/y_{1}+p)dx}=e^{\ln(y_{1}^2)}e^{\int p(x) \, dx}=y_{1}^2\cdot e^{\int p(x) \, dx}$ $\mu=e^{\int(2y_{1}'/y_{1}+p)dx}=e^{\ln(y_{1}^2)}e^{\int p(x) \, dx}=y_{1}^2\cdot e^{\int p(x) \, dx}$
From there, continue on as you would with any linear first order equation. From there, continue on as you would with any linear first order equation.
Isn't this nice? some kind of magic. We made some guesses and we arrived somewhere. Isn't this nice? some kind of magic. We made some guesses and we arrived somewhere.
## What you need to remember: ## What you need to remember:
#remember #remember
I know memorizing formulas robs the richness of mathematics, but that is just the nature of test taking imo. If you want to minimize the amount of work to the lowest possible level, this would be the fastest algorithm, it's a little heavy on memorization: I know memorizing formulas robs the richness of mathematics, but that is just the nature of test taking imo. If you want to minimize the amount of work to the lowest possible level, this would be the fastest algorithm (that I know of), it's a little heavy on memorization:
1) $y''+p(x)y'+q(x)y=f(x)$ 1) $y''+p(x)y'+q(x)y=f(x)$
2) $u'+\left( \frac{2y_{1}'}{y_{1}}+p(x) \right)u=\frac{f(x)}{y_{1}}$ <- Notice, if the coefficient for the $u$ term is $0$, you can treat the equation as a separable equation to minimize computation (integrate both sides to get u, then move on to step 5). Otherwise, move on to step 3. 2) $u'+\left( \frac{2y_{1}'}{y_{1}}+p(x) \right)u=\frac{f(x)}{y_{1}}$ <- Notice, if the coefficient for the $u$ term is $0$, you can treat the equation as a separable equation to minimize computation (integrate both sides to get u, then move on to step 5). Otherwise, move on to step 3.
3) $\mu(x)=y_{1}^2\cdot e^{\int p(x) \, dx}$ <- where $y_{1}$ is one of your homogenous solutions. 3) $\mu(x)=y_{1}^2\cdot e^{\int p(x) \, dx}$ <- where $y_{1}$ is one of your homogenous solutions.
@ -43,6 +43,7 @@ $u'+\left( \frac{2y_{1}'}{y_{1}}+4x \right)u=\frac{8{e^{-x^2}e^{-2x}}}{e^{-x^2}}
$u'+\underbrace{ \left( \frac{2{e^{-x^2}(-2x)}}{e^{-x^2}}+4x \right) }_{ =0 }u=8e^{-2x}$ $u'+\underbrace{ \left( \frac{2{e^{-x^2}(-2x)}}{e^{-x^2}}+4x \right) }_{ =0 }u=8e^{-2x}$
$u'=8e^{-2x}$ $u'=8e^{-2x}$
> Lucky us! This is just a separable equation. No need to treat it like a linear equation. > Lucky us! This is just a separable equation. No need to treat it like a linear equation.
integrating both sides: integrating both sides:
$u=-4e^{-2x}+c_{1}$ $u=-4e^{-2x}+c_{1}$
$v'=u=-4e^{-2x}+c_{1}$ $v'=u=-4e^{-2x}+c_{1}$

View File

@ -4,14 +4,15 @@ most of these "models" in EE are based on these DE. You'll see how important DE
Second order equations arise from very simple problems many engineers face, for instance a pendulum can be described by a second order equation. Second order equations arise from very simple problems many engineers face, for instance a pendulum can be described by a second order equation.
#second_order #second_order
### $$a_{2}(t)y''+a_{1}(t)y'+a_{0}(t)y=f(t)$$ ### $$a_{2}(t)y''+a_{1}(t)y'+a_{0}(t)y=f(t)$$
To motivate our interest: #fix To motivate our interest:
![draw](drawings/Drawing-2023-09-15-13.32.48.excalidraw.png) ![draw](drawings/Drawing-2023-09-15-13.32.48.excalidraw.png)
$ma=my''=-by'-ky$ $F=ma=my''$
$my''=-by'-ky$
Look how a second order equation describes the motion of a mass-spring system! Look how a second order equation describes the motion of a mass-spring system!
> Circuits that contains resistors, capacitors and inductors also behaves with this equation as well if you ignore the external magnetic fields around the circuit. > Circuits that contains resistors, capacitors and inductors also behaves with this equation as well if you ignore the external magnetic fields around the circuit.
The equation $my''+by'+ky=0$ is a homogenous second order equation. (in this case, it's full name is homogenous second order linear equation with constant coefficients.) The equation $my''+by'+ky=0$ is a homogenous second order equation, because the RHS is 0. (in this case, it's full name is homogenous second order linear equation with constant coefficients.)
>Similar pattern with the electrical circuit analogy. This DE ignores external forces on the mass-spring system, it only considers the friction and the spring. If we push the mass then there would be an external force. >Similar pattern with the electrical circuit analogy. This DE ignores external forces on the mass-spring system, it only considers the friction and the spring. If we push the mass then there would be an external force and the RHS would be non zero, and the equation would be non homogenous.
It's called second order because we have second derivative in the equation. It's called second order because we have second derivative in the equation.

View File

@ -19,9 +19,9 @@ so, the general solution is $$v(t)=\frac{1}{k}(mg-Ae^{\frac{-kt}{m}})$$
## Separable DE: ## Separable DE:
$$\frac{dy}{dx}=f(y)g(x) \rightarrow \frac{dy}{f(y)}=g(x)dx\quad where\quad f(y)\ne0$$ $$\frac{dy}{dx}=f(y)g(x) \rightarrow \frac{dy}{f(y)}=g(x)dx\quad where\quad f(y)\ne0$$
>Since these are so similar, I'm calling these two #de_s_type1 Note that $\frac{1}{f(y)}$ is still an arbitrary function of y. So you could also say: $k(y)dy=g(x)dx$ is a separable equation. >Since these are so similar, I'm calling these two #de_separable Note that $\frac{1}{f(y)}$ is still an arbitrary function of y. So you could also say: $k(y)dy=g(x)dx$ is a separable equation.
#ex #de_s_type1 #ex #de_separable
$$\frac{dy}{dt}=\frac{1-t^2}{y^2}$$ $$\frac{dy}{dt}=\frac{1-t^2}{y^2}$$
$y^2dy=dt(1-t^2)$ $y^2dy=dt(1-t^2)$
integrating both sides yields: integrating both sides yields:
@ -32,7 +32,7 @@ $$y=(3t-t^3+C)^\frac{1}{3}$$
## Initial value problem (IVP): ## Initial value problem (IVP):
A Differential equation with provided initial conditions. A Differential equation with provided initial conditions.
#ex #IVP #de_s_type1 #ex #IVP #de_separable
$$\frac{dy}{dx}=2x\cos^2(y), \quad y(0)=\frac{\pi}{4}$$ $$\frac{dy}{dx}=2x\cos^2(y), \quad y(0)=\frac{\pi}{4}$$
$\frac{dy}{\cos^2(y)}=2xdx$ $\frac{dy}{\cos^2(y)}=2xdx$
integrate both sides yields: integrate both sides yields:

View File

@ -122,7 +122,7 @@ this is a separable equation.
We can treat the function $T$ as a variable: We can treat the function $T$ as a variable:
$\frac{dT}{dt} \frac{1}{T}=-\left( \frac{n\pi}{L} \right)^2D$ $\frac{dT}{dt} \frac{1}{T}=-\left( \frac{n\pi}{L} \right)^2D$
$\int{dT} \frac{1}{T}=\int-\left( \frac{n\pi}{L} \right)^2Ddt$ $\int{dT} \frac{1}{T}=\int-\left( \frac{n\pi}{L} \right)^2Ddt$
$\ln(T)=-\left( \frac{n\pi}{L} \right)Dt+c_{n}$ $\ln\mid T \mid=-\left( \frac{n\pi}{L} \right)^2Dt+c_{n}$
$T_{n}(t)=c_{n}e^{-(\frac{n\pi}{L})^2Dt}$ $T_{n}(t)=c_{n}e^{-(\frac{n\pi}{L})^2Dt}$
>Yes this looks illegal, but it works, you could also integrate more rigorously if you did a u-sub: $u=T(t) \quad \frac{du}{dt}=T'(t)$) >Yes this looks illegal, but it works, you could also integrate more rigorously if you did a u-sub: $u=T(t) \quad \frac{du}{dt}=T'(t)$)
</br> </br>

View File

@ -95,7 +95,7 @@ $$u(0,t)=u(\pi,t)=0 \qquad t>0$$
$$u(x,0)=\sin(x) \qquad 0\leq x\leq \pi$$ $$u(x,0)=\sin(x) \qquad 0\leq x\leq \pi$$
$$\frac{ \partial u }{ \partial t }(x,0)=5\sin(2x)-3\sin(5x)\qquad 0\leq x\leq \pi$$ $$\frac{ \partial u }{ \partial t }(x,0)=5\sin(2x)-3\sin(5x)\qquad 0\leq x\leq \pi$$
when $tx$ wasn't there in last problem we had the solution: when $tx$ wasn't there in last problem we had the solution:
$u(t,x)=\sum_{n=1}^\infty \underbrace{ (a_{n}\cos(nt)+b_{n}\sin(nt)) }_{ u_{n}(t) }\sin(nt)$ notice $L=\pi$ $u(t,x)=\sum_{n=1}^\infty \underbrace{ (a_{n}\cos(nt)+b_{n}\sin(nt)) }_{ u_{n}(t) }\sin(nx)$ notice $L=\pi$
since $u(0,t)=u(\pi,t)=0$ we can expect a solution of the form: since $u(0,t)=u(\pi,t)=0$ we can expect a solution of the form:
$u(x,t)=\sum_{n=1}^\infty u_{n}(t)\sin\left( \frac{n\pi x}{\pi} \right)$ $u(x,t)=\sum_{n=1}^\infty u_{n}(t)\sin\left( \frac{n\pi x}{\pi} \right)$
If any of the boundary conditions are non zero, then we have to split(?) into X and T. (needs verification) If any of the boundary conditions are non zero, then we have to split(?) into X and T. (needs verification)
@ -142,9 +142,10 @@ Here's a plot showing the behavior of the string (graphed up to 40 harmonics):
Finished the solution. Man I got teary eyed from this lecture. Finished the solution. Man I got teary eyed from this lecture.
#end of lec 35 #end of lec 35
#start of lec 36 #start of lec 36
# Last lecture
What do you guys wanna do? Questions or summary of the course? What do you guys wanna do? Questions or summary of the course?
Okay we do summary. Okay we do summary.
# Summary of second half of Math 201 ## Summary of second half of Math 201
(available on eclass) (available on eclass)
Laplace transforms: Laplace transforms:
Definition of laplace, Definition of laplace,

View File

@ -2,11 +2,44 @@
These are notes for the [University of Alberta MATH 201 - Differential Equations](https://apps.ualberta.ca/catalogue/course/math/201) course. These are notes for the [University of Alberta MATH 201 - Differential Equations](https://apps.ualberta.ca/catalogue/course/math/201) course.
I have written these notes for myself, I thought it would be cool to share them. These notes may be inaccurate, incomplete, or incoherent. No warranty is expressed or implied. Reader assumes all risk and liabilities. I have written these notes for myself, I thought it would be cool to share them. These notes may be inaccurate, incomplete, or incoherent. No warranty is expressed or implied. Reader assumes all risk and liabilities.
</br> </br>
Good luck on the final! <3 [Separable equations (lec 1)](separable-equations-lec-1.html)
If we do bad on the exam, Petar will come after us with the Dirac delta 🤜💥 [Homogenous equations (lec 2)](homogenous-equations-lec-2.html)
[Linear equations (lec 2-3)](linear-equations-lec-2-3.html)
[Bernoulli equations (lec 3)](bernoulli-equations-lec-3.html)
[Linear coefficient equations (lec 4)](linear-coefficient-equations-lec-4.html)
[Exact equations (lec 4-5)](exact-equations-lec-4-5.html)
[Second order homogenous linear equations (lec 5-7)](second-order-homogenous-linear-equations-lec-5-7.html)
[Method of undetermined coefficients (lec 8-9)](method-of-undetermined-coefficients-lec-8-9.html)
[Variation of parameters (lec 9-10)](variation-of-parameters-lec-9-10.html)
[Cauchy-Euler equations (lec 10-11)](cauchy-euler-equations-lec-10-11.html)
[Reduction of order (lec 11)](reduction-of-order-lec-11.html)
[Free vibrations (lec 11-12)](free-vibrations-lec-11-12.html)
[Resonance & AM (lec 13-14)](resonance-am-lec-13-14.html)
[Laplace transform (lec 14-16)](laplace-transform-lec-14-16.html)
[Solving IVP's using Laplace transform (lec 17-18)](solving-ivps-using-laplace-transform-lec-17-18.html)
[(Heaviside) Unit step function (lec 18)](heaviside-unit-step-function-lec-18.html)
[Periodic functions (lec 19)](periodic-functions-lec-19.html)
[Convolution (lec 19-20)](convolution-lec-19-20.html)
[Dirak δ-function (lec 21)](dirak-δ-function-lec-21.html)
[Systems of linear equations (lec 21-22)](systems-of-linear-equations-lec-21-22.html)
[Power series (lec 22-25)](power-series-lec-22-25.html)
[Separation of variables & Eigen value problems (lec 26-28)](separation-of-variables-eigen-value-problems-lec-26-28.html)
[Fourier series (lec 28-29)](fourier-series-lec-28-29.html)
[Heat equation (lec 30-33)](heat-equation-lec-30-33.html)
[Wave equation (lec 33-36)](wave-equation-lec-33-36.html)
</br> </br>
</br> [How to solve any DE, a flow chart](Solve-any-DE.png) (Last updated Oct 1st 2023. Needs revision, but it gives a nice overview.)
[How to solve any DE, a flow chart](Solve-any-DE.png) (Last updated Oct 1st, needs revision. But it gives a nice overview.)
[Big LT table (.png)](drawings/bigLTtable.png) [Big LT table (.png)](drawings/bigLTtable.png)
[Small LT table (.png)](drawings/smallLTtable.png) [Small LT table (.png)](drawings/smallLTtable.png)
</br>
# Additional recommended study material
For the midterm exam, I highly recommend watching this video by The Math Sorcerer: [youtube.com/watch?v=kIZpbeE_yTc](https://youtube.com/watch?v=kIZpbeE_yTc)
From my experience, studying off this video was by far the best use of my time. Try each question yourself and follow his solution to check.
</br>
For the final exam, I unfortunately couldn't find good study videos. I recommend studying PDE's hard, solidify your understanding of heat eq, driven heat eq, heat eq with non-zero end points, wave eq, and driven wave eq. Afterwards, I recommend studying power series since it's the next biggest scary monster. Finally, go over the rest of the past topics to fill your understanding and memory if you have the time. I'm thinking I should record a final exam review guide, hmmm. I'll update this text if I ever make one.
</br>
The recommended course textbook when I took the class was: <i>Fundamentals of Differential Equations, R. Kent Nagle, Edward B. Saff and Arthur D. Snider, 9th Edition</i> Which is a good textbook imo, although I didn't use it often.
</br>
Personally, I studied the material by attending the lectures and then reviewing/revising these typed notes at home, often relying on my prof's notes on eclass in case I copied off the whiteboard wrong/couldn't keep up. (eclass is the name of my university's online class management system.)
Of course there may still be mistakes riddled throughout so as of Jan 5th 2024, <b>I'm offering 1$ CAD in bounties for every mistake reported to my email/git repo, at least until supplies last.</b> General editing and formatting changes are also gladly welcomed through the git repository below or by email.
</br> </br>

View File

@ -554,7 +554,7 @@ HOgDwZkHZB1IC8GNBbwcGAfBIwRUE/BNQf8GNBgISzTAhpomCG9BkIc6DQhwwXCF
jBiIVMEzBCAH8ELBiIJiGtA2IRsGmh2wQSF7B/bCSFm2CAMcDI+WII8icuYQC+CV jBiIVMEzBCAH8ELBiIJiGtA2IRsGmh2wQSF7B/bCSFm2CAMcDI+WII8icuYQC+CV
AYoH/4QKS7lSKrudIgyFgBaAKmCQBVzrmwqgswKtA/egog87s+51ocBGArLPcDKg ACoH/4QKS7lSKrudIgyFgBaAKmCQBVzrmwqgswKtA/egog87s+51ocBGArLPcDKg
wLrywfAzAEKxSibwKyCssIoIMDYAKoqyxsASYIg7cKpAegC4BCLvgFIuwHjaIYu5 wLrywfAzAEKxSibwKyCssIoIMDYAKoqyxsASYIg7cKpAegC4BCLvgFIuwHjaIYu5
@ -2670,198 +2670,26 @@ o0m4QCaXKR2KBFB/j5mEtElvrieDpFEQcP0+JAnmhjuxpTf9o/gKtE2wpS46tEZQ
ZrROj7xwfOhU9zB0QKumaAGgNlma6F4AeRRBAGUUZ1RUZFp4TGR60ya1pY6PIEp5 ZrROj7xwfOhU9zB0QKumaAGgNlma6F4AeRRBAGUUZ1RUZFp4TGR60ya1pY6PIEp5
nTh/j6jUa/RGPItyi5ynX7IPotBxiFMoStBVFTAQdMkXMp15me8k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ACbKR8AQQQhBPgAYQRFALsp+yleBD4EfgTXHCUpMynjKWJSwAQsh
FSEhSm0hAWkZynzKXGw5IQDKTV2hYC4AP6qbymZANzRDyFfKTh0IQDEKHGwiID5Z
GqwIs6OgIC0jLQSaKEoL9hAYMlcUKmIgECAxsmqKJTAPGD0ZHqOpbAlKUYA4KI5K
fSIBAConoJsj0DIkPZcc2K3SLzk/yn6AKspKByKZLUpgYAkAJcplQCOOCa6JACsu
JAo4xyuDG6AdoA8fvypslw+gMC4CADKABTQwgTNhhKpqwCCqdSptyn9sJMpKIBwO
CsE8HqwlGYAwgDkSa0EqGG+BKyperh5ZsKpwYBMAHUEhKlM0NkA31zBADSwGclM0
NgARAAchGgAFqllAKsEBSm2qQqJSATCAFAAAYTpyc6p0LDgAOAo3/7BAIOAwABQs
CAAULBAAA===
``` ```
%% %%

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -26,87 +26,7 @@ input[type="submit"] {
Bear base styles Bear base styles
(Retrieved from official app, all credits belong to Bear Team) (Retrieved from official app, all credits belong to Bear Team)
*/ */
html, html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin: 0; margin: 0;
padding: 0; padding: 0;
border: 0; border: 0;
@ -117,48 +37,29 @@ video {
html { html {
line-height: 1; } line-height: 1; }
ol, ol, ul {
ul {
list-style: none; } list-style: none; }
table { table {
border-collapse: collapse; border-collapse: collapse;
border-spacing: 0; } border-spacing: 0; }
caption, caption, th, td {
th,
td {
text-align: left; text-align: left;
font-weight: normal; font-weight: normal;
vertical-align: middle; } vertical-align: middle; }
q, q, blockquote {
blockquote {
quotes: none; } quotes: none; }
q:before, q:before, q:after, blockquote:before, blockquote:after {
q:after,
blockquote:before,
blockquote:after {
content: ""; content: "";
content: none; } content: none; }
a img { a img {
border: none; } border: none; }
article, article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary {
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
menu,
nav,
section,
summary {
display: block; } display: block; }
* { * {
@ -179,8 +80,7 @@ body {
background: var(--background); background: var(--background);
color: var(--text-base-color); color: var(--text-base-color);
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
font-family: "AvenirNext-Regular"; font-family: "AvenirNext-Regular"; }
position: relative; }
a { a {
color: var(--link-text-color); color: var(--link-text-color);
@ -217,14 +117,10 @@ hr {
background-color: #dedede; background-color: #dedede;
margin: -1px auto 1.57143em auto; } margin: -1px auto 1.57143em auto; }
ul, ul, ol {
ol {
margin-bottom: .31429em; } margin-bottom: .31429em; }
ul ul, ul ul, ul ol, ol ul, ol ol {
ul ol,
ol ul,
ol ol {
margin-bottom: 0px; } margin-bottom: 0px; }
ol { ol {
@ -239,13 +135,11 @@ ol li:before {
min-width: 1em; min-width: 1em;
margin-right: 0.5em; } margin-right: 0.5em; }
b, b, strong {
strong {
font-family: "Menlo-Regular"; font-family: "Menlo-Regular";
font-weight: bold; } font-weight: bold; }
i, i, em {
em {
font-family: "Menlo-Regular"; font-family: "Menlo-Regular";
font-style: italic; } font-style: italic; }
@ -257,48 +151,22 @@ code {
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; } white-space: nowrap; }
.sf_code_string, .sf_code_string, .sf_code_selector, .sf_code_attr-name, .sf_code_char, .sf_code_builtin, .sf_code_inserted {
.sf_code_selector,
.sf_code_attr-name,
.sf_code_char,
.sf_code_builtin,
.sf_code_inserted {
color: #D33905; } color: #D33905; }
.sf_code_comment, .sf_code_comment, .sf_code_prolog, .sf_code_doctype, .sf_code_cdata {
.sf_code_prolog,
.sf_code_doctype,
.sf_code_cdata {
color: #838383; } color: #838383; }
.sf_code_number, .sf_code_number, .sf_code_boolean {
.sf_code_boolean {
color: #0E73A2; } color: #0E73A2; }
.sf_code_keyword, .sf_code_keyword, .sf_code_atrule, .sf_code_rule, .sf_code_attr-value, .sf_code_function, .sf_code_class-name, .sf_code_class, .sf_code_regex, .sf_code_important, .sf_code_variable, .sf_code_interpolation {
.sf_code_atrule,
.sf_code_rule,
.sf_code_attr-value,
.sf_code_function,
.sf_code_class-name,
.sf_code_class,
.sf_code_regex,
.sf_code_important,
.sf_code_variable,
.sf_code_interpolation {
color: #0E73A2; } color: #0E73A2; }
.sf_code_property, .sf_code_property, .sf_code_tag, .sf_code_constant, .sf_code_symbol, .sf_code_deleted {
.sf_code_tag,
.sf_code_constant,
.sf_code_symbol,
.sf_code_deleted {
color: #1B00CE; } color: #1B00CE; }
.sf_code_macro, .sf_code_macro, .sf_code_entity, .sf_code_operator, .sf_code_url {
.sf_code_entity,
.sf_code_operator,
.sf_code_url {
color: #920448; } color: #920448; }
.note-wrapper { .note-wrapper {
@ -499,12 +367,7 @@ svg + ol {
* + h4 { * + h4 {
margin-top: 2.8em; } margin-top: 2.8em; }
h1, h1, h2, h3, h4, h5, h6 {
h2,
h3,
h4,
h5,
h6 {
position: relative; } position: relative; }
h1:before, h1:before,
@ -595,7 +458,3 @@ li img {
.turbolinks-progress-bar { .turbolinks-progress-bar {
visibility: hidden; } visibility: hidden; }
@media only screen and (max-width: 460px) {
main .note-wrapper {
padding: 1.57143em 1.1em; } }

View File

@ -1,3 +1,4 @@
input { input {
margin: 0; margin: 0;
padding: 0; padding: 0;
@ -5,113 +6,32 @@ input {
font: inherit; font: inherit;
color: inherit; color: inherit;
font-size: 100%; font-size: 100%;
vertical-align: baseline vertical-align: baseline
} }
*:focus { *:focus {
outline: none; outline: none;
} }
textarea, textarea,
input[type="search"], input[type="search"],
input[type="text"], input[type="text"],
input[type="button"], input[type="button"],
input[type="submit"] { input[type="submit"] {
-webkit-appearance: none; -webkit-appearance: none;
border-radius: 0; border-radius: 0;
} }
// @todo: class // @todo: class
::selection { ::selection {
background: var(--selected-text-background-color); background: var(--selected-text-background-color);
} }
/** /**
Bear base styles Bear base styles
(Retrieved from official app, all credits belong to Bear Team) (Retrieved from official app, all credits belong to Bear Team)
*/ */
html, html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin: 0; margin: 0;
padding: 0; padding: 0;
border: 0; border: 0;
@ -124,8 +44,7 @@ html {
line-height: 1 line-height: 1
} }
ol, ol, ul {
ul {
list-style: none list-style: none
} }
@ -134,23 +53,17 @@ table {
border-spacing: 0 border-spacing: 0
} }
caption, caption, th, td {
th,
td {
text-align: left; text-align: left;
font-weight: normal; font-weight: normal;
vertical-align: middle vertical-align: middle
} }
q, q, blockquote {
blockquote {
quotes: none quotes: none
} }
q:before, q:before, q:after, blockquote:before, blockquote:after {
q:after,
blockquote:before,
blockquote:after {
content: ""; content: "";
content: none content: none
} }
@ -158,20 +71,7 @@ blockquote:after {
a img { a img {
border: none border: none
} }
article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary {
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
menu,
nav,
section,
summary {
display: block display: block
} }
@ -197,8 +97,7 @@ body {
// @todo: not working // @todo: not working
color: var(--text-base-color); color: var(--text-base-color);
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
font-family: "AvenirNext-Regular"; font-family: "AvenirNext-Regular"
position: relative;
} }
a { a {
@ -242,15 +141,11 @@ hr {
margin: -1px auto 1.57143em auto margin: -1px auto 1.57143em auto
} }
ul, ul, ol {
ol {
margin-bottom: .31429em; margin-bottom: .31429em;
} }
ul ul, ul ul, ul ol, ol ul, ol ol {
ul ol,
ol ul,
ol ol {
margin-bottom: 0px margin-bottom: 0px
} }
@ -268,15 +163,13 @@ ol li:before {
margin-right: 0.5em margin-right: 0.5em
} }
b, b, strong {
strong {
//font-family: "AvenirNext-Bold"; //font-family: "AvenirNext-Bold";
font-family: "Menlo-Regular"; font-family: "Menlo-Regular";
font-weight: bold; font-weight: bold;
} }
i, i, em {
em {
//font-family: "AvenirNext-Italic"; //font-family: "AvenirNext-Italic";
font-family: "Menlo-Regular"; font-family: "Menlo-Regular";
font-style: italic; font-style: italic;
@ -292,53 +185,27 @@ code {
white-space: nowrap white-space: nowrap
} }
.sf_code_string, .sf_code_string, .sf_code_selector, .sf_code_attr-name, .sf_code_char, .sf_code_builtin, .sf_code_inserted {
.sf_code_selector,
.sf_code_attr-name,
.sf_code_char,
.sf_code_builtin,
.sf_code_inserted {
color: #D33905 color: #D33905
} }
.sf_code_comment, .sf_code_comment, .sf_code_prolog, .sf_code_doctype, .sf_code_cdata {
.sf_code_prolog,
.sf_code_doctype,
.sf_code_cdata {
color: #838383 color: #838383
} }
.sf_code_number, .sf_code_number, .sf_code_boolean {
.sf_code_boolean {
color: #0E73A2 color: #0E73A2
} }
.sf_code_keyword, .sf_code_keyword, .sf_code_atrule, .sf_code_rule, .sf_code_attr-value, .sf_code_function, .sf_code_class-name, .sf_code_class, .sf_code_regex, .sf_code_important, .sf_code_variable, .sf_code_interpolation {
.sf_code_atrule,
.sf_code_rule,
.sf_code_attr-value,
.sf_code_function,
.sf_code_class-name,
.sf_code_class,
.sf_code_regex,
.sf_code_important,
.sf_code_variable,
.sf_code_interpolation {
color: #0E73A2 color: #0E73A2
} }
.sf_code_property, .sf_code_property, .sf_code_tag, .sf_code_constant, .sf_code_symbol, .sf_code_deleted {
.sf_code_tag,
.sf_code_constant,
.sf_code_symbol,
.sf_code_deleted {
color: #1B00CE color: #1B00CE
} }
.sf_code_macro, .sf_code_macro, .sf_code_entity, .sf_code_operator, .sf_code_url {
.sf_code_entity,
.sf_code_operator,
.sf_code_url {
color: #920448 color: #920448
} }
@ -354,7 +221,7 @@ code {
u { u {
text-decoration: underline; text-decoration: underline;
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 50%, var(--accent-text-color) 50%); background-image: linear-gradient(to bottom, rgba(0,0,0,0) 50%,var(--accent-text-color) 50%);
background-repeat: repeat-x; background-repeat: repeat-x;
background-size: 2px 2px; background-size: 2px 2px;
background-position: 0 1.05em background-position: 0 1.05em
@ -472,7 +339,7 @@ blockquote {
.address a { .address a {
color: #545454; color: #545454;
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 50%, #0da35e 50%); background-image: linear-gradient(to bottom, rgba(0,0,0,0) 50%,#0da35e 50%);
background-repeat: repeat-x; background-repeat: repeat-x;
background-size: 2px 2px; background-size: 2px 2px;
background-position: 0 1.05em background-position: 0 1.05em
@ -489,7 +356,7 @@ blockquote {
display: inline-block; display: inline-block;
width: 1em; width: 1em;
height: 1em; height: 1em;
border: solid 1px rgba(0, 0, 0, 0.3); border: solid 1px rgba(0,0,0,0.3);
border-radius: 50%; border-radius: 50%;
margin-right: 0.1em; margin-right: 0.1em;
position: relative; position: relative;
@ -548,7 +415,7 @@ img {
// Hugo renders footnotes with <p> tags nested inside <li> // Hugo renders footnotes with <p> tags nested inside <li>
// This is need to prevent <p> breaking lines // This is need to prevent <p> breaking lines
li>p { li > p {
display: inline-block; display: inline-block;
margin-left: 16px; margin-left: 16px;
} }
@ -567,30 +434,25 @@ h4 {
margin-bottom: .47143em margin-bottom: .47143em
} }
*+p, * + p,
*+ul, * + ul,
*+ol, * + ol,
*+blockquote { * + blockquote {
/*margin-top: 1.6em;*/ /*margin-top: 1.6em;*/
} }
svg+ul, svg + ul,
svg+ol { svg + ol {
margin-top: 0; margin-top: 0;
} }
*+h2, * + h2,
*+h3, * + h3,
*+h4 { * + h4 {
margin-top: 2.8em; margin-top: 2.8em;
} }
h1, h1, h2, h3, h4, h5, h6 {
h2,
h3,
h4,
h5,
h6 {
position: relative; position: relative;
} }
@ -649,10 +511,9 @@ h6:before {
content: "#" content: "#"
} }
*+table { * + table {
margin-top: 12px; margin-top: 12px;
} }
table { table {
border-radius: 4px; border-radius: 4px;
border: 1px solid var(--separator-color); border: 1px solid var(--separator-color);
@ -708,11 +569,3 @@ li img {
.turbolinks-progress-bar { .turbolinks-progress-bar {
visibility: hidden; visibility: hidden;
} }
@media only screen and (max-width: 460px) {
// decrease padding of notes when screen width is < 460px
main .note-wrapper {
padding: 1.57143em 1.1em;
}
}

View File

@ -1,14 +1,9 @@
// On localhost the root url is /MATH201
// On sasserisop the root url is /sasserisop
const localhost = false;
const root = localhost ? "" : "/MATH201";
loadIndex() loadIndex()
// Highlight with jQuery // Highlight with jQuery
// from: https://stackoverflow.com/questions/41533785/how-to-highlight-search-text-in-html-with-the-help-of-js // from: https://stackoverflow.com/questions/41533785/how-to-highlight-search-text-in-html-with-the-help-of-js
// @todo: This is the only use of jQuery. Find a vanila JS way // @todo: This is the only use of jQuery. Find a vanila JS way
jQuery.fn.highlight = function (pat) { jQuery.fn.highlight = function(pat) {
function innerHighlight(node, pat) { function innerHighlight(node, pat) {
@ -20,16 +15,16 @@ jQuery.fn.highlight = function (pat) {
if (pos >= 0) { if (pos >= 0) {
var spannode = document.createElement('span'); var spannode = document.createElement('span');
spannode.className = 'highlighted'; spannode.className = 'highlighted';
var middlebit = node.splitText(pos); var middlebit = node.splitText(pos);
var endbit = middlebit.splitText(pat.length); var endbit = middlebit.splitText(pat.length);
var middleclone = middlebit.cloneNode(true); var middleclone = middlebit.cloneNode(true);
spannode.appendChild(middleclone); spannode.appendChild(middleclone);
middlebit.parentNode.replaceChild(spannode, middlebit); middlebit.parentNode.replaceChild(spannode, middlebit);
skip = 1; skip = 1;
} }
@ -46,15 +41,15 @@ jQuery.fn.highlight = function (pat) {
} }
return this.each(function () { return this.each(function() {
innerHighlight(this, pat.toUpperCase()); innerHighlight(this, pat.toUpperCase());
}); });
}; };
jQuery.fn.removeHighlight = function () { jQuery.fn.removeHighlight = function() {
function newNormalize(node) { function newNormalize(node) {
@ -76,7 +71,7 @@ jQuery.fn.removeHighlight = function () {
if (next == null || next.nodeType != 3) { continue; } if (next == null || next.nodeType != 3) { continue; }
var combined_text = child.nodeValue + next.nodeValue; var combined_text = child.nodeValue + next.nodeValue;
new_node = node.ownerDocument.createTextNode(combined_text); new_node = node.ownerDocument.createTextNode(combined_text);
node.insertBefore(new_node, child); node.insertBefore(new_node, child);
node.removeChild(child); node.removeChild(child);
@ -88,7 +83,7 @@ jQuery.fn.removeHighlight = function () {
} }
return this.find("span.highlighted").each(function () { return this.find("span.highlighted").each(function() {
var thisParent = this.parentNode; var thisParent = this.parentNode;
thisParent.replaceChild(this.firstChild, this); thisParent.replaceChild(this.firstChild, this);
@ -98,9 +93,9 @@ jQuery.fn.removeHighlight = function () {
}; };
$(function () { $(function() {
$('#search-input').bind('keyup change', function (ev) { $('#search-input').bind('keyup change', function(ev) {
// pull in the new value // pull in the new value
var searchTerm = $(this).val(); var searchTerm = $(this).val();
@ -109,109 +104,64 @@ $(function () {
$('body').removeHighlight(); $('body').removeHighlight();
// disable highlighting if empty // disable highlighting if empty
if (searchTerm) { if ( searchTerm ) {
// highlight the new term // highlight the new term
$('body').highlight(searchTerm); $('body').highlight( searchTerm );
} }
}); });
}); });
/// ///
var scrollTop = 0 var scrollTop = 0
document.addEventListener("turbolinks:before-render", function () { document.addEventListener("turbolinks:before-render", function() {
var search_index = document.getElementById("search-results"); var search_index = document.getElementById("search-results");
var y = search_index.scrollTop; var y = search_index.scrollTop;
scrollTop = y scrollTop = y
}) })
document.addEventListener("turbolinks:render", function () { document.addEventListener("turbolinks:render", function() {
var search_index = document.getElementById("search-results"); var search_index = document.getElementById("search-results");
search_index.scrollTop = scrollTop search_index.scrollTop = scrollTop
}) })
document.addEventListener("turbolinks:load", function () { document.addEventListener("turbolinks:load", function() {
setNoteWrapperState() setNoteWrapperState()
const current = window.location.href const current = window.location.href
var els = document.getElementsByTagName("a");
for (var i = 0, l = els.length; i < l; i++) { var els = document.getElementsByTagName("a");
var el = els[i]; for (var i = 0, l = els.length; i < l; i++) {
var el = els[i];
if (el.href === current) {
el.classList.add("selected") if (el.href === current) {
} else { el.classList.add("selected")
el.classList.remove("selected") } else {
} el.classList.remove("selected")
} }
}
}) })
// load the lecture note links in homepage
function load_lecture_links() {
// check if links have already been generated first
if ($("p.lecture-link").length == 0) {
fetchJSON(function (response) {
const notes = response;
// for homepage lecture links
const lecture_links = new Map();
notes.index.filter(n => !/^Drawing|^20/.test(n.title)).forEach(note => {
// Add lecture notes to a dictionary, and then sort them by lecture number.
// second last character of the title may be first digit of lecture number
const d1 = note.title[note.title.length - 2];
// find the lecture number, if there is one
if (/\d/.test(d1)) {
// it has a lecture number
// if the third last character is a digit, then the lecture number is 2 digits
const d2 = note.title[note.title.length - 3];
var lecture_number = /\d/.test(d2) ? Number(d2 + d1) : Number(d1);
// some lecture titles have the same last lecture number
if (lecture_links.has(lecture_number)) {
// prevents two lectures from having the same key
lecture_number += 0.5;
}
lecture_links.set(lecture_number, [note.title, note.permalink])
}
});
const sorted_links = new Map([...lecture_links.entries()].sort((a, b) => (a[0] - b[0])));
sorted_links.forEach(val => {
a_tag = document.createElement('a');
a_tag.innerText = val[0]; //title
a_tag.href = val[1]; //permalink
p_tag = document.createElement('p');
p_tag.append(a_tag);
p_tag.className = "lecture-link"
// Add lecture notes before third </br> tag in _index.md
$("#note-wrapper br:nth-of-type(3)").before(p_tag);
});
});
}
}
function loadIndex() { function loadIndex() {
fetchJSON(function(response) {
fetchJSON(function (response) {
const notes = response; const notes = response;
const search_results = document.getElementById('search-results'); const search_results = document.getElementById('search-results');
const tags = document.getElementById('tags'); const tags = document.getElementById('tags');
const current_note = window.location.href; const current_note = window.location.href;
notes.index.forEach(note => {
// sorted notes by lecture number const title = '<h4>'+ note.title + '</h4>';
const lecture_notes = new Map();
const non_lecture_notes = [];
// Fixed a bug where the search results had unwanted notes.
// The notes are now filtered first.
notes.index.filter(n => !/^Drawing|^20/.test(n.title)).forEach(note => {
const title = '<h4>' + note.title + '</h4>';
const summary = '<div>' + note.summary + '</div>'; const summary = '<div>' + note.summary + '</div>';
const permalink = note.permalink const permalink = note.permalink
var thumbnail = "" var thumbnail = ""
if (note.thumbnail === "") { if (note.thumbnail === "") {
thumbnail = "" thumbnail = ""
@ -225,47 +175,20 @@ function loadIndex() {
// use lazy loading. // use lazy loading.
thumbnail = '<img loading="lazy" src="' + note.thumbnail + '?nf_resize=fit&w=122&h=76"/><span style="display:none";>@attachments</span>' thumbnail = '<img loading="lazy" src="' + note.thumbnail + '?nf_resize=fit&w=122&h=76"/><span style="display:none";>@attachments</span>'
} }
const tags = '<span style="display:none">' + note.tags + '</span>' const tags = '<span style="display:none">' + note.tags + '</span>'
var list_content; var list_content;
if (current_note === permalink) { if (current_note === permalink) {
list_content = '<a href="' + permalink + '" class="selected search-item" tabindex="0">' + title + summary + '</a>' list_content = '<a href="/MATH201' + permalink + '" class="selected search-item" tabindex="0">' + title + summary + '</a>'
} else { } else {
list_content = '<a href="' + permalink + '" class="search-item" tabindex="0">' + title + summary + thumbnail + tags + '</a>' list_content = '<a href="/MATH201' + permalink + '" class="search-item" tabindex="0">' + title + summary + thumbnail + tags + '</a>'
} }
const child = document.createElement("li"); const child = document.createElement("li");
child.innerHTML = list_content; child.innerHTML = list_content;
search_results.append(child)
// Add lecture notes to a dictionary, and then sort them by lecture number.
// second last character of the title may be first digit of lecture number
const d1 = note.title[note.title.length - 2];
// find the lecture number, if there is one
if (/\d/.test(d1)) {
// it has a lecture number
// if the third last character is a digit, then the lecture number is 2 digits
const d2 = note.title[note.title.length - 3];
var lecture_number = /\d/.test(d2) ? Number(d2 + d1) : Number(d1);
if (lecture_notes.has(lecture_number)) {
// prevent lectures from having the same key
lecture_number += 0.5;
}
lecture_notes.set(lecture_number, child);
} else {
non_lecture_notes.push(child);
}
}); });
// sort notes by lecture number
const sorted_notes = new Map([...lecture_notes.entries()].sort((a, b) => (a[0] - b[0])));
// Add sorted notes first
sorted_notes.forEach(val => {
search_results.append(val);
});
non_lecture_notes.forEach(child => {
search_results.append(child);
});
// @todo: wip // @todo: wip
// notes.tags.forEach(tag => { // notes.tags.forEach(tag => {
// const child = document.createElement("li"); // const child = document.createElement("li");
@ -273,19 +196,20 @@ function loadIndex() {
// tags.append(child) // tags.append(child)
// }); // });
// //
}); });
} }
function fetchJSON(callback) { function fetchJSON(callback) {
const requestURL = root + '/index.json';
const requestURL = '/MATH201/index.json';
const request = new XMLHttpRequest(); const request = new XMLHttpRequest();
request.open('GET', requestURL, true); request.open('GET', requestURL, true);
request.responseType = 'json'; request.responseType = 'json';
request.onreadystatechange = function () { request.onreadystatechange = function() {
if (request.readyState === 4 && request.status === 200) { if (request.readyState === 4 && request.status === 200) {
callback(request.response); callback(request.response);
} }
}; };
request.send(null); request.send(null);
} }
@ -293,91 +217,96 @@ function fetchJSON(callback) {
function focusTag(a) { function focusTag(a) {
showNav() showNav()
performSearchWith(a.innerText) performSearchWith(a.innerText)
} }
function performSearchWith(query) { function performSearchWith(query) {
// document.getElementById('search-input').value = query // document.getElementById('search-input').value = query
var filter, ul, li, a, i, txtValue; var filter, ul, li, a, i, txtValue;
filter = query.toLowerCase();
filter = filter.replace('/[.*+?^${}()|[\]\\]/g', '\\$&');
var re = new RegExp(filter, 'g');
ul = document.getElementById("search-results");
li = ul.getElementsByTagName('li');
filter = query.toLowerCase(); for (i = 0; i < li.length; i++) {
filter = filter.replace('/[.*+?^${}()|[\]\\]/g', '\\$&');
var re = new RegExp(filter, 'g');
ul = document.getElementById("search-results");
li = ul.getElementsByTagName('li');
for (i = 0; i < li.length; i++) {
a = li[i].getElementsByTagName("a")[0]; a = li[i].getElementsByTagName("a")[0];
txtValue = a.textContent || a.innerText; txtValue = a.textContent || a.innerText;
if (txtValue.toLowerCase().indexOf(filter) > -1) { if (txtValue.toLowerCase().indexOf(filter) > -1) {
li[i].style.display = "block"; li[i].style.display = "block";
} else { } else {
li[i].style.display = "none"; li[i].style.display = "none";
} }
} }
} }
function performSearch() { function performSearch() {
var input, filter, ul, li, a, i, txtValue;
input = document.getElementById('search-input');
filter = input.value.toLowerCase();
filter = filter.replace('/[.*+?^${}()|[\]\\]/g', '\\$&');
var re = new RegExp(filter, 'g');
ul = document.getElementById("search-results");
li = ul.getElementsByTagName('li');
var input, filter, ul, li, a, i, txtValue; for (i = 0; i < li.length; i++) {
input = document.getElementById('search-input');
filter = input.value.toLowerCase();
filter = filter.replace('/[.*+?^${}()|[\]\\]/g', '\\$&');
var re = new RegExp(filter, 'g');
ul = document.getElementById("search-results");
li = ul.getElementsByTagName('li');
for (i = 0; i < li.length; i++) {
a = li[i].getElementsByTagName("a")[0]; a = li[i].getElementsByTagName("a")[0];
txtValue = a.textContent || a.innerText; txtValue = a.textContent || a.innerText;
if (txtValue.toLowerCase().indexOf(filter) > -1) { if (txtValue.toLowerCase().indexOf(filter) > -1) {
li[i].style.display = "block"; li[i].style.display = "block";
} else { } else {
li[i].style.display = "none"; li[i].style.display = "none";
} }
} }
} }
// Keyboard shortcuts // Keyboard shortcuts
document.addEventListener('keydown', function (evt) { document.addEventListener('keydown', function(evt) {
if (evt.metaKey && evt.which === 75 || evt.ctrlKey && evt.which === 75) { if (evt.metaKey && evt.which === 75 || evt.ctrlKey && evt.which === 75) {
document.getElementById("search-input").focus(); document.getElementById("search-input").focus();
handleNavVisibility() handleNavVisibility()
} }
if (evt.key === "Escape" || evt.key === "Esc" | evt.keyCode === 27) { if (evt.key === "Escape" || evt.key === "Esc" | evt.keyCode === 27) {
hideNav() hideNav()
} }
}); });
var nav_is_visible = false; var nav_is_visible = false;
function handleNavVisibility() { function handleNavVisibility() {
$("#search").toggle("slide"); if (!nav_is_visible) {
showNav();
} else {
hideNav()
}
} }
function showNav() { function showNav() {
document.getElementById("search").style.width = "300px"; document.getElementById("search").style.width = "300px";
document.getElementById("search").style.opacity = 1; document.getElementById("search").style.opacity = 1;
document.getElementById("search-header").style.opacity = 1; document.getElementById("search-header").style.opacity = 1;
document.getElementById("search-header").style.width = "299px"; document.getElementById("search-header").style.width = "299px";
pushNoteWrapper() pushNoteWrapper()
nav_is_visible = true; nav_is_visible = true;
} }
@ -386,9 +315,9 @@ function hideNav() {
document.getElementById("search-header").style.width = "0"; document.getElementById("search-header").style.width = "0";
document.getElementById("search").style.opacity = 0; document.getElementById("search").style.opacity = 0;
document.getElementById("search-header").style.opacity = 0; document.getElementById("search-header").style.opacity = 0;
document.getElementById("main").style.marginLeft = "0"; document.getElementById("main").style.marginLeft= "0";
pullNoteWrapper() pullNoteWrapper()
nav_is_visible = false; nav_is_visible = false;
} }
@ -415,54 +344,54 @@ const hoverTime = 300
const fetchers = {} const fetchers = {}
const doc = document.implementation.createHTMLDocument('prefetch') const doc = document.implementation.createHTMLDocument('prefetch')
function fetchPage(url, success) { function fetchPage (url, success) {
const xhr = new XMLHttpRequest() const xhr = new XMLHttpRequest()
xhr.open('GET', url) xhr.open('GET', url)
xhr.setRequestHeader('VND.PREFETCH', 'true') xhr.setRequestHeader('VND.PREFETCH', 'true')
xhr.setRequestHeader('Accept', 'text/html') xhr.setRequestHeader('Accept', 'text/html')
xhr.onreadystatechange = () => { xhr.onreadystatechange = () => {
if (xhr.readyState !== XMLHttpRequest.DONE) return if (xhr.readyState !== XMLHttpRequest.DONE) return
if (xhr.status !== 200) return if (xhr.status !== 200) return
success(xhr.responseText) success(xhr.responseText)
} }
xhr.send() xhr.send()
} }
function prefetchTurbolink(url) { function prefetchTurbolink (url) {
fetchPage(url, responseText => { fetchPage(url, responseText => {
doc.open() doc.open()
doc.write(responseText) doc.write(responseText)
doc.close() doc.close()
const snapshot = Turbolinks.Snapshot.fromHTMLElement(doc.documentElement) const snapshot = Turbolinks.Snapshot.fromHTMLElement(doc.documentElement)
Turbolinks.controller.cache.put(url, snapshot) Turbolinks.controller.cache.put(url, snapshot)
}) })
} }
function prefetch(url) { function prefetch (url) {
if (prefetched(url)) return if (prefetched(url)) return
prefetchTurbolink(url) prefetchTurbolink(url)
} }
function prefetched(url) { function prefetched (url) {
return location.href === url || Turbolinks.controller.cache.has(url) return location.href === url || Turbolinks.controller.cache.has(url)
} }
function prefetching(url) { function prefetching (url) {
return !!fetchers[url] return !!fetchers[url]
} }
function cleanup(event) { function cleanup (event) {
const element = event.target const element = event.target
clearTimeout(fetchers[element.href]) clearTimeout(fetchers[element.href])
element.removeEventListener('mouseleave', cleanup) element.removeEventListener('mouseleave', cleanup)
} }
document.addEventListener('mouseover', event => { document.addEventListener('mouseover', event => {
if (!event.target.dataset.prefetch) return if (!event.target.dataset.prefetch) return
const url = event.target.href const url = event.target.href
if (prefetched(url)) return if (prefetched(url)) return
if (prefetching(url)) return if (prefetching(url)) return
cleanup(event) cleanup(event)
event.target.addEventListener('mouseleave', cleanup) event.target.addEventListener('mouseleave', cleanup)
fetchers[url] = setTimeout(() => prefetch(url), hoverTime) fetchers[url] = setTimeout(() => prefetch(url), hoverTime)
}) })

View File

@ -1,14 +1,19 @@
// Resize images using an input range. var thumbnail_mode = false
function resizeImage() { function imageMode() {
// make p tags wrapping img tags inline, to resize images correctly const note_wrapper = document.getElementById('note-wrapper')
$("#main p").has("img").css("display", "inline-block"); const images = note_wrapper.getElementsByTagName('img')
// toggle vectical input range if (thumbnail_mode) {
$("#toolbar input[type=range][orient=vertical]").slideToggle(); var els = note_wrapper.getElementsByTagName('img')
for(var i = 0, all = els.length; i < all; i++){
// resize image els[i].classList.remove('thumbnail');
$("#toolbar input[type=range][orient=vertical]").mouseup(function () { }
$("#main p img").css("width", this.value + "%"); thumbnail_mode = false
this.title = this.value + "%"; } else {
}); var els = note_wrapper.getElementsByTagName('img')
for(var i = 0, all = els.length; i < all; i++){
els[i].classList.add('thumbnail');
}
thumbnail_mode = true
}
} }

View File

@ -1,14 +1,8 @@
{{ define "main" }} {{ define "main" }}
<p style="text-align: center;"><a href="http://sasserisop.com">Back to Sasserisop homepage</a></p> <p style="text-align: center;"><a href="http://sasserisop.com">Back to Sasserisop homepage</a></p>
{{ partial "content.html" . }} {{ partial "content.html" . }}
<p style="font-size:25pt;">❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦</p></br> <p style="font-size:25pt;">❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦ ❦</p></br>
<p style="text-align: left;"><a href="https://git.sasserisop.com/Sasserisop/MATH201/src/branch/master">Gitea repository <p style="text-align: left;">Seeing people use these notes and benefitting from it makes me happy, so thanks for sticking around :) and remember to use what you learn for good! And to lead life with honor and integrity and be ethical engineers. Dr. Minev used to always stress the importance of this in his lectures, and I wholeheartedly agree.</p></br>
<img style="vertical-align: middle;" border="0" src="gitea-logo.svg" width="35" height="35"></a></p></br> <p style="text-align: left;"><a href="https://git.sasserisop.com/Sasserisop/MATH201/src/branch/master">Gitea repository <img style="vertical-align: middle;" border="0" src="gitea-logo.svg" width="35" height="35"></a></p></br>
<p style="text-align: left;"><a href="https://discord.gg/G3DWjgvP3A" target="_blank" rel="noopener noreferrer">Community <p style="text-align: left;"><a href="https://discord.gg/G3DWjgvP3A" target="_blank" rel="noopener noreferrer">Community discord <img style="vertical-align: middle;" border="0" src="discord-logo.svg" width="35" height="35"></a></p>
discord <img style="vertical-align: middle;" border="0" src="discord-logo.svg" width="35" height="35"></a></p> {{ end }}
<script>
$(function () {
load_lecture_links();
});
</script>
{{ end }}

View File

@ -6,134 +6,130 @@
- Focused current note - Focused current note
--> -->
<style> <style>
search-menu { search-menu {
display: none; display: block;
} }
#search { #search {
height: 100%; height: 100%;
width: 300px; width: 0;
position: fixed; position: fixed;
background: var(--background-search); background: var(--background-search);
z-index: 1; z-index: 1;
top: 0; top: 0;
left: 0; left: 0;
border-right: 1px solid var(--separator-color); border-right: 1px solid var(--separator-color);
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
opacity: 0;
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
#search::-webkit-scrollbar { display: none; }
-ms-overflow-style: none; #search-header {
/* IE and Edge */ padding: 12px;
scrollbar-width: none; position: fixed;
/* Firefox */ padding-left: 12px;
} padding-right: 12px;
background: var(--background-search);
width: 250px;
opacity: 1;
height: 50px;
z-index: 2;
border-bottom: 1px solid var(--separator-color);
}
#search::-webkit-scrollbar { #search .input-container {
display: none; position: relative
} }
#search-header { #search-input {
padding: 12px 0; width: 100%;
margin: 0 auto; height: 24px;
background: var(--background-search); border: 1px solid var(--separator-color);
width: 250px; border-radius: 4px;
opacity: 1; padding-left: 16px;
height: 50px; background-color: white;
z-index: 2; display: inline-block;
border-bottom: 1px solid var(--separator-color); }
}
#search .input-container { #search-input:focus {
position: relative border: 1px solid var(--search-field-focused-color);
} }
#search-input { #search-header .input-container .search-icon {
width: 100%; position: absolute;
height: 24px; top: 6px;
border: 1px solid var(--separator-color); left: 8px;
border-radius: 4px; fill: darkGray;
padding-left: 24px; }
background-color: white;
display: inline-block;
}
#search-input:focus { #search-results img {
border: 1px solid var(--search-field-focused-color); width: 122px;
} height: 76px;
border: 1px solid var(--separator-color);
object-fit: cover;
}
#search-header .input-container .search-icon { #search-results {
position: absolute; margin-top: 50px;
top: 6px; overflow: auto;
left: 8px; height: 100%;
fill: darkGray; }
}
#search-results img { #search-results a {
width: 122px; width: 100%;
height: 76px; padding-left: 25px;
border: 1px solid var(--separator-color); padding-right: 25px;
object-fit: cover; padding-top: 12px;
} padding-bottom: 12px;
display: inline-block;
color: var(--text-base-color);
border-bottom: 1px solid var(--separator-color);
border-left: 6px solid var(--background-search);
#search-results { }
overflow: auto;
height: 100%;
}
#search-results a { #search-results a:first-child:hover, a:first-child:focus, .selected {
width: 100%; outline: 0;
padding-left: 25px; background-color: var(--note-table-cell-selected-color);
padding-right: 25px; border-left: 6px solid var(--note-table-cell-ribbon-color) !important;
padding-top: 12px; }
padding-bottom: 12px;
display: inline-block;
color: var(--text-base-color); // Reseting default styles inside search component scope
border-bottom: 1px solid var(--separator-color); #search-results li { text-indent: 0; }
border-left: 6px solid var(--background-search); #search-results li:before,
#search-results h1:before,
} #search-results h2:before,
#search-results h3:before,
#search-results a:first-child:hover, #search-results h4:before,
a:first-child:focus, #search-results h5:before,
.selected { #search-results h6:before {
outline: 0; content: "";
background-color: var(--note-table-cell-selected-color); visibility: hidden;
border-left: 6px solid var(--note-table-cell-ribbon-color) !important; display: none;
} }
</style>
/* // Reseting default styles inside search component scope */
#search-results li {
text-indent: 0;
}
#search-results li:before,
#search-results h1:before,
#search-results h2:before,
#search-results h3:before,
#search-results h4:before,
#search-results h5:before,
#search-results h6:before {
content: "";
visibility: hidden;
display: none;
}
</style>
<search-menu id="search" data-turbolinks-permanent> <search-menu id="search" data-turbolinks-permanent>
<header id="search-header"> <header id="search-header">
<div class="input-container"> <div class="input-container">
<svg aria-hidden="true" class="search-icon" width="12" height="12" viewBox="0 0 18 18"> <svg aria-hidden="true" style="" class="search-icon" width="12" height="12" viewBox="0 0 18 18">
<path <path d="M18 16.5l-5.14-5.18h-.35a7 7 0 10-1.19 1.19v.35L16.5 18l1.5-1.5zM12 7A5 5 0 112 7a5 5 0 0110 0z">
d="M18 16.5l-5.14-5.18h-.35a7 7 0 10-1.19 1.19v.35L16.5 18l1.5-1.5zM12 7A5 5 0 112 7a5 5 0 0110 0z"> </path>
</path> </svg>
</svg>
<input type="search" autocomplete="off" id="search-input" onkeyup="performSearch()" tabindex="0" placeholder="Search note">
<input type="search" autocomplete="off" id="search-input" onkeyup="performSearch()" tabindex="0"
placeholder="Search Notes">
</div>
</header> </div>
</header>
<ul id="search-results"></ul>
<ul id="search-results"></ul>
</search-menu> </search-menu>

View File

@ -1,58 +1,42 @@
<script>
</script>
<style> <style>
#toolbar { #toolbar {
position: fixed; position: fixed;
top: 0; top: 0;
right: 0; right: 0;
width: 60px;
height: 100%;
width: 60px; display: flex;
height: 100%; flex-direction: column;
justify-content: flex-start;
align-items: center;
transition: 1s;
opacity: 0.5;
padding: 18px 0px 18px 0px;
}
display: flex; #toolbar:hover {
flex-direction: column; opacity: 1;
justify-content: flex-start; }
align-items: center;
transition: 1s; #close-nav-icon {
opacity: 0.5; display: none;
z-index: 1; }
padding: 18px 0px 18px 0px;
}
#toolbar:hover {
opacity: 1;
}
#close-nav-icon {
display: none;
}
#toolbar input[type=range][orient=vertical] {
appearance: slider-vertical;
display: none;
}
</style> </style>
<aside id="toolbar"> <aside id="toolbar">
<span title="Toggle Search Menu" style="cursor:pointer" id="open-nav-icon" onclick="handleNavVisibility()"> <span style="cursor:pointer" id="open-nav-icon" onclick="handleNavVisibility()">
<svg width="18" height="18" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> <svg width="18" height="18" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle fill="none" stroke="var(--text-base-color)" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="var(--text-base-color)" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg>
<circle fill="none" stroke="var(--text-base-color)" stroke-width="1.1" cx="9" cy="9" r="7"></circle>
<path fill="none" stroke="var(--text-base-color)" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path>
</svg>
</span> </span>
<span title="Adjusts Diagram Size" style="cursor:pointer;margin-top:16px;" onclick="resizeImage()"> <span onclick="imageMode()" style="cursor:pointer;margin-top:16px;">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="16.1" cy="6.1" r="1.1"></circle><rect fill="none" stroke="var(--text-base-color" x=".5" y="2.5" width="19" height="15"></rect><polyline fill="none" stroke="var(--text-base-color" stroke-width="1.01" points="4,13 8,9 13,14"></polyline><polyline fill="none" stroke="var(--text-base-color)" stroke-width="1.01" points="11,12 12.5,10.5 16,14"></polyline></svg>
<circle cx="16.1" cy="6.1" r="1.1"></circle>
<rect fill="none" stroke="var(--text-base-color" x=".5" y="2.5" width="19" height="15"></rect>
<polyline fill="none" stroke="var(--text-base-color" stroke-width="1.01" points="4,13 8,9 13,14"></polyline>
<polyline fill="none" stroke="var(--text-base-color)" stroke-width="1.01" points="11,12 12.5,10.5 16,14">
</polyline>
</svg>
</span> </span>
<input title="100%" type="range" orient="vertical" min="0" max="100" step="0.5" value="100"> </aside>
</aside>
<script>
</script>