% Matematikk-pakke av Svein Olav Nyberg
% Modifisert litt av Rune B. Kalleberg

\usepackage[latin1]{inputenc}
\usepackage{graphpap}
\usepackage{epsfig}
\usepackage{graphics}
\usepackage{ifthen}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{color}
\usepackage{pict2e}
\usepackage{mathabx}
\usepackage{stmaryrd}
\usepackage{MnSymbol}
\usepackage{enumerate}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage{verbatim}


\definecolor{darkgreen}{rgb}{0,0.4,0.2}
\newcommand{\darkgreen}[1]{{\color{darkgreen}}}

\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}

\newcommand{\Lim}{\displaystyle\lim}
\newcommand{\Limn}{\Lim_{n\to\infty}}
\newcommand{\Limi}[1]{\Lim_{#1\to\infty}}
\newcommand{\limt}[2]{\lim_{(x,y)\to(#1,#2)}}
\newcommand{\Limt}[2]{\Lim_{(x,y)\to(#1,#2)}}
\newcommand{\LimM}[3]{\Lim_{\stackrel{(x,y)\to(#1,#2)}{#3}}}
\newcommand{\LimT}{\Limt{x_0}{y_0}}
\newcommand{\Sum}{\displaystyle\sum}
\newcommand{\Sumi}[1]{\Sum_{i=#1}^{\infty}}
\newcommand{\Summ}[1]{\Sum_{n=#1}^{\infty}}
\newcommand{\Sumn}[2]{\Sum_{i=#1}^{#2}}
\newcommand{\Int}{\displaystyle\int}
\newcommand{\Inti}[1]{\Int_{#1}^{\infty}}
\newcommand{\Intn}[2]{\Int_{#1}^{#2}}
\newcommand{\IntL}[1]{\Int_{-#1}^{#1}}

\renewcommand \thepart {\Alph{part}}
\newcommand{\cv}[1]{\mathbf{#1}}
 \newcommand{\limp}{\Rightarrow}     % logical implication
 \newcommand{\leqv}{\Leftrightarrow} % logical equivalence
 \newcommand{\cand}{\wedge}          % connective: and
 \newcommand{\cor}{\vee}             % connective: inclusive or
 \newcommand{\cxor}{\underline{\vee}}% connective: exclusive or
 \newcommand{\cimp}{\Rightarrow}     % connective: implication
 \newcommand{\ceqv}{\Leftrightarrow} % connective: equivalence uncomment line 220

\newtheorem{teorem}{Teorem}
\newtheorem{lemma}{Lemma}      
\newtheorem{proposisjon}{Proposition}      
\newtheorem{conjecture}{Conjecture}      
\newtheorem{assumption}{Assumption}      
\newtheorem{remark}{Remark}      
\newtheorem{kor}{Corollary}      
\newtheorem{defi}{Definisjon}
\newtheorem{axiom}{Axiom}%[section]
 

\def\be{\begin{equation}}
\def\ee{\end{equation}}
\def\bea{\begin{eqnarray}}
\def\eea{\end{eqnarray}}
\def\beas{\begin{eqnarray*}}
\def\eeas{\end{eqnarray*}}
\def\ben{\begin{enumerate}}
\def\een{\end{enumerate}}
\def\ba{\begin{array}}
\def\ea{\end{array}}
\def\bar{\begin{array}{rcl}}
\def\ear{\end{array}}
\def\barb{\begin{array}{rcll}}
\def\earb{\end{array}}
\def\bt{\begin{teorem}}
\def\et{\end{teorem}}
\def\br{\begin{regel}}
\def\er{\end{regel}}
\def\bl{\begin{lemma}}
\def\el{\end{lemma}}
\def\bd{\begin{defi}}
\def\ed{\end{defi}}
\def\bb{\begin{bevis}}
\def\eb{\end{bevis}}

\newenvironment{example}{{\bf Eksempel:}\quad}{\hfill$\Box$\\}
\def\bex{\begin{example}}
\def\eex{\end{example}} 

\newenvironment{inbook}{{\bf I boka:}\quad}{\hfill$\clubsuit$.\\}
\def\bebk{\begin{inbook}}
\def\eebk{\end{inbook}} 

\newenvironment{lectured}{{\bf Forelest:}\quad}{\hfill$\spadesuit$\\}
\def\belc{\begin{lectured}}
\def\eelc{\end{lectured}} 

\newenvironment{therule}{{\bf Regel/Formel:}\quad}{\hfill$\Diamond$\\}
\def\berg{\begin{therule}}
\def\eerg{\end{therule}} 

\newenvironment{method}{{\bf Metode:}\quad}{\hfill$\Diamond$\\}
\def\bemt{\begin{method}}
\def\eemt{\end{method}} 

\newenvironment{bruk}{{\bf Bruksomrï¿½de:}\quad}{\hfill$\Diamond$\\}
\def\bebr{\begin{bruk}}
\def\eebr{\end{bruk}} 

\newenvironment{motive}{{\bf Motivasjon:}\quad}{\hfill$\Diamond$\\}
\def\bemo{\begin{motive}}
\def\eemo{\end{motive}} 

\newenvironment{feil}{{\bf Feil å passe seg for:}\quad}{\hfill$\Diamond$\\}
\def\befl{\begin{feil}}
\def\eefl{\end{feil}} 



\newcommand{\arr}[1]{\[ \begin{array}{ll} #1 \end{array} \]}
\newcommand{\bear}[1]{\beas\barr{#1}}
\newcommand{\eear}{\earr\eeas}

\newcommand{\twovec}[2]{\left[\begin{array}{r} #1 \\ #2 \end{array}\right]}
\newcommand{\threevec}[3]{\left[\begin{array}{r} #1 \\ #2 \\ #3 \end{array}\right]}
\newcommand{\fourvec}[4]{\left[\begin{array}{r} #1 \\ #2 \\ #3 \\ #4 \end{array}\right]}

\newcommand{\myrule}{\rule[-3mm]{0mm}{5mm}}

\newcommand{\parameq}[2]{\left\{ \begin{array}{ll}#1\\#2\end{array} \right. \] }

\newcommand{\vectwo}[2]{\begin{array}{r} #1 \\ #2 \end{array}}
\newcommand{\vecthree}[3]{\begin{array}{r} #1 \\ #2 \\ #3 \end{array}}
\newcommand{\vecthreex}[3]{\begin{array}{r} #1 \myrule \\ #2 \myrule \\ #3 \myrule \end{array}}
\newcommand{\vecfour}[4]{\begin{array}{r} #1 \\ #2 \\ #3 \\ #4 \end{array}}

\newcommand{\twomatrix}[4]{\left[\begin{array}{rr} #1 & #2 \\ #3 & #4 \end{array}\right]}
\newcommand{\threetwomatrix}[6]{\left[\begin{array}{rr} #1 & #2 \\ #3 & #4 \\ #5 & #6 \end{array}\right]}
\newcommand{\twothreematrix}[6]{\left[\begin{array}{rrr} #1 & #2 & #3 \\ #4 & #5 & #6 \end{array}\right]}
\newcommand{\threematrix}[9]{\left[\begin{array}{rrr} #1 & #2 & #3 \\ #4 & #5 & #6 \\ #7 & #8 & #9 \end{array}\right]}

\newcommand{\matrixA}{\threematrix{1}{2}{3}{4}{5}{6}{7}{8}{8}}
\newcommand{\matrixB}{\threematrix{5}{5}{5}{2}{2}{2}{1}{1}{1}}
\newcommand{\matrixC}{\twothreematrix{1}{3}{5}{0}{2}{-4}}


\newcommand{\veetwo}[2]{\begin{array}{l} #1 \\ #2 \end{array}}
\newcommand{\veethree}[3]{\begin{array}{l} #1 \\ #2 \\ #3 \end{array}}
\newcommand{\veethreex}[3]{\begin{array}{l} #1 \myrule \\ #2 \myrule \\ #3 \myrule \end{array}}
\newcommand{\veefour}[4]{\begin{array}{l} #1 \\ #2 \\ #3 \\ #4 \end{array}}

\newcommand{\myStrut}{\vectwo{\updownline\vspace{-3mm}}{\updownline\vspace{-2mm}}}
\newcommand{\myTopStart}{\lcurvearrowse\vspace{-2mm}}
\newcommand{\myBotStart}{\rcurvearrowne}
\newcommand{\myBotEnd}{\lcurvearrowsw}
\newcommand{\myTopEnd}{\rcurvearrownw\vspace{-2mm}}

\newcommand{\sizethreeaddonetothree}[1]{{\color{darkgreen}\veethree{\myTopStart}{\myStrut}{\lcurvearrowsw}}}

\newcommand{\outsideAddSymbolDown}[4]{
\ifthenelse{\equal{#1}{#2}}{\myTopStart \cdot #4 }{}
\ifthenelse{ #1>#2 \and #1<#3 }{\myStrut}{}
\ifthenelse{\equal{#1}{#3}}{\myBotEnd}{}
}

\newcommand{\outsideAddSymbolUp}[4]{
\ifthenelse{\equal{#1}{#3}}{\myTopEnd}{}
\ifthenelse{ #1>#3 \and #1<#2 }{\myStrut}{}
\ifthenelse{\equal{#1}{#2}}{\myBotStart \cdot #4 }{}
}

\newcommand{\outsideAddSymbol}[4]{
\ifthenelse{#2<#3}{\outsideAddSymbolDown{#1}{#2}{#3}{#4}}{\outsideAddSymbolUp{#1}{#2}{#3}{#4}}
}

\newcommand{\addLineToLine}[4]{{\color{darkgreen}
\begin{array}{l}
\outsideAddSymbol{1}{#2}{#3}{#4} 
\ifthenelse{#1>1}{\\ \outsideAddSymbol{2}{#2}{#3}{#4} }{}
\ifthenelse{#1>2}{\\ \outsideAddSymbol{3}{#2}{#3}{#4} }{}
\ifthenelse{#1>3}{\\ \outsideAddSymbol{4}{#2}{#3}{#4} }{}
\ifthenelse{#1>4}{\\ \outsideAddSymbol{5}{#2}{#3}{#4} }{}
\ifthenelse{#1>5}{\\ \outsideAddSymbol{6}{#2}{#3}{#4} }{}
\ifthenelse{#1>6}{\\ \outsideAddSymbol{7}{#2}{#3}{#4} }{}
\ifthenelse{#1>7}{\\ \outsideAddSymbol{8}{#2}{#3}{#4} }{}
\ifthenelse{#1>8}{\\ \outsideAddSymbol{9}{#2}{#3}{#4} }{}
\end{array}
}}






\newcommand{\outsideSwapSymbolChoice}[3]{
\ifthenelse{\equal{#1}{#2}}{\myTopEnd }{}
\ifthenelse{ #1>#2 \and #1<#3 }{\myStrut}{}
\ifthenelse{\equal{#1}{#3}}{\myBotEnd}{}
}

\newcommand{\outsideSwapSymbol}[3]{
\ifthenelse{#2<#3}{\outsideSwapSymbolChoice{#1}{#2}{#3}}{\outsideSwapSymbolChoice{#1}{#3}{#2}}
}

\newcommand{\swapLines}[3]{{\color{darkgreen}
\begin{array}{l}
\outsideSwapSymbol{1}{#2}{#3} 
\ifthenelse{#1>1}{\\ \outsideSwapSymbol{2}{#2}{#3} }{}
\ifthenelse{#1>2}{\\ \outsideSwapSymbol{3}{#2}{#3} }{}
\ifthenelse{#1>3}{\\ \outsideSwapSymbol{4}{#2}{#3} }{}
\ifthenelse{#1>4}{\\ \outsideSwapSymbol{5}{#2}{#3} }{}
\ifthenelse{#1>5}{\\ \outsideSwapSymbol{6}{#2}{#3} }{}
\ifthenelse{#1>6}{\\ \outsideSwapSymbol{7}{#2}{#3} }{}
\ifthenelse{#1>7}{\\ \outsideSwapSymbol{8}{#2}{#3} }{}
\ifthenelse{#1>8}{\\ \outsideSwapSymbol{9}{#2}{#3} }{}
\end{array}
}}





\newcommand{\outsideMultiplySymbol}[3]{
\ifthenelse{\equal{#1}{#2}}{\cdot #3}{}
}

\newcommand{\multiplyLine}[3]{{\color{darkgreen}
\begin{array}{l}
\outsideMultiplySymbol{1}{#2}{#3} 
\ifthenelse{#1>1}{\\ \outsideMultiplySymbol{2}{#2}{#3} }{}
\ifthenelse{#1>2}{\\ \outsideMultiplySymbol{3}{#2}{#3} }{}
\ifthenelse{#1>3}{\\ \outsideMultiplySymbol{4}{#2}{#3} }{}
\ifthenelse{#1>4}{\\ \outsideMultiplySymbol{5}{#2}{#3} }{}
\ifthenelse{#1>5}{\\ \outsideMultiplySymbol{6}{#2}{#3} }{}
\ifthenelse{#1>6}{\\ \outsideMultiplySymbol{7}{#2}{#3} }{}
\ifthenelse{#1>7}{\\ \outsideMultiplySymbol{8}{#2}{#3} }{}
\ifthenelse{#1>8}{\\ \outsideMultiplySymbol{9}{#2}{#3} }{}
\end{array}
}}




\newcommand{\Lap}[1]{{\cal L}\left\{ #1 \right\}}
\newcommand{\Lapi}[1]{{\cal L}^{-1}\left\{ #1 \right\}}

\newcommand{\answer}[1]{\underline{\underline{#1}}}

\setlength{\unitlength}{5mm}
\renewcommand \thepart {\Alph{part}}
\setlength{\textwidth}{16cm}
\setlength{\oddsidemargin}{0.5cm}
\setlength{\evensidemargin}{0.5cm}

\setlength{\leftmargin}{1.3cm}
\setlength{\rightmargin}{0.5cm}

\newcommand{\tablestrut}{\rule[-3mm]{0mm}{8mm}}
\newcommand{\bigtablestrut}{\rule[-4mm]{0mm}{10mm}}
\newcommand{\Bigtablestrut}{\rule[-5mm]{0mm}{12mm}}
\newcommand{\BIGtablestrut}{\rule[-6mm]{0mm}{14mm}}

\newcommand{\D}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\Dx}[1]{\D{#1}{x}}
\newcommand{\Dy}[1]{\D{#1}{y}}
\newcommand{\Dz}[1]{\D{#1}{z}}
\newcommand{\Dfx}{\Dx{f}}
\newcommand{\Dfy}{\Dy{f}}
\newcommand{\Dfz}{\Dz{f}}
