Merge branch 'Exercise-7' into 'master'

Add exercise 7 and 8

See merge request oysteikt/ma0001-matematikk!1
This commit is contained in:
Oystein Kristoffer Tveit 2020-10-17 18:35:18 +02:00
commit 42b82fb8eb
28 changed files with 364 additions and 14 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@
*.out *.out
*.synctex.gz *.synctex.gz
*.toc *.toc
*.listing

Binary file not shown.

View File

@ -1,7 +1,7 @@
\documentclass{article} \documentclass{article}
\author{Øystein Tveit} \newcommand{\theTitle}{MA0001 Øving 2}
\title{MA0001 Øving 2} \newcommand{\theAuthor}{Øystein Tveit}
\input{../lib/lib.tex} \input{../lib/lib.tex}

Binary file not shown.

View File

@ -1,5 +1,8 @@
\documentclass{article} \documentclass{article}
\newcommand{\theTitle}{MA0001 Øving 3}
\newcommand{\theAuthor}{Øystein Tveit}
\input{../lib/lib.tex} \input{../lib/lib.tex}
\begin{document} \begin{document}

Binary file not shown.

View File

@ -1,5 +1,8 @@
\documentclass{article} \documentclass{article}
\newcommand{\theTitle}{MA0001 Øving 4}
\newcommand{\theAuthor}{Øystein Tveit}
\input{../lib/lib.tex} \input{../lib/lib.tex}
\usepackage{amssymb} \usepackage{amssymb}

Binary file not shown.

View File

@ -1,5 +1,8 @@
\documentclass{article} \documentclass{article}
\newcommand{\theTitle}{MA0001 Øving 5}
\newcommand{\theAuthor}{Øystein Tveit}
\input{../lib/lib.tex} \input{../lib/lib.tex}
\usepackage{amssymb} \usepackage{amssymb}

Binary file not shown.

View File

@ -1,5 +1,8 @@
\documentclass{article} \documentclass{article}
\newcommand{\theTitle}{MA0001 Øving 6}
\newcommand{\theAuthor}{Øystein Tveit}
\input{../lib/lib.tex} \input{../lib/lib.tex}
\begin{document} \begin{document}

BIN
Exercise 7/main.pdf Normal file

Binary file not shown.

46
Exercise 7/main.tex Normal file
View File

@ -0,0 +1,46 @@
\documentclass{article}
\newcommand{\theTitle}{MA0001 Øving 7}
\newcommand{\theAuthor}{Øystein Tveit}
\input{../lib/lib.tex}
\usepackage{amssymb}
\begin{document}
\thispagestyle{plain}
\tittel
\tableofcontents
\newpage
\section{Forberedende oppgaver}
\begin{oppgaver}
\oppg
\input{tasks/1.tex}
\end{oppgaver}
\newpage
\section{Innleveringsoppgaver}
\begin{oppgaver}
\setoppg{1}
\oppg
\input{tasks/2.tex}
\oppg
\input{tasks/3.tex}
\oppg
\input{tasks/4.tex}
\oppg
\input{tasks/5.tex}
\end{oppgaver}
\end{document}

11
Exercise 7/tasks/1.tex Normal file
View File

@ -0,0 +1,11 @@
\begin{deloppgaver}
\delo
\[f'(x) = 3\]
\delo
\[f^{-1}(x) = \frac{x}{3} - 1\]
\delo
\[\frac{d}{dx} f^{-1}(x) = \frac{1}{3} \]
\end{deloppgaver}

12
Exercise 7/tasks/2.tex Normal file
View File

@ -0,0 +1,12 @@
\[ f(x) = x^2 \]
\begin{align*}
\frac{d}{dx} f(x) &= \lim_{\Delta x \to 0} \frac{f(x+\Delta x) - f(x)}{\Delta x} \\[2ex]
&= \lim_{\Delta x \to 0} \frac{(x+\Delta x)^2 - x^2}{\Delta x} \\[2ex]
&= \lim_{\Delta x \to 0} \frac{x^2 + 2x \Delta x + {\Delta x}^2 - x^2}{\Delta x} \\[2ex]
&= \lim_{\Delta x \to 0} \frac{2x \Delta x + {\Delta x}^2}{\Delta x} \\[2ex]
&= \lim_{\Delta x \to 0} \frac{2x + \Delta x}{1} \\[2ex]
&= \lim_{\Delta x \to 0} \frac{2x + \Delta x}{1} \\[2ex]
&= 2x + 0 \\[2ex]
&= 2x \\[2ex]
\end{align*}

6
Exercise 7/tasks/3.tex Normal file
View File

@ -0,0 +1,6 @@
\[ h(x) = -\frac{1}{4}x^4 + \frac{2}{3}x^3 + 2x^2 - \sqrt{2}x + \pi^e \]
\begin{align*}
h'(x) &= 4 \cdot -\frac{1}{4}x^{4-1} + 3 \cdot \frac{2}{3}x^{3-1} + 2\cdot2x^{2-1} - 1 \cdot \sqrt{2}x^{1-1} + 0 \cdot \pi^e x^{0-1} \\
&= -x^{3} + 2x^{2} + 4x - \sqrt{2} \\
\end{align*}

12
Exercise 7/tasks/4.tex Normal file
View File

@ -0,0 +1,12 @@
\begin{align*}
\left(x^{1/3}-x\right) \cdot \left(x^{2/3}+x^2\right)
&= x^{1/3} \cdot x^{2/3} + x^{1/3} \cdot x^2 - x\cdot x^{2/3} - x \cdot x^{2} \\
&= x + x^{7/3} - x^{5/3} - x^3 \\
\end{align*}
\begin{align*}
\frac{d}{dx} \left( x + x^{7/3} - x^{5/3} - x^3 \right)
&= 1 + \frac{7}{3}x^{4/3} - \frac{5}{3}x^{2/3} - 3x^2 \\
&= - 3x^2 - \frac{5}{3}x^{2/3} + \frac{7}{3}x^{4/3} + 1
\end{align*}

14
Exercise 7/tasks/5.tex Normal file
View File

@ -0,0 +1,14 @@
\[ f(x): \mathbb{R} \to \mathbb{R} = \begin{cases}
\sqrt{x},\qquad &x \ge 0 \\
x, &x < 0
\end{cases} \]
Ettersom \[\sqrt{0} = 0\] og \[\lim_{x\to 0}x = 0\] er funksjonen kontinuerlig.
Den deriverte av den første delen av funksjonen blir
\begin{align*}
\frac{d}{dx} \sqrt{x} &= \frac{1}{2} x^{-\frac{1}{2}} \\[2ex]
&= \frac{1}{2\sqrt{x}}
\end{align*}
Ved $x=0$ blir \[\frac{1}{2\sqrt{x}} = \frac{1}{0}\] som er udefinert, og dermed er ikke den funksjonen deriverbar for denne $x$-verdien

BIN
Exercise 8/main.pdf Normal file

Binary file not shown.

47
Exercise 8/main.tex Normal file
View File

@ -0,0 +1,47 @@
\documentclass{article}
\newcommand{\theTitle}{Øystein Tveit}
\newcommand{\theAuthor}{MA0001 Øving 8}
\input{../lib/lib.tex}
\input{../lib/lst.tex}
\begin{document}
\thispagestyle{plain}
\tittel
\tableofcontents
\newpage
\section{Forberedende oppgaver}
\begin{oppgaver}
\oppg
\input{tasks/1.tex}
\end{oppgaver}
\newpage
\section{Innleveringsoppgaver}
\begin{oppgaver}
\setoppg{1}
\oppg
\input{tasks/2.tex}
\oppg
\input{tasks/3.tex}
\oppg
\input{tasks/4.tex}
\oppg
\input{tasks/5.tex}
\end{oppgaver}
\end{document}

19
Exercise 8/scripts/4.py Normal file
View File

@ -0,0 +1,19 @@
from math import e
def f(x): return e ** x - 2
def df(x): return e ** x
def Newton(a, f, df):
return a - f(a)/df(a)
def main():
i = 0
a = [5]
while True:
a.append(Newton(a[i], f, df))
if abs(a[i] - a[i-1]) < 0.001:
print(f'Iterasjoner: {i-1}, a: {a[i-1]}')
break
i += 1
main()

10
Exercise 8/tasks/1.tex Normal file
View File

@ -0,0 +1,10 @@
\[f(x) = \frac{1}{2}x^3 -7x +22\]
\[f'(x) = \frac{3}{2}x^2 -7\]
\[f''(x) = 3x \]
\[f'''(x) = 3 \]
\[f^{(100)} = 0\]

53
Exercise 8/tasks/2.tex Normal file
View File

@ -0,0 +1,53 @@
\begin{enumerate}[label=\arabic*.]
\item \[ f(x) = ln\left(\frac{1}{x^2}\right) \]
La $u = \frac{1}{x^2}$
Jeg bruker kjerneregelen:
\begin{align*}
\frac{dy}{dx} &= \frac{dy}{du} \cdot \frac{du}{dx} \\
&= \frac{d}{du} ln(u) \cdot \frac{d}{dx} \frac{1}{x^2} \\
&= \frac{1}{u} -2 \frac{1}{x^3} \\
&= \frac{1}{\frac{1}{x^2}} -2 \frac{1}{x^3} \\
&= x^2 -2 \frac{1}{x^3}
\end{align*}
\item \[g(x) = \frac{1 + \sin x}{1 + e^x + x^2}\]
Jeg bruker kvotientregelen:
$u = 1 + \sin x$
$v = 1 + e^x + x^2$
\[ \frac{d}{dx}\left(\frac{u}{v}\right) = \frac{ \frac{d}{dx}(u) \cdot v - u \cdot \frac{d}{dx}(v)}{v^2} \]
\begin{align*}
\frac{d}{dx} u &= \frac{d}{dx} 1 + \sin x \\
&= \cos x
\end{align*}
\begin{align*}
\frac{d}{dx} v &= \frac{d}{dx} 1 + e^x + x^2 \\
&= e^x + 2x
\end{align*}
\begin{align*}
\frac{dg}{dx} &= \frac{(\cos x)(1+e^x+x^2) - (1+\sin x)(e^x + 2x)}{\left(1 + e^x + x^2\right)^2}
\end{align*}
\item \[h(x) = \sqrt{1 + \sqrt{x}}\]
$u = 1 + \sqrt{x}$
\begin{align*}
\frac{dy}{dx} &= \frac{dy}{dv} \cdot \frac{du}{dx} \\
&= \frac{d}{du} \sqrt{u} \cdot \frac{d}{dx} \left( 1 + \sqrt{x} \right) \\
&= \frac{1}{2\sqrt{u}} \cdot \frac{1}{2\sqrt{x}} \\
&= \frac{1}{2\sqrt{1+\sqrt{x}}} \cdot \frac{1}{2\sqrt{x}} \\
&= \frac{1}{4\sqrt{1+\sqrt{x}} \sqrt{x}}
\end{align*}
\end{enumerate}

41
Exercise 8/tasks/3.tex Normal file
View File

@ -0,0 +1,41 @@
\[f(t) = \frac{t^2 -1}{t+1} + 6t^{1/3} + \sqrt{\sin t} + 4^t\]
Jeg deriverer funksjonen ledd for ledd
Ledd 1:
\begin{align*}
\frac{d}{dt} \frac{t^2-1}{t+1} &= \frac{d}{dt}\frac{(t+1)(t-1)}{t+1} \\
&= \frac{d}{dt} t-1 \\
&= 1
\end{align*}
Ledd 2:
\begin{align*}
\frac{d}{dt} 6t^{1/3} &= \frac{1}{3} \cdot 6t^{(1/3 - 1)} \\
&= 2t^{-2/3}\\
&= \frac{2}{\sqrt[3]{t^2}}
\end{align*}
Ledd 3:
\[ \frac{d}{dt} \sqrt{\sin t} \]
$u = \sin t$
\begin{align*}
\frac{dy}{dt} &= \frac{dy}{du} \cdot \frac{du}{dt} \\
&= \frac{d}{du} \sqrt{u} \cdot \frac{d}{dt} \sin t \\
&= \frac{1}{2\sqrt{u}} \cdot \cos t \\
&= \frac{\cos t}{2\sqrt{\sin t}}
\end{align*}
Ledd 4:
\begin{align*}
\frac{d}{dt} 4^t = 4^t ln(t) \\
\end{align*}
\[\frac{df}{dx} = 1 + \frac{2}{\sqrt[3]{t^2}} + \frac{\cos t}{2\sqrt{\sin t}} + 4^t ln(t)\]

7
Exercise 8/tasks/4.tex Normal file
View File

@ -0,0 +1,7 @@
Her har jeg brukt python for å løse oppgaven.
\pythonBlock{./scripts/4.py}
Output:
\fbox{Iterasjoner: 7, a: 0.6932882713164431}

18
Exercise 8/tasks/5.tex Normal file
View File

@ -0,0 +1,18 @@
\[f(y) = a^y \]
\[f'(y) = a^y \ln a\]
\[f^{-1}(y) = \log_{a} y\]
\begin{align*}
\frac{d}{dy}f^{-1}(y) &= \frac{1}{f' \circ f^{-1}(y)} \\[2ex]
&= \frac{1}{a^{\log_{a} y} \ln a} \\[2ex]
&= \frac{1}{y \ln a} \\
\end{align*}
Gitt at vi vet at $\frac{d}{dx} ln(x) = \frac{1}{x}$, så kan vi også løse det på følgende måte
\begin{align*}
\frac{d}{dy} \log_{a} y &= \frac{d}{dy} \frac{\ln y}{\ln a} \\[2ex]
&= \frac{1}{\ln a} \cdot \frac{d}{dy} \ln y \\[2ex]
&= \frac{1}{\ln a} \cdot \frac{1}{y} \\[2ex]
&= \frac{1}{y \ln a}
\end{align*}

View File

@ -11,8 +11,8 @@
\definecolor{ntnublue}{RGB}{0,80,158} \definecolor{ntnublue}{RGB}{0,80,158}
\input{../lib/geometry.tex}
\input{../lib/header.tex} \input{../lib/header.tex}
\input{../lib/geometry.tex}
\input{../lib/math.tex} \input{../lib/math.tex}
\usetikzlibrary{angles, quotes} \usetikzlibrary{angles, quotes}
@ -21,12 +21,12 @@
linkcolor=blue, linkcolor=blue,
filecolor=magenta, filecolor=magenta,
urlcolor=blue, urlcolor=blue,
} }
\pgfplotsset{compat=newest} \pgfplotsset{compat=newest}
\author{Øystein Tveit} \author{\theAuthor}
\title{MA0001 Øving 6} \title{\theTitle}
\input{../lib/titling.tex} \input{../lib/titling.tex}

41
lib/lst.tex Normal file
View File

@ -0,0 +1,41 @@
\usepackage{listings}
\definecolor{background}{RGB}{39, 40, 34}
\definecolor{string}{RGB}{230, 219, 116}
\definecolor{comment}{RGB}{117, 113, 94}
\definecolor{normal}{RGB}{248, 248, 242}
\definecolor{identifier}{RGB}{166, 226, 46}
\lstdefinestyle{monokaiPython}{
frame=none,
language=python, % choose the language of the code
numbers=left, % where to put the line-numbers
stepnumber=1, % the step between two line-numbers.
numbersep=5pt, % how far the line-numbers are from the code
numberstyle=\color{white}\ttfamily,
backgroundcolor=\color{background}, % choose the background color. You must add \usepackage{color}
showspaces=false, % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
showtabs=false, % show tabs within strings adding particular underscores
tabsize=2, % sets default tabsize to 2 spaces
captionpos=b, % sets the caption-position to bottom
breaklines=true, % sets automatic line breaking
breakatwhitespace=true, % sets if automatic breaks should only happen at whitespace
title=\color{white}\lstname, % show the filename of files included with \lstinputlisting;
basicstyle=\color{normal}\ttfamily, % sets font style for the code
keywordstyle=\color{magenta}\ttfamily, % sets color for keywords
stringstyle=\color{string}\ttfamily, % sets color for strings
commentstyle=\color{comment}\ttfamily, % sets color for comments
emph={format_string, eff_ana_bf, permute, eff_ana_btr},
emphstyle=\color{identifier}\ttfamily
}
\usepackage{framed}
\definecolor{shadecolor}{named}{background}
\newcommand{\pythonBlock}[1]
{
\begin{shaded}
\lstinputlisting[style=monokaiPython]{#1}
\end{shaded}
}