# Kerja Gaya Gesek

Marshanda Tiana Sarjito
10219066
mrshndtianasarjito@gmail.com
https://github.com/MarshandaTiana

Kerja yang dilakukan oleh gaya gesek merupakan bentuk kerja yang tidak diharapkan karena energi yang dikeluarkan, biasanya dalam bentuk panas atau bunyi yang dilepas ke lingkungan, tidak dapat dimanfaatkan lagi oleh sistem sehingga energi sistem berkurang.

## Gerak Benda di Atas Lantai Mendatar Kasar

Sistem yang ditinjau adalah suatu benda yang bergerak di atas lantai mendatar kasar. Benda diberi kecepatan awal tertentu dan bergerak melambat sampai berhenti karena adanya gaya gesek kinetis antara benda dan lantai kasar.

### Parameter

Beberapa parameter yang digunakan adalah seperti pada tabel berikut ini.

Tabel 1. Simbol beserta satuan dan artinya

Simbol | Satuan | Arti
:-: | :-: | :-
$t$ | s | waktu
$v_0$ | m/s | kecepatan awal
$x_0$ | m | posisi awal
$v$ | m/s | kecepatan saat $t$
$x$ | m | posisi saat $t$
$a$ | m/s$^2$ | percepatan
$\mu_k$ | - | koefisien gesek kinetis
$f_k$ | N | gaya gesek kinetis
$m$ | kg | massa benda
$F$ | N | total gaya yang bekerja
$N$ | N | gaya normal
$w$ | N | gaya gravitasi

Simbol-simbol pada Tabel 1 akan diberi nilai kemudian saat diimplementasikan dalam program.

## Persamaan

Persamaan-persamaan yang akan digunakan adalah seperti dicantumkan pada bagian ini.

### Kinematika

Hubungan antara antara kecepatan $v$, kecepatan awal $v_0$
, percepatan $a$, dan waktu $t$ diberikan oleh

\begin{equation}\label{eqn1}\tag{1}
v = v_0 + at
\end{equation}

Posisi benda $x$ bergantung pada posisi awal $x_0$, kecepatan awal
$v_0$, percepatan $a$, dan waktu $t$ melalui hubungan

\begin{equation}\label{eqn2}\tag{2}
x = x_0 + v_0t + \frac{1}{2}at^2
\end{equation}

Selain kedua persamaan sebelumnya, terdapat pula persamaan berikut

\begin{equation}\label{eqn3}\tag{3}
v^2 = v_0^2 + 2a(x-x_0)
\end{equation}

yang menghubungkan kecepatan $v$ dengan kecepatan awal $v_0$, percepatan $a$, dan jarak yang ditempuh $x-x_0$.

### Dinamika

Hukum Newton I menyatakan bahwa benda yang semula diam akan tetap diam dan yang semula bergerak dengan kecepatan tetap akan tetap bergerak dengan kecepatan tetap bila tidak ada gaya yang bekerja pada benda atau jumlah gaya-gaya yang bekerja sama dengan nol

\begin{equation}\label{eqn4}\tag{4}
\sum F = 0
\end{equation}

Bila ada gaya yang bekerja pada benda bermassa $m$ atau jumlah gaya-gaya tidak nol

\begin{equation}\label{eqn5}\tag{5}
\sum F = ma
\end{equation}

maka keadaan gerak benda akan berubah melalui percepatan $a$, dengan $m$ > 0 dan $a \neq 0$

### Usaha

Usaha oleh suatu gaya $F$ dengan posisi awal $x_0$ dan posisi akhir $x$ dapat diperoleh melalui

\begin{equation}\label{eqn6}\tag{6}
W = \int_{x_0}^{x} F dx
\end{equation}

atau dengan

\begin{equation}\label{eqn7}\tag{7}
W = \Delta K
\end{equation}

dengan $K$ adalah energi kinetik. Persamaan \eqref{eqn7} akan memberikan gaya oleh semua gaya. Dengan demikian bila $F$ adalah satu-satunya gaya yang bekerja pada benda, maka persamaan ini akan menjadi Persamaan \eqref{eqn6}

## Sistem

Ilustrasi sistem perlu diberikan agar dapat terbayangan dan memudahkan penyelesaian masalah. Selain itu juga perlu disajikan diagram gaya-gaya yang bekerja pada benda.

### Ilustrasi

Sistem yang benda bermassa $m$ bergerak di atas lantai kasar dapat digambarkan seperti berikut ini.

```python
%%html

<svg
   width="320"
   height="140"
   viewBox="0 0 320 140.00001"
   id="svg2"
   version="1.1"
   inkscape:version="1.1.2 (b8e25be833, 2022-02-05)"
   sodipodi:docname="mass-horizontal-rough-surface.svg"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:dc="http://purl.org/dc/elements/1.1/">
  <defs
     id="defs4">
    <marker
       style="overflow:visible"
       id="TriangleOutM"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479" />
    </marker>
    <marker
       style="overflow:visible"
       id="marker11604"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="Arrow2Mend"
       inkscape:isstock="true">
      <path
         transform="scale(-0.6)"
         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.625;stroke-linejoin:round"
         id="path11602" />
    </marker>
    <marker
       style="overflow:visible"
       id="Arrow2Mend"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="Arrow2Mend"
       inkscape:isstock="true">
      <path
         transform="scale(-0.6)"
         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.625;stroke-linejoin:round"
         id="path11361" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-3"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-1" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-35"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-0" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-0"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-4" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-37"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-9" />
    </marker>
  </defs>
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="1.5"
     inkscape:cx="173"
     inkscape:cy="97.333333"
     inkscape:document-units="px"
     inkscape:current-layer="layer1"
     showgrid="false"
     inkscape:snap-bbox="false"
     inkscape:snap-global="false"
     units="px"
     showborder="true"
     inkscape:showpageshadow="true"
     borderlayer="false"
     inkscape:window-width="1366"
     inkscape:window-height="705"
     inkscape:window-x="-8"
     inkscape:window-y="-8"
     inkscape:window-maximized="1"
     inkscape:pagecheckerboard="0">
    <inkscape:grid
       type="xygrid"
       id="grid970" />
  </sodipodi:namedview>
  <metadata
     id="metadata7">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Layer 1"
     inkscape:groupmode="layer"
     id="layer1"
     transform="translate(0,-732.36216)">
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="120.0725"
       y="759.6109"
       id="text2711-6-2-9"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2"
         x="120.0725"
         y="759.6109"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '"><tspan
           style="font-style:italic"
           id="tspan9923">v</tspan><tspan
           style="font-size:65%;baseline-shift:sub"
           id="tspan1668">0</tspan></tspan></text>
    <path
       style="fill:none;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM)"
       d="m 84.656156,757.55169 25.738704,1.3e-4"
       id="path11252" />
    <rect
       style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-opacity:1"
       id="rect1007"
       width="59"
       height="59"
       x="56.5"
       y="772.86218"
       rx="0"
       ry="0" />
    <path
       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
       d="m 20,832.86218 280,-2e-5"
       id="path1386" />
    <rect
       style="fill:#ffffff;fill-opacity:1;stroke:#c8c8c8;stroke-width:0.5;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:2, 2;stroke-dashoffset:0;stroke-opacity:1"
       id="rect1007-2"
       width="59"
       height="59"
       x="225.16667"
       y="772.86218"
       rx="0"
       ry="0" />
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#c8c8c8;fill-opacity:1;stroke:none"
       x="236.05922"
       y="759.6109"
       id="text2711-6-2-9-9"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-8"
         x="236.05922"
         y="759.6109"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, ';fill:#c8c8c8;fill-opacity:1"><tspan
   style="font-style:italic;fill:#c8c8c8;fill-opacity:1"
   id="tspan9923-8">v</tspan> = 0</tspan></text>
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="149.18359"
       y="824.54877"
       id="text2711-6-2-9-96"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-6"
         x="149.18359"
         y="824.54877"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '"><tspan
   style="font-style:italic"
   id="tspan3028">μ<tspan
   style="font-size:65%;baseline-shift:sub"
   id="tspan3074">k</tspan></tspan> > 0</tspan></text>
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="79.505844"
       y="806.37714"
       id="text2711-6-2-9-2"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-84"
         x="79.505844"
         y="806.37714"
         style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '">m</tspan></text>
    <path
       style="fill:none;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-37)"
       d="m 33.785239,770.82609 -1.3e-4,25.7387"
       id="path11252-5" />
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="29.173132"
       y="759.45776"
       id="text2711-6-2-9-8"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-2"
         x="29.173132"
         y="759.45776"
         style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '">g</tspan></text>
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="79.368446"
       y="849.21539"
       id="text2711-6-2-9-23"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-3"
         x="79.368446"
         y="849.21539"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '"><tspan
           style="font-style:italic"
           id="tspan9923-0">x</tspan><tspan
           style="font-size:65%;baseline-shift:sub"
           id="tspan1668-9">0</tspan></tspan></text>
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="250.91145"
       y="849.21539"
       id="text2711-6-2-9-23-0"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-3-0"
         x="250.91145"
         y="849.21539"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '"><tspan
           style="font-style:italic"
           id="tspan9923-0-3">x</tspan><tspan
           style="font-size:65%;baseline-shift:sub"
           id="tspan1668-9-3" /></tspan></text>
  </g>
</svg>

<br/>

Gambar <a name='fig1'>1</a>. Sistem benda bermassa $m$ begerak di atas lantai
mendatar kasar dengan koefisien gesek kinetis $\mu_k$.
```

<svg
   width="320"
   height="140"
   viewBox="0 0 320 140.00001"
   id="svg2"
   version="1.1"
   inkscape:version="1.1.2 (b8e25be833, 2022-02-05)"
   sodipodi:docname="mass-horizontal-rough-surface.svg"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:dc="http://purl.org/dc/elements/1.1/">
  <defs
     id="defs4">
    <marker
       style="overflow:visible"
       id="TriangleOutM"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479" />
    </marker>
    <marker
       style="overflow:visible"
       id="marker11604"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="Arrow2Mend"
       inkscape:isstock="true">
      <path
         transform="scale(-0.6)"
         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.625;stroke-linejoin:round"
         id="path11602" />
    </marker>
    <marker
       style="overflow:visible"
       id="Arrow2Mend"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="Arrow2Mend"
       inkscape:isstock="true">
      <path
         transform="scale(-0.6)"
         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.625;stroke-linejoin:round"
         id="path11361" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-3"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-1" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-35"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-0" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-0"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-4" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-37"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-9" />
    </marker>
  </defs>
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="1.5"
     inkscape:cx="173"
     inkscape:cy="97.333333"
     inkscape:document-units="px"
     inkscape:current-layer="layer1"
     showgrid="false"
     inkscape:snap-bbox="false"
     inkscape:snap-global="false"
     units="px"
     showborder="true"
     inkscape:showpageshadow="true"
     borderlayer="false"
     inkscape:window-width="1366"
     inkscape:window-height="705"
     inkscape:window-x="-8"
     inkscape:window-y="-8"
     inkscape:window-maximized="1"
     inkscape:pagecheckerboard="0">
    <inkscape:grid
       type="xygrid"
       id="grid970" />
  </sodipodi:namedview>
  <metadata
     id="metadata7">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Layer 1"
     inkscape:groupmode="layer"
     id="layer1"
     transform="translate(0,-732.36216)">
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="120.0725"
       y="759.6109"
       id="text2711-6-2-9"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2"
         x="120.0725"
         y="759.6109"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '"><tspan
           style="font-style:italic"
           id="tspan9923">v</tspan><tspan
           style="font-size:65%;baseline-shift:sub"
           id="tspan1668">0</tspan></tspan></text>
    <path
       style="fill:none;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM)"
       d="m 84.656156,757.55169 25.738704,1.3e-4"
       id="path11252" />
    <rect
       style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-opacity:1"
       id="rect1007"
       width="59"
       height="59"
       x="56.5"
       y="772.86218"
       rx="0"
       ry="0" />
    <path
       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
       d="m 20,832.86218 280,-2e-5"
       id="path1386" />
    <rect
       style="fill:#ffffff;fill-opacity:1;stroke:#c8c8c8;stroke-width:0.5;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:2, 2;stroke-dashoffset:0;stroke-opacity:1"
       id="rect1007-2"
       width="59"
       height="59"
       x="225.16667"
       y="772.86218"
       rx="0"
       ry="0" />
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#c8c8c8;fill-opacity:1;stroke:none"
       x="236.05922"
       y="759.6109"
       id="text2711-6-2-9-9"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-8"
         x="236.05922"
         y="759.6109"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, ';fill:#c8c8c8;fill-opacity:1"><tspan
   style="font-style:italic;fill:#c8c8c8;fill-opacity:1"
   id="tspan9923-8">v</tspan> = 0</tspan></text>
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="149.18359"
       y="824.54877"
       id="text2711-6-2-9-96"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-6"
         x="149.18359"
         y="824.54877"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '"><tspan
   style="font-style:italic"
   id="tspan3028">μ<tspan
   style="font-size:65%;baseline-shift:sub"
   id="tspan3074">k</tspan></tspan> > 0</tspan></text>
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="79.505844"
       y="806.37714"
       id="text2711-6-2-9-2"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-84"
         x="79.505844"
         y="806.37714"
         style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '">m</tspan></text>
    <path
       style="fill:none;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-37)"
       d="m 33.785239,770.82609 -1.3e-4,25.7387"
       id="path11252-5" />
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="29.173132"
       y="759.45776"
       id="text2711-6-2-9-8"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-2"
         x="29.173132"
         y="759.45776"
         style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '">g</tspan></text>
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="79.368446"
       y="849.21539"
       id="text2711-6-2-9-23"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-3"
         x="79.368446"
         y="849.21539"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '"><tspan
           style="font-style:italic"
           id="tspan9923-0">x</tspan><tspan
           style="font-size:65%;baseline-shift:sub"
           id="tspan1668-9">0</tspan></tspan></text>
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="250.91145"
       y="849.21539"
       id="text2711-6-2-9-23-0"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-3-0"
         x="250.91145"
         y="849.21539"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '"><tspan
           style="font-style:italic"
           id="tspan9923-0-3">x</tspan><tspan
           style="font-size:65%;baseline-shift:sub"
           id="tspan1668-9-3" /></tspan></text>
  </g>
</svg>

<br/>

Gambar <a name='fig1'>1</a>. Sistem benda bermassa $m$ begerak di atas lantai
mendatar kasar dengan koefisien gesek kinetis $\mu_k$.

Keadaan akhir benda, yaitu saat kecepatan $v=0$ diberikan pada bagian kanan Gambar 1 dengan warna abu-abu.

### Diagram Gaya

Diagram gaya-gaya yang berja pada benda perlu dibuat berdasarkan informasi dari Gambar 1 dan Tabel 1, yang diberikan berikut ini.

```python
%%html

<svg
   width="320"
   height="200"
   viewBox="0 0 320 200.00001"
   id="svg2"
   version="1.1"
   inkscape:version="1.1.2 (b8e25be833, 2022-02-05)"
   sodipodi:docname="mass-horizontal-rough-surface-fbd.svg"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:dc="http://purl.org/dc/elements/1.1/">
  <defs
     id="defs4">
    <marker
       style="overflow:visible"
       id="TriangleOutM"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479" />
    </marker>
    <marker
       style="overflow:visible"
       id="marker11604"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="Arrow2Mend"
       inkscape:isstock="true">
      <path
         transform="scale(-0.6)"
         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.625;stroke-linejoin:round"
         id="path11602" />
    </marker>
    <marker
       style="overflow:visible"
       id="Arrow2Mend"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="Arrow2Mend"
       inkscape:isstock="true">
      <path
         transform="scale(-0.6)"
         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.625;stroke-linejoin:round"
         id="path11361" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-3"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-1" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-35"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-0" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-0"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-4" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-37"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-9" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-9"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-8" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-9-3"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-8-3" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-37-5"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-9-9" />
    </marker>
  </defs>
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="1.2079428"
     inkscape:cx="159.36185"
     inkscape:cy="35.597712"
     inkscape:document-units="px"
     inkscape:current-layer="layer1"
     showgrid="false"
     inkscape:snap-bbox="false"
     inkscape:snap-global="false"
     units="px"
     showborder="true"
     inkscape:showpageshadow="true"
     borderlayer="false"
     inkscape:window-width="1366"
     inkscape:window-height="705"
     inkscape:window-x="-8"
     inkscape:window-y="-8"
     inkscape:window-maximized="1"
     inkscape:pagecheckerboard="0">
    <inkscape:grid
       type="xygrid"
       id="grid970" />
  </sodipodi:namedview>
  <metadata
     id="metadata7">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Layer 1"
     inkscape:groupmode="layer"
     id="layer1"
     transform="translate(0,-732.36216)">
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="148.01953"
       y="766.72156"
       id="text2711-6-2-9-23"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-3"
         x="148.01953"
         y="766.72156"
         style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '">N</tspan></text>
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="251.40584"
       y="806.94421"
       id="text2711-6-2-9"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2"
         x="251.40584"
         y="806.94421"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '"><tspan
           style="font-style:italic"
           id="tspan9923">v</tspan><tspan
           style="font-size:65%;baseline-shift:sub"
           id="tspan1668" /></tspan></text>
    <path
       style="fill:none;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM)"
       d="m 215.98949,804.88502 25.7387,1.3e-4"
       id="path11252" />
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="153.68098"
       y="915.71051"
       id="text2711-6-2-9-2"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-84"
         x="153.68098"
         y="915.71051"
         style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '">w</tspan></text>
    <path
       style="fill:none;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-37)"
       d="m 31.113403,791.97918 -1.3e-4,25.7387"
       id="path11252-5" />
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="26.501303"
       y="780.6109"
       id="text2711-6-2-9-8"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-2"
         x="26.501303"
         y="780.6109"
         style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '">g</tspan></text>
    <rect
       style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-opacity:1"
       id="rect1007"
       width="59"
       height="59"
       x="130.5"
       y="792.86218"
       rx="0"
       ry="0" />
    <g
       id="g1363"
       transform="translate(-6,20)">
      <path
         style="fill:none;stroke:#ff0000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-9)"
         d="m 161.00001,831.69534 -45.73871,1.3e-4"
         id="path11252-4" />
      <path
         style="fill:none;stroke:#0000ff;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-9-3)"
         d="m 160.79738,832.36215 -1.3e-4,-75.7387"
         id="path11252-4-6" />
    </g>
    <path
       style="fill:none;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-37-5)"
       d="m 159.99967,822.02879 3.4e-4,75.73871"
       id="path11252-5-0" />
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="85.624084"
       y="854.51099"
       id="text2711-6-2-9-8-4"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-2-1"
         x="85.624084"
         y="854.51099"
         style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '">f<tspan
   style="font-size:65%;baseline-shift:sub"
   id="tspan2197">k</tspan></tspan></text>
  </g>
</svg>

<br>

Gambar <a name='fig2'>2</a>. Diagram gaya-gaya yang bekerja pada benda
bermassa $m$.
```

<svg
   width="320"
   height="200"
   viewBox="0 0 320 200.00001"
   id="svg2"
   version="1.1"
   inkscape:version="1.1.2 (b8e25be833, 2022-02-05)"
   sodipodi:docname="mass-horizontal-rough-surface-fbd.svg"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:dc="http://purl.org/dc/elements/1.1/">
  <defs
     id="defs4">
    <marker
       style="overflow:visible"
       id="TriangleOutM"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479" />
    </marker>
    <marker
       style="overflow:visible"
       id="marker11604"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="Arrow2Mend"
       inkscape:isstock="true">
      <path
         transform="scale(-0.6)"
         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.625;stroke-linejoin:round"
         id="path11602" />
    </marker>
    <marker
       style="overflow:visible"
       id="Arrow2Mend"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="Arrow2Mend"
       inkscape:isstock="true">
      <path
         transform="scale(-0.6)"
         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.625;stroke-linejoin:round"
         id="path11361" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-3"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-1" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-35"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-0" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-0"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-4" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-37"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-9" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-9"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-8" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-9-3"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-8-3" />
    </marker>
    <marker
       style="overflow:visible"
       id="TriangleOutM-37-5"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="TriangleOutM"
       inkscape:isstock="true">
      <path
         transform="scale(0.4)"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
         d="M 5.77,0 -2.88,5 V -5 Z"
         id="path11479-9-9" />
    </marker>
  </defs>
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="1.2079428"
     inkscape:cx="159.36185"
     inkscape:cy="35.597712"
     inkscape:document-units="px"
     inkscape:current-layer="layer1"
     showgrid="false"
     inkscape:snap-bbox="false"
     inkscape:snap-global="false"
     units="px"
     showborder="true"
     inkscape:showpageshadow="true"
     borderlayer="false"
     inkscape:window-width="1366"
     inkscape:window-height="705"
     inkscape:window-x="-8"
     inkscape:window-y="-8"
     inkscape:window-maximized="1"
     inkscape:pagecheckerboard="0">
    <inkscape:grid
       type="xygrid"
       id="grid970" />
  </sodipodi:namedview>
  <metadata
     id="metadata7">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Layer 1"
     inkscape:groupmode="layer"
     id="layer1"
     transform="translate(0,-732.36216)">
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="148.01953"
       y="766.72156"
       id="text2711-6-2-9-23"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-3"
         x="148.01953"
         y="766.72156"
         style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '">N</tspan></text>
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="251.40584"
       y="806.94421"
       id="text2711-6-2-9"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2"
         x="251.40584"
         y="806.94421"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '"><tspan
           style="font-style:italic"
           id="tspan9923">v</tspan><tspan
           style="font-size:65%;baseline-shift:sub"
           id="tspan1668" /></tspan></text>
    <path
       style="fill:none;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM)"
       d="m 215.98949,804.88502 25.7387,1.3e-4"
       id="path11252" />
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="153.68098"
       y="915.71051"
       id="text2711-6-2-9-2"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-84"
         x="153.68098"
         y="915.71051"
         style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '">w</tspan></text>
    <path
       style="fill:none;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-37)"
       d="m 31.113403,791.97918 -1.3e-4,25.7387"
       id="path11252-5" />
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="26.501303"
       y="780.6109"
       id="text2711-6-2-9-8"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-2"
         x="26.501303"
         y="780.6109"
         style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '">g</tspan></text>
    <rect
       style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-opacity:1"
       id="rect1007"
       width="59"
       height="59"
       x="130.5"
       y="792.86218"
       rx="0"
       ry="0" />
    <g
       id="g1363"
       transform="translate(-6,20)">
      <path
         style="fill:none;stroke:#ff0000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-9)"
         d="m 161.00001,831.69534 -45.73871,1.3e-4"
         id="path11252-4" />
      <path
         style="fill:none;stroke:#0000ff;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-9-3)"
         d="m 160.79738,832.36215 -1.3e-4,-75.7387"
         id="path11252-4-6" />
    </g>
    <path
       style="fill:none;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#TriangleOutM-37-5)"
       d="m 159.99967,822.02879 3.4e-4,75.73871"
       id="path11252-5-0" />
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:18.6667px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
       x="85.624084"
       y="854.51099"
       id="text2711-6-2-9-8-4"><tspan
         sodipodi:role="line"
         id="tspan2709-5-9-2-2-1"
         x="85.624084"
         y="854.51099"
         style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.6667px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, '">f<tspan
   style="font-size:65%;baseline-shift:sub"
   id="tspan2197">k</tspan></tspan></text>
  </g>
</svg>

<br>

Gambar <a name='fig2'>2</a>. Diagram gaya-gaya yang bekerja pada benda
bermassa $m$.

Terlihat bahwa pada arah $y$ terdapat gaya normal $N$ dan gaya gravitasi $w$, sedangkan pada arah $x$ hanya terdapat gaya gesek kinetis $f_k$ yang melawan arah gerak benda. Arah gerak benda diberikan oleh arah kecepatan $v$.

## Metode Numerik

Integrasi suatu fungsi $f(x)$ berbentuk

\begin{equation}\label{eqn8}\tag{8}
A = \int_{a}^{b} f(x) dx
\end{equation}

dapat didekati dengan

\begin{equation}\label{eqn9}\tag{9}
A \approx \sum_{i=0}^{N} f [\frac{1}{2}(x_i+x_{i+1} )]\Delta x
\end{equation}

yang dikenal sebagai metode persegi titik tengah, dimana

\begin{equation}\label{eqn10}\tag{10}
\Delta x = \frac{b-a}{N}
\end{equation}

dengan $N$ adalah jumlah partisi. Variabel $x_i$ pada Persamaan \eqref{eqn9} diberikan oleh

\begin{equation}\label{eqn11}\tag{11}
x_i = a + i\Delta x
\end{equation}

dengan $i = 0,...,N$.

### Penyelesaian

Penerapan 1, 2, 3, 4, dan 5 pada gambar 2 akan menghasilkan

\begin{equation}\label{eqn12}\tag{12}
f_k = \mu_kmg
\end{equation}

dan usahanya adalah

\begin{equation}\label{eqn13}\tag{13}
W = \int_{x_0}^{x} f_k dx
  = \int_{x_0}^{x} \mu_kmg dx
  = mg\int_{x_0}^{x} \mu_k dx
\end{equation}

dengan koefisien gesek statisnya dapat merupakan fungsi dari posisi $\mu_k = \mu_k(x)$

```python
import numpy as np
import matplotlib.pyplot as plt
plt.ion()

# set integral lower and upper bounds
a = 0
b = 1

# generate x
x = [1, 2, 3, 4, 5]

# generate y from numerical integration
y = [1, 2, 3, 5, 6]

## plot results
fig, ax = plt.subplots()
ax.scatter(x, y)
ax.set_xlabel("$x - x^0$")
ax.set_ylabel("y")

from IPython import display
from IPython.core.display import HTML
HTML('''
<div>
Gambar <a name='fig3'>3</a>. Kurva antara usaha $W$ dan jarak tempuh $x - x_0$.
</div>
''')
```

## Diskusi

Berdasarkan Gambar 3 dapat dijelaskan bahwa dengan $\mu_k=\mu_k(x)$ maka kurva $W(x)$ tidak lagi linier karena dipengaruhi oleh sejauh mana perhitungan kerja dilakukan.

## Kesimpulan

Perhitungan kerja dengan $\mu_k=\mu_k(x)$ telah dapat dilakukan

## Referensi

J. A. C. Martins, J. T. Oden, F. M. F. Simões, "A study of static and kinetic friction", International Journal of Engineerting Science, vol 28, no 1, p 29-92, 1990, url https://doi.org/10.1016/0020-7225(90)90014-A.

Carl Rod Nave, "Friction", HyperPhysics, 2017, url http://hyperphysics.phy-astr.gsu.edu/hbase/frict.html#fri [20220419].

Wikipedia contributors, "Friction", Wikipedia, The Free Encyclopedia, 12 April 2022, 00:33 UTC, url https://en.wikipedia.org/w/index.php?oldid=1082223658 [20220419].

Tia Ghose, Ailsa Harvey, "What is friction?", Live Science, 8 Feb 2022, url https://www.livescience.com/37161-what-is-friction.html [20220419].

```python

```


# How to write markdown (.md)

**Markdown** is a lightweight markup language with plain text formatting syntax. <https://en.wikipedia.org/wiki/Markdown>

## Header

Header line is used to specify chapter etc. 1 **#** shows top level header, 2 **##** shows next level and so on.

# Top level header

## 2ne level header

### 3rd level

#### 4th

##### 5th....

## Emphasize and italic

In order to **emphasize** some __words__, quatate the words with __**__ or **__**.

If the words are enclosed with single ```*``` or ```_```, it will become *italic*.

## Code and code block

If the words are enclosed with **back ticks (\`)**, it will treated as a code (command). In order to imbed several lines of code, Triple back tiks are used. Formmatting of markdown is not performed in the code or code blocks. For example `**this is not emphasized**`.

```
# Python Hello world program
print('Hello world')
```

## List

- Unordered list can be written with either **-**, **+** or __*__.

    * this is a sample of unnumbered list line 1
    * line 2
    * line 3

- Ordered List can be written iwth **1.** ... which is automatically renumbered so only **1.** is enough.

    1. Blank like is required before and after List
    1. Space is required after list header character(s)

- HTML `<dl>` tag can be used as well

<dl>
   <dt> Apple </dt>
   <dd>    Red </dd>
   <dt> Banana </dt>
   <dd>    Yellow </dd>
   <dt> Cherry </dt>
   <dd>    Orange or Red </dd>
</dl>

## Blockquates

In order to display quated(copied) contents, ```>``` can be used.

> John Gruber created the Markdown language in 2004 in collaboration with Aaron Swartz on the syntax,[3][4]
> with the goal of enabling people "to write using an easy-to-read, easy-to-write plain text format,
> and optionally convert it to structurally valid XHTML (or HTML)".[5]

> (From wikipedia)

## URL Link

URL link can be written with either `[site name](URL)` or `<URL>`.
For example.

- [Google](https://www.google.com)
- <https://github.com>

## Image

Image file such as JPG or PNG can be embedded with ``.
For example

## Mathematical formula

$\LaTeX$ (LaTex) mathematical rendering is supported in jupyter notebook.

There are several ways to do this

- Enclose with `$` to imbed formula in the text line. $\sqrt{x^2+y^2}$ is a distance from (0,0) to (x,y)

$$ (\int^{b}_{a} f(x) dx = \lim_{n \to \infty} \sum^{n-1}_{i=0} f(x_{i}) \Delta x $$

\begin{align}
\sqrt{a+b}
\end{align}

\begin{equation}
H← 60 + \frac{30(B−R)}{Vmax−Vmin}  , if Vmax = G
\end{equation}

## Graph

There are several ways to draw graph in jupyter notebook. Matplotlib is one of them.

```python
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import math

x = np.linspace(0, math.pi*2, 100)
y = np.sin(x)
plt.plot(x, y)
```


# Calculating Historical Free Cash Flows

In this exercise we will load income statement and balance sheet data and use them to calculate free cash flows.

## Load Financial Statements into `DataFrame`s

First we will use `pandas`' `read_excel` to get the data into `DataFrame`s.

```python
import pandas as pd

all_statements_path = 'Exxon Mobil Corporation NYSE XOM Financials.xls'
```

### Income Statement

```python

inc_df = pd.read_excel(all_statements_path, sheet_name='Income Statement')
```

```python
inc_df.head()
```

      Unnamed: 0
      Dec-31-2014
      Dec-31-2015
      Dec-31-2016
      Dec-31-2017
      Dec-31-2018
      Sep-30-2019

      0

      NaN
      NaN
      NaN
      NaN
      NaN
      NaN

      1
      Revenue
      364763
      239854
      200628
      237162
      279332
      260812

      2
      Other Revenue
      -
      1552
      -
      -
      -
      -

      3
      Total Revenue
      364763
      241406
      200628
      237162
      279332
      260812

      4
      NaN
      NaN
      NaN
      NaN
      NaN
      NaN
      NaN

We can see this is a little messy. We can clean this up first by setting the index to be the first column. You can pass an integer index for a column to say that that column should be used as the index of the `DataFrame`. Here we want this first column, so we will pass `index_col=0` into `read_excel`.

```python
inc_df = pd.read_excel(all_statements_path, sheet_name='Income Statement', index_col=0)
```

```python
inc_df.head()
```

      Dec-31-2014
      Dec-31-2015
      Dec-31-2016
      Dec-31-2017
      Dec-31-2018
      Sep-30-2019

      NaN
      NaN
      NaN
      NaN
      NaN
      NaN

      Revenue
      364763
      239854
      200628
      237162
      279332
      260812

      Other Revenue
      -
      1552
      -
      -
      -
      -

      Total Revenue
      364763
      241406
      200628
      237162
      279332
      260812

      NaN
      NaN
      NaN
      NaN
      NaN
      NaN
      NaN

That's starting to look better. But we can see that there are some empty rows in the data. We can also see that there is a `-` in some values where there should be missing data. We want to remove the rows without any data, but first we want to fill in missing values when there is `-`, so that we can make sure a row of completely `-` would get removed. The missing representation in `pandas` is `NaN`, which we can specify manually through `numpy.nan`.

```python
import numpy as np

inc_df = inc_df.replace('-', np.nan)
inc_df.head()
```

      Dec-31-2014
      Dec-31-2015
      Dec-31-2016
      Dec-31-2017
      Dec-31-2018
      Sep-30-2019

      NaN
      NaN
      NaN
      NaN
      NaN
      NaN

      Revenue
      364763
      239854
      200628
      237162
      279332
      260812

      Other Revenue
      NaN
      1552
      NaN
      NaN
      NaN
      NaN

      Total Revenue
      364763
      241406
      200628
      237162
      279332
      260812

      NaN
      NaN
      NaN
      NaN
      NaN
      NaN
      NaN

Now we can see that those `-` got filled in for missing values. Now we want to remove the rows which have missing data. We can use `dropna` for this purpose. We must be careful to pass `how='all'` to `dropna` though. The default is `how='any'`, which means the row will be dropped if there is any missing value. Here we only want to drop the row if it is entirely missing, so we will use `how='all'`.

```python
inc_df = inc_df.dropna(how='all')
inc_df.head()
```

      Dec-31-2014
      Dec-31-2015
      Dec-31-2016
      Dec-31-2017
      Dec-31-2018
      Sep-30-2019

      Revenue
      364763
      239854
      200628
      237162
      279332
      260812

      Other Revenue
      NaN
      1552
      NaN
      NaN
      NaN
      NaN

      Total Revenue
      364763
      241406
      200628
      237162
      279332
      260812

      Cost Of Goods Sold
      234856
      163605
      132759
      159053
      190752
      181228

      Gross Profit
      129907
      77801
      67869
      78109
      88580
      79584

Now we can see that it has dropped the rows with all missing values, but not `Other Revenue` which has mostly missing values.

Now let's wrap this data cleaning process up into a function, because we're going to want to apply it to the balance sheet data as well.

```python
def load_and_clean_statement_df(statements_path, sheet_name):
    df = pd.read_excel(statements_path, sheet_name=sheet_name, index_col=0)
    df = df.replace('-', np.nan)
    df = df.dropna(how='all')
    return df

inc_df = load_and_clean_statement_df(all_statements_path, 'Income Statement')
inc_df.head()
```

      Dec-31-2014
      Dec-31-2015
      Dec-31-2016
      Dec-31-2017
      Dec-31-2018
      Sep-30-2019

      Revenue
      364763
      239854
      200628
      237162
      279332
      260812

      Other Revenue
      NaN
      1552
      NaN
      NaN
      NaN
      NaN

      Total Revenue
      364763
      241406
      200628
      237162
      279332
      260812

      Cost Of Goods Sold
      234856
      163605
      132759
      159053
      190752
      181228

      Gross Profit
      129907
      77801
      67869
      78109
      88580
      79584

Looks good. Let's use it on the balance sheet.

### Balance Sheet

Since we wrapped all this up in a function, now this process is very easy for the balance sheet.

```python
bs_df = load_and_clean_statement_df(all_statements_path, 'Balance Sheet')
bs_df.head()
```

      2014-12-31
      2015-12-31
      2016-12-31
      2017-12-31
      2018-12-31
      2019-09-30

      Cash And Equivalents
      4616
      3705
      3657
      3177
      3042
      5351

      Total Cash & ST Investments
      4616
      3705
      3657
      3177
      3042
      5351

      Accounts Receivable
      18541
      13243
      16033
      21274
      19638
      25308

      Other Receivables
      9468
      6632
      5361
      4323
      5063
      NaN

      Total Receivables
      28009
      19875
      21394
      25597
      24701
      25308

## Working with the Data - `pandas` Method

Now we want to calculate free cash flow. As a reminder, here are the steps:
- Calculate non-cash expenses
- Calculate increase in working capital
- Calculate capital expenditures
- Calculate free cash flow from net income and the preceding items

### Calculate Non-Cash Expenses

For non-cash expenses, we need to total depreciation, amortization, stock-based compensation, impairment charges, and gains/losses on investments.

To see what we have in the two datasets, we can check the `.index` attribute of the `DataFrame`s.

```python
inc_df.index
```

    Index(['Revenue', 'Other Revenue', '  Total Revenue', 'Cost Of Goods Sold',
           '  Gross Profit', 'Selling General & Admin Exp.',
           'Exploration/Drilling Costs', 'Depreciation & Amort.',
           'Other Operating Expense/(Income)', '  Other Operating Exp., Total',
           '  Operating Income', 'Interest Expense', '  Net Interest Exp.',
           'Income/(Loss) from Affiliates', 'Currency Exchange Gains (Loss)',
           'Other Non-Operating Inc. (Exp.)', '  EBT Excl. Unusual Items',
           'Gain (Loss) On Sale Of Invest.', 'Gain (Loss) On Sale Of Assets',
           'Asset Writedown', '  EBT Incl. Unusual Items', 'Income Tax Expense',
           '  Earnings from Cont. Ops.', '  Net Income to Company',
           'Minority Int. in Earnings', '  Net Income',
           '  NI to Common Incl Extra Items', '  NI to Common Excl. Extra Items',
           'Basic EPS', 'Basic EPS Excl. Extra Items',
           'Weighted Avg. Basic Shares Out.', 'Diluted EPS',
           'Diluted EPS Excl. Extra Items', 'Weighted Avg. Diluted Shares Out.',
           'Normalized Basic EPS', 'Normalized Diluted EPS', 'Dividends per Share',
           'Payout Ratio %', 'Shares per Depository Receipt', 'EBITDA', 'EBITA',
           'EBIT', 'EBITDAR', 'As Reported Total Revenue*', 'Effective Tax Rate %',
           'Normalized Net Income', 'Interest Capitalized',
           'Non-Cash Pension Expense', 'Filing Date', 'Restatement Type',
           'Calculation Type', 'Stock-Based Comp., Unallocated',
           '  Stock-Based Comp., Total'],
          dtype='object')

Looking like we have depreciation, impairment (called asset writedown here) and gains/losses on investments and assets. There is no stock-based compensation so we will exclude that from the calculation.

To get the entire `Series` of data from the `DataFrame` by the `index` value, we can use `.loc` on the `DataFrame`.

```python
inc_df.loc['Asset Writedown']
```

    Dec-31-2014      NaN
    Dec-31-2015      NaN
    Dec-31-2016    -3600
    Dec-31-2017    -2000
    Dec-31-2018     -700
    Sep-30-2019     -700
    Name: Asset Writedown, dtype: object

That gives us each year's impairment. Notice that it's negative though, representing an expense. The calculation assumes it is positive. We can make it positive by using `abs` (absolute value).

```python
abs(inc_df.loc['Asset Writedown'])
```

    Dec-31-2014     NaN
    Dec-31-2015     NaN
    Dec-31-2016    3600
    Dec-31-2017    2000
    Dec-31-2018     700
    Sep-30-2019     700
    Name: Asset Writedown, dtype: object

We can do math directly with `Series`.

```python
inc_df.loc['Depreciation & Amort.']
```

    Dec-31-2014    17297
    Dec-31-2015    18048
    Dec-31-2016    18708
    Dec-31-2017    17893
    Dec-31-2018    18045
    Sep-30-2019    18403
    Name: Depreciation & Amort., dtype: object

```python
inc_df.loc['Depreciation & Amort.'] + abs(inc_df.loc['Asset Writedown'])
```

    Dec-31-2014      NaN
    Dec-31-2015      NaN
    Dec-31-2016    22308
    Dec-31-2017    19893
    Dec-31-2018    18745
    Sep-30-2019    19103
    dtype: object

But what we notice is that if any value is missing, then it will cause the final calculation to be missing. This is not what we want. We want it to assume it is zero if it is missing. So let's fill the `DataFrame`s with zeroes if they are missing. We can do this using `fillna`.

```python
inc_df = inc_df.fillna(0)
bs_df = bs_df.fillna(0)
```

```python
abs(inc_df.loc['Asset Writedown'])
```

    Dec-31-2014       0
    Dec-31-2015       0
    Dec-31-2016    3600
    Dec-31-2017    2000
    Dec-31-2018     700
    Sep-30-2019     700
    Name: Asset Writedown, dtype: object

```python
inc_df.loc['Depreciation & Amort.'] + abs(inc_df.loc['Asset Writedown'])
```

    Dec-31-2014    17297
    Dec-31-2015    18048
    Dec-31-2016    22308
    Dec-31-2017    19893
    Dec-31-2018    18745
    Sep-30-2019    19103
    dtype: object

Now we are getting the type of result we want. Let's go ahead and do the full calculation.

```python
non_cash_expenses = (
    inc_df.loc['Depreciation & Amort.'] +
    abs(inc_df.loc['Asset Writedown']) +
    inc_df.loc['Gain (Loss) On Sale Of Invest.'] +
    inc_df.loc['Gain (Loss) On Sale Of Assets']
)  # NOTE: split onto multiple lines for readability, it would function exactly the same on one line without parentheses
```

```python
non_cash_expenses
```

    Dec-31-2014    20443
    Dec-31-2015    18232
    Dec-31-2016    23990
    Dec-31-2017    20227
    Dec-31-2018    20738
    Sep-30-2019    21096
    dtype: object

## Calculate Increase in Working Capital

First we need to calculate the net working capial, then calculate the change in that. Here we need balance sheet data, so let's look at the `index` there.

```python
bs_df.index
```

    Index(['Cash And Equivalents', '  Total Cash & ST Investments',
           'Accounts Receivable', 'Other Receivables', '  Total Receivables',
           'Inventory', 'Deferred Tax Assets, Curr.', 'Restricted Cash',
           'Other Current Assets', '  Total Current Assets',
           'Gross Property, Plant & Equipment', 'Accumulated Depreciation',
           '  Net Property, Plant & Equipment', 'Long-term Investments',
           'Deferred Tax Assets, LT', 'Other Long-Term Assets', 'Total Assets',
           'Accounts Payable', 'Accrued Exp.', 'Short-term Borrowings',
           'Curr. Port. of LT Debt', 'Curr. Port. of Cap. Leases',
           'Curr. Income Taxes Payable', 'Other Current Liabilities',
           '  Total Current Liabilities', 'Long-Term Debt', 'Capital Leases',
           'Pension & Other Post-Retire. Benefits',
           'Def. Tax Liability, Non-Curr.', 'Other Non-Current Liabilities',
           'Total Liabilities', 'Common Stock', 'Retained Earnings',
           'Treasury Stock', 'Comprehensive Inc. and Other',
           '  Total Common Equity', 'Minority Interest', 'Total Equity',
           'Total Liabilities And Equity', 'Total Shares Out. on Filing Date',
           'Total Shares Out. on Balance Sheet Date', 'Book Value/Share',
           'Tangible Book Value', 'Tangible Book Value/Share', 'Total Debt',
           'Net Debt', 'Debt Equiv. of Unfunded Proj. Benefit Obligation',
           'Debt Equivalent Oper. Leases', 'Total Minority Interest',
           'Equity Method Investments', 'Inventory Method', 'LIFO Reserve',
           'Raw Materials Inventory', 'Finished Goods Inventory',
           'Full Time Employees', 'Accum. Allowance for Doubtful Accts',
           'Filing Date', 'Restatement Type', 'Calculation Type'],
          dtype='object')

```python
nwc = bs_df.loc['Accounts Receivable'] + bs_df.loc['Inventory'] - bs_df.loc['Accounts Payable']
```

```python
nwc
```

    2014-12-31     9933
    2015-12-31    11414
    2016-12-31    13312
    2017-12-31    16565
    2018-12-31    17533
    2019-09-30     3562
    dtype: object

To get a change, we can take advantage of `Series.shift`, which shifts all the values by a number of rows.

```python
nwc.shift(1)
```

    2014-12-31      NaN
    2015-12-31     9933
    2016-12-31    11414
    2017-12-31    13312
    2018-12-31    16565
    2019-09-30    17533
    dtype: object

We can see that with `shift(1)`, the value from last period is now in this period. So `nwc.shift(1)` is representing last year's net working capital. So then the change in net working capital is simply:

```python
change_nwc = nwc - nwc.shift(1)
```

```python
change_nwc
```

    2014-12-31       NaN
    2015-12-31      1481
    2016-12-31      1898
    2017-12-31      3253
    2018-12-31       968
    2019-09-30    -13971
    dtype: object

### Calculate Capital Expenditures

Here we need to first get the change in net property, plant, and equipment, then add the current depreciation to get capital expenditures.

```python
bs_df.loc['  Net Property, Plant & Equipment']
```

    2014-12-31    252668
    2015-12-31    251605
    2016-12-31    244224
    2017-12-31    252630
    2018-12-31    247101
    2019-09-30    257065
    Name:   Net Property, Plant & Equipment, dtype: object

```python
change_ppe = bs_df.loc['  Net Property, Plant & Equipment'] - bs_df.loc['  Net Property, Plant & Equipment'].shift(1)
```

```python
change_ppe
```

    2014-12-31      NaN
    2015-12-31    -1063
    2016-12-31    -7381
    2017-12-31     8406
    2018-12-31    -5529
    2019-09-30     9964
    Name:   Net Property, Plant & Equipment, dtype: object

```python
capex = change_ppe + inc_df.loc['Depreciation & Amort.']
```

```python
capex
```

    2014-12-31      NaN
    2015-12-31    16985
    2016-12-31    11327
    2017-12-31    26299
    2018-12-31    12516
    2019-09-30    28367
    dtype: object

### Put it All Together into FCFs

```python
fcf = inc_df.loc['  Net Income'] + non_cash_expenses - change_nwc - capex
```

```python
fcf
```

    Dec-31-2014      NaN
    Dec-31-2015    15916
    Dec-31-2016    18605
    Dec-31-2017    10385
    Dec-31-2018    28094
    Sep-30-2019    21350
    dtype: object

## Working with the Data - `finstmt` Method

There are some drawbacks to using plain `pandas` for these kinds of analyses:
- Different financial statements will have different names for items, so code will be tied to only one data provider
- Names are coming in with extra spaces, bad formatting
- From different data providers, some items are reported as negative numbers and others as positive, would need to handle this all for general code
- It's pretty inconvenient using `.loc` with the full row name.
- It's a little verbose to get a change in a variable
- For each variable, we need to think about which financial statement it comes from to be able to pull it, and then look up the appropriate name
- We had to remember to fill in zeroes or the results would not be correct
- Common calculations still need to be done manually (everyone calculates FCF, shouldn't it be easier?)

Because of these issues, I searched around for a solution to them, but could not find any. But the beauty of open source is anyone can develop a package and make it available to everyone. So I developed the `finstmt` package which handles all of these issues.

https://nickderobertis.github.io/py-finstmt/

### An Aside to Package Installation

To get started using it, we will need to install this package. It doesn't come with Anaconda because I created it! To install packages in Python, the general way is `pip install mypackage` replacing `mypackage` with whatever you want to install. You would run this command inside the `Anaconda Prompt`. An alternative is to run it through Jupyter. If you put `!` before a command in Jupyter, Jupyter interprets that as you wanting to run that on the command line and not in the Jupyter notebook. Let's see that here.

```python
!pip install finstmt
```

    Requirement already satisfied: finstmt in /home/nick/.local/share/virtualenvs/fin-model-course-eIFMSc8A/lib/python3.7/site-packages (0.2.2)
    Requirement already satisfied: sympy in /home/nick/.local/share/virtualenvs/fin-model-course-eIFMSc8A/lib/python3.7/site-packages (from finstmt) (1.5.1)
    Requirement already satisfied: xlrd in /home/nick/.local/share/virtualenvs/fin-model-course-eIFMSc8A/lib/python3.7/site-packages (from finstmt) (1.2.0)
    Requirement already satisfied: matplotlib in /home/nick/.local/share/virtualenvs/fin-model-course-eIFMSc8A/lib/python3.7/site-packages (from finstmt) (3.2.0rc3)
    Requirement already satisfied: pandas in /home/nick/.local/share/virtualenvs/fin-model-course-eIFMSc8A/lib/python3.7/site-packages (from finstmt) (1.0.1)
    Requirement already satisfied: mpmath>=0.19 in /home/nick/.local/share/virtualenvs/fin-model-course-eIFMSc8A/lib/python3.7/site-packages (from sympy->finstmt) (1.1.0)
    Requirement already satisfied: python-dateutil>=2.1 in /home/nick/.local/share/virtualenvs/fin-model-course-eIFMSc8A/lib/python3.7/site-packages (from matplotlib->finstmt) (2.8.1)
    Requirement already satisfied: kiwisolver>=1.0.1 in /home/nick/.local/share/virtualenvs/fin-model-course-eIFMSc8A/lib/python3.7/site-packages (from matplotlib->finstmt) (1.1.0)
    Requirement already satisfied: numpy>=1.11 in /home/nick/.local/share/virtualenvs/fin-model-course-eIFMSc8A/lib/python3.7/site-packages (from matplotlib->finstmt) (1.18.1)
    Requirement already satisfied: cycler>=0.10 in /home/nick/.local/share/virtualenvs/fin-model-course-eIFMSc8A/lib/python3.7/site-packages (from matplotlib->finstmt) (0.10.0)
    Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /home/nick/.local/share/virtualenvs/fin-model-course-eIFMSc8A/lib/python3.7/site-packages (from matplotlib->finstmt) (2.4.6)
    Requirement already satisfied: pytz>=2017.2 in /home/nick/.local/share/virtualenvs/fin-model-course-eIFMSc8A/lib/python3.7/site-packages (from pandas->finstmt) (2019.3)
    Requirement already satisfied: six>=1.5 in /home/nick/.local/share/virtualenvs/fin-model-course-eIFMSc8A/lib/python3.7/site-packages (from python-dateutil>=2.1->matplotlib->finstmt) (1.14.0)
    Requirement already satisfied: setuptools in /home/nick/.local/share/virtualenvs/fin-model-course-eIFMSc8A/lib/python3.7/site-packages (from kiwisolver>=1.0.1->matplotlib->finstmt) (41.4.0)
    WARNING: You are using pip version 19.3.1; however, version 20.0.2 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.

You should see that type of output, and you should especially see `Successfully installed finstmt` to see that it worked. Now we are able to `import finstmt`.

### Using `finstmt`

I have created three main classes (so far) to help working with the data. `IncomeStatements`, `BalanceSheets`, and `FinancialStatements`. Let's import them.

```python
from finstmt import IncomeStatements, BalanceSheets, FinancialStatements
```

`finstmt` expects to receive your data with missing rows already removed, with data items as the index, and with dates as the columns. It is not necessary to fill in zeroes or take absolute values as those are handled by the package. The output of our `load_and_clean_statement_df` function in the beginning puts it in the perfect format for this. Let's reload the `DataFrame`s so that we haven't messed with them.

```python
inc_df = load_and_clean_statement_df(all_statements_path, 'Income Statement')
bs_df = load_and_clean_statement_df(all_statements_path, 'Balance Sheet')
```

Now we want to create `IncomeStatements` from the income statements and `BalanceSheets` from the balance sheets. The way to do this is using `.from_df` methods of each.

```python
inc_data = IncomeStatements.from_df(inc_df)
```

    /home/nick/.local/share/virtualenvs/fin-model-course-eIFMSc8A/lib/python3.7/site-packages/finstmt/findata/database.py:77: UserWarning: Previously had revenue extracted from "Revenue". Replacing with value from "  Total Revenue"
      warnings.warn(f'Previously had {item_config.key} '

The first feature that we get from this package is much cleaner output out of the box. Simply display the data and it has cleaned up all the names of the variables, standardized the date format, and formatted values in currency format.

```python
inc_data
```

      12/31/2014
      12/31/2015
      12/31/2016
      12/31/2017
      12/31/2018
      09/30/2019

      Revenue
      $364,763
      $241,406
      $200,628
      $237,162
      $279,332
      $260,812

      Cost of Goods Sold
      $234,856
      $163,605
      $132,759
      $159,053
      $190,752
      $181,228

      Gross Profit
      $129,907
      $77,801
      $67,869
      $78,109
      $88,580
      $79,584

      R&D Expense
      -
      -
      -
      -
      -
      -

      SG&A Expense
      $12,002
      $10,961
      $11,783
      $11,893
      $12,300
      $12,094

      Depreciation & Amortization Expense
      $17,297
      $18,048
      $18,708
      $17,893
      $18,045
      $18,403

      Other Operating Expenses
      $64,857
      $32,834
      $31,375
      $32,459
      $35,230
      $33,161

      Operating Expense
      $94,156
      $61,843
      $61,866
      $62,245
      $65,575
      $63,658

      Earnings Before Interest and Taxes
      $34,082
      $14,435
      $4,536
      $14,074
      $21,539
      $14,459

      Interest Expense
      $286
      $311
      $453
      $601
      $766
      $844

      Gain on Sale of Investments
      $-5
      $-42
      -
      -
      -
      -

      Gain on Sale of Assets
      $3,151
      $226
      $1,682
      $334
      $1,993
      $1,993

      Impairment Expense
      -
      -
      $3,600
      $2,000
      $700
      $700

      Earnings Before Tax
      $51,630
      $21,966
      $7,969
      $18,674
      $30,953
      $21,763

      Income Tax Expense
      $18,015
      $5,415
      $406
      $1,174
      $9,532
      $6,513

      Net Income
      $32,520
      $16,150
      $7,840
      $19,710
      $20,840
      $14,650

We can also see that it has made the impairment expense (called asset writedown before) into a positive number automatically.

The next main feature is easier access to variables. They have short names you can access via `.` and then the name. You can tab-complete all of these names. Go into the next cell, put your cursor after the `.`, and press tab. You might have to do it a couple times to get it to come up, but you will see all the variables.

```python
inc_data.
```

Now we can access those variables easily.

```python
inc_data.revenue
```

    2014-12-31    364763
    2015-12-31    241406
    2016-12-31    200628
    2017-12-31    237162
    2018-12-31    279332
    2019-09-30    260812
    dtype: int64

You can also see we get back to the raw numbers when accessing a variable, even though when we show the full statement, it is formatted.

We can also pull out one or more dates from the statements easily. Notice also that I'm not even using the same format of the dates, it understands that what you are passing is a date and converts it to match the column.

```python
inc_data['2014-12-31']
```

      0

      Revenue
      $364,763

      Cost of Goods Sold
      $234,856

      Gross Profit
      $129,907

      R&D Expense
      -

      SG&A Expense
      $12,002

      Depreciation & Amortization Expense
      $17,297

      Other Operating Expenses
      $64,857

      Operating Expense
      $94,156

      Earnings Before Interest and Taxes
      $34,082

      Interest Expense
      $286

      Gain on Sale of Investments
      $-5

      Gain on Sale of Assets
      $3,151

      Impairment Expense
      -

      Earnings Before Tax
      $51,630

      Income Tax Expense
      $18,015

      Net Income
      $32,520

```python
inc_data[['2014-12-31', '2015-12-31']]
```

      12/31/2014
      12/31/2015

      Revenue
      $364,763
      $241,406

      Cost of Goods Sold
      $234,856
      $163,605

      Gross Profit
      $129,907
      $77,801

      R&D Expense
      -
      -

      SG&A Expense
      $12,002
      $10,961

      Depreciation & Amortization Expense
      -
      -

      Other Operating Expenses
      $64,857
      $32,834

      Operating Expense
      $94,156
      $61,843

      Earnings Before Interest and Taxes
      $34,082
      $14,435

      Interest Expense
      $286
      $311

      Gain on Sale of Investments
      $-5
      $-42

      Gain on Sale of Assets
      $3,151
      $226

      Impairment Expense
      -
      -

      Earnings Before Tax
      $51,630
      $21,966

      Income Tax Expense
      $18,015
      $5,415

      Net Income
      $32,520
      $16,150

Now let's go ahead and construct the balance sheet.

```python
bs_data = BalanceSheets.from_df(bs_df)
```

```python
bs_data
```

      12/31/2014
      12/31/2015
      12/31/2016
      12/31/2017
      12/31/2018
      09/30/2019

      Cash and Cash Equivalents
      $4,616
      $3,705
      $3,657
      $3,177
      $3,042
      $5,351

      Short-Term Investments
      -
      -
      -
      -
      -
      -

      Cash and Short-Term Investments
      $4,616
      $3,705
      $3,657
      $3,177
      $3,042
      $5,351

      Receivables
      $18,541
      $13,243
      $16,033
      $21,274
      $19,638
      $25,308

      Inventory
      $16,678
      $16,245
      $15,080
      $16,992
      $18,958
      $17,590

      Deferred Tax Assets, Current
      $2,001
      $1,329
      -
      -
      -
      -

      Other Current Assets
      $1,564
      $1,469
      $1,285
      $1,368
      $1,272
      $1,759

      Total Current Assets
      $52,910
      $42,623
      $41,416
      $47,134
      $47,973
      $50,008

      Grosss Property, Plant & Equipment
      $446,789
      $447,337
      $453,915
      $477,185
      $477,190
      -

      Accumulated Depreciation
      $194,121
      $195,732
      $209,691
      $224,555
      $230,089
      -

      Net Property, Plant & Equipment
      $252,668
      $251,605
      $244,224
      $252,630
      $247,101
      $257,065

      Goodwill and Intangible Assets
      -
      -
      -
      -
      -
      -

      Long-Term Investments
      $20,543
      $20,611
      $20,964
      $24,528
      $26,592
      $34,527

      Deferred Tax Assets, Long-Term
      $3,955
      $3,421
      $4,120
      $3,318
      $3,209
      -

      Other Long-Term Assets
      $19,417
      $18,498
      $19,590
      $21,081
      $21,321
      $17,761

      Total Non-Current Assets
      $296,583
      $294,135
      $288,898
      $301,557
      $298,223
      -

      Total Assets
      $349,493
      $336,758
      $330,314
      $348,691
      $346,196
      $359,361

      Payables
      $25,286
      $18,074
      $17,801
      $21,701
      $21,063
      $39,336

      Short-Term Debt
      $16,698
      $18,204
      $10,870
      $13,164
      $13,188
      $21,027

      Current Portion of Long-Term Debt
      $770
      $558
      $2,960
      $4,766
      $4,070
      -

      Tax Liabilities, Short-Term
      $39,230
      $36,818
      $34,041
      $26,893
      $27,244
      $26,513

      Other Current Liabilities
      $13,651
      $11,401
      $10,739
      $11,784
      $12,925
      -

      Total Current Liabilities
      $64,633
      $53,976
      $47,638
      $57,771
      $57,138
      $64,195

      Long-Term Debt
      $11,278
      $18,687
      $27,707
      $23,079
      $19,235
      $24,669

      Total Debt
      $29,121
      $38,687
      $42,762
      $42,336
      $37,796
      $52,887

      Deferred Revenue
      -
      -
      -
      -
      -
      -

      Tax Liabilities, Long-Term
      $39,230
      $36,818
      $34,041
      $26,893
      $27,244
      $26,513

      Deposit Liabilities
      -
      -
      -
      -
      -
      -

      Other Long-Term Liabilities
      $27,111
      $26,582
      $25,193
      $23,989
      $22,476
      $21,693

      Total Non-Current Liabilities
      $77,619
      $82,087
      $86,941
      $73,961
      $68,955
      $72,875

      Total Liabilities
      $168,429
      $159,948
      $156,484
      $154,191
      $147,668
      $162,252

      Common Stock
      $10,792
      $11,612
      $12,157
      $14,656
      $15,258
      $15,795

      Other Comprehensive Income
      $-18,957
      $-23,511
      $-22,239
      $-16,262
      $-19,564
      $-19,277

      Retained Earnings
      $408,384
      $412,444
      $407,831
      $414,540
      $421,653
      $419,367

      Minority Interest
      $6,665
      $5,999
      $6,505
      $6,812
      $6,734
      $7,194

      Total Stockholder's Equity
      $181,064
      $176,810
      $173,830
      $194,500
      $198,528
      $197,109

      Total Liabilities and Equity
      $349,493
      $336,758
      $330,314
      $348,691
      $346,196
      $359,361

We can work with the balance sheet in the same way as the income statement.

The package gets even more powerful when we combine the statements.

```python
stmts = FinancialStatements(inc_data, bs_data)
```

We nice formatting of the statement, showing each nicely formatted statement with headers.

```python
stmts
```

Income Statement

      12/31/2014
      12/31/2015
      12/31/2016
      12/31/2017
      12/31/2018
      09/30/2019

      Revenue
      $364,763
      $241,406
      $200,628
      $237,162
      $279,332
      $260,812

      Cost of Goods Sold
      $234,856
      $163,605
      $132,759
      $159,053
      $190,752
      $181,228

      Gross Profit
      $129,907
      $77,801
      $67,869
      $78,109
      $88,580
      $79,584

      R&D Expense
      -
      -
      -
      -
      -
      -

      SG&A Expense
      $12,002
      $10,961
      $11,783
      $11,893
      $12,300
      $12,094

      Depreciation & Amortization Expense
      $17,297
      $18,048
      $18,708
      $17,893
      $18,045
      $18,403

      Other Operating Expenses
      $64,857
      $32,834
      $31,375
      $32,459
      $35,230
      $33,161

      Operating Expense
      $94,156
      $61,843
      $61,866
      $62,245
      $65,575
      $63,658

      Earnings Before Interest and Taxes
      $34,082
      $14,435
      $4,536
      $14,074
      $21,539
      $14,459

      Interest Expense
      $286
      $311
      $453
      $601
      $766
      $844

      Gain on Sale of Investments
      $-5
      $-42
      -
      -
      -
      -

      Gain on Sale of Assets
      $3,151
      $226
      $1,682
      $334
      $1,993
      $1,993

      Impairment Expense
      -
      -
      $3,600
      $2,000
      $700
      $700

      Earnings Before Tax
      $51,630
      $21,966
      $7,969
      $18,674
      $30,953
      $21,763

      Income Tax Expense
      $18,015
      $5,415
      $406
      $1,174
      $9,532
      $6,513

      Net Income
      $32,520
      $16,150
      $7,840
      $19,710
      $20,840
      $14,650

Balance Sheet

      12/31/2014
      12/31/2015
      12/31/2016
      12/31/2017
      12/31/2018
      09/30/2019

      Cash and Cash Equivalents
      $4,616
      $3,705
      $3,657
      $3,177
      $3,042
      $5,351

      Short-Term Investments
      -
      -
      -
      -
      -
      -

      Cash and Short-Term Investments
      $4,616
      $3,705
      $3,657
      $3,177
      $3,042
      $5,351

      Receivables
      $18,541
      $13,243
      $16,033
      $21,274
      $19,638
      $25,308

      Inventory
      $16,678
      $16,245
      $15,080
      $16,992
      $18,958
      $17,590

      Deferred Tax Assets, Current
      $2,001
      $1,329
      -
      -
      -
      -

      Other Current Assets
      $1,564
      $1,469
      $1,285
      $1,368
      $1,272
      $1,759

      Total Current Assets
      $52,910
      $42,623
      $41,416
      $47,134
      $47,973
      $50,008

      Grosss Property, Plant & Equipment
      $446,789
      $447,337
      $453,915
      $477,185
      $477,190
      -

      Accumulated Depreciation
      $194,121
      $195,732
      $209,691
      $224,555
      $230,089
      -

      Net Property, Plant & Equipment
      $252,668
      $251,605
      $244,224
      $252,630
      $247,101
      $257,065

      Goodwill and Intangible Assets
      -
      -
      -
      -
      -
      -

      Long-Term Investments
      $20,543
      $20,611
      $20,964
      $24,528
      $26,592
      $34,527

      Deferred Tax Assets, Long-Term
      $3,955
      $3,421
      $4,120
      $3,318
      $3,209
      -

      Other Long-Term Assets
      $19,417
      $18,498
      $19,590
      $21,081
      $21,321
      $17,761

      Total Non-Current Assets
      $296,583
      $294,135
      $288,898
      $301,557
      $298,223
      -

      Total Assets
      $349,493
      $336,758
      $330,314
      $348,691
      $346,196
      $359,361

      Payables
      $25,286
      $18,074
      $17,801
      $21,701
      $21,063
      $39,336

      Short-Term Debt
      $16,698
      $18,204
      $10,870
      $13,164
      $13,188
      $21,027

      Current Portion of Long-Term Debt
      $770
      $558
      $2,960
      $4,766
      $4,070
      -

      Tax Liabilities, Short-Term
      $39,230
      $36,818
      $34,041
      $26,893
      $27,244
      $26,513

      Other Current Liabilities
      $13,651
      $11,401
      $10,739
      $11,784
      $12,925
      -

      Total Current Liabilities
      $64,633
      $53,976
      $47,638
      $57,771
      $57,138
      $64,195

      Long-Term Debt
      $11,278
      $18,687
      $27,707
      $23,079
      $19,235
      $24,669

      Total Debt
      $29,121
      $38,687
      $42,762
      $42,336
      $37,796
      $52,887

      Deferred Revenue
      -
      -
      -
      -
      -
      -

      Tax Liabilities, Long-Term
      $39,230
      $36,818
      $34,041
      $26,893
      $27,244
      $26,513

      Deposit Liabilities
      -
      -
      -
      -
      -
      -

      Other Long-Term Liabilities
      $27,111
      $26,582
      $25,193
      $23,989
      $22,476
      $21,693

      Total Non-Current Liabilities
      $77,619
      $82,087
      $86,941
      $73,961
      $68,955
      $72,875

      Total Liabilities
      $168,429
      $159,948
      $156,484
      $154,191
      $147,668
      $162,252

      Common Stock
      $10,792
      $11,612
      $12,157
      $14,656
      $15,258
      $15,795

      Other Comprehensive Income
      $-18,957
      $-23,511
      $-22,239
      $-16,262
      $-19,564
      $-19,277

      Retained Earnings
      $408,384
      $412,444
      $407,831
      $414,540
      $421,653
      $419,367

      Minority Interest
      $6,665
      $5,999
      $6,505
      $6,812
      $6,734
      $7,194

      Total Stockholder's Equity
      $181,064
      $176,810
      $173,830
      $194,500
      $198,528
      $197,109

      Total Liabilities and Equity
      $349,493
      $336,758
      $330,314
      $348,691
      $346,196
      $359,361

Variable access becomes even easier, because now you have access to everything from both the income statement and balance sheet, without worrying about where it came from.

```python
stmts.cash
```

    2014-12-31    4616
    2015-12-31    3705
    2016-12-31    3657
    2017-12-31    3177
    2018-12-31    3042
    2019-09-30    5351
    dtype: int64

```python
stmts.cogs
```

    2014-12-31    234856
    2015-12-31    163605
    2016-12-31    132759
    2017-12-31    159053
    2018-12-31    190752
    2019-09-30    181228
    dtype: int64

We can also still access individual dates.

```python
stmts['2014-12-31']
```

Income Statement

      12/31/2014

      Revenue
      $364,763

      Cost of Goods Sold
      $234,856

      Gross Profit
      $129,907

      R&D Expense
      -

      SG&A Expense
      $12,002

      Depreciation & Amortization Expense
      $17,297

      Other Operating Expenses
      $64,857

      Operating Expense
      $94,156

      Earnings Before Interest and Taxes
      $34,082

      Interest Expense
      $286

      Gain on Sale of Investments
      $-5

      Gain on Sale of Assets
      $3,151

      Impairment Expense
      -

      Earnings Before Tax
      $51,630

      Income Tax Expense
      $18,015

      Net Income
      $32,520

Balance Sheet

      12/31/2014

      Cash and Cash Equivalents
      $4,616

      Short-Term Investments
      -

      Cash and Short-Term Investments
      $4,616

      Receivables
      $18,541

      Inventory
      $16,678

      Deferred Tax Assets, Current
      $2,001

      Other Current Assets
      $1,564

      Total Current Assets
      $52,910

      Grosss Property, Plant & Equipment
      $446,789

      Accumulated Depreciation
      $194,121

      Net Property, Plant & Equipment
      $252,668

      Goodwill and Intangible Assets
      -

      Long-Term Investments
      $20,543

      Deferred Tax Assets, Long-Term
      $3,955

      Other Long-Term Assets
      $19,417

      Total Non-Current Assets
      $296,583

      Total Assets
      $349,493

      Payables
      $25,286

      Short-Term Debt
      $16,698

      Current Portion of Long-Term Debt
      $770

      Tax Liabilities, Short-Term
      $39,230

      Other Current Liabilities
      $13,651

      Total Current Liabilities
      $64,633

      Long-Term Debt
      $11,278

      Total Debt
      $29,121

      Deferred Revenue
      -

      Tax Liabilities, Long-Term
      $39,230

      Deposit Liabilities
      -

      Other Long-Term Liabilities
      $27,111

      Total Non-Current Liabilities
      $77,619

      Total Liabilities
      $168,429

      Common Stock
      $10,792

      Other Comprehensive Income
      $-18,957

      Retained Earnings
      $408,384

      Minority Interest
      $6,665

      Total Stockholder's Equity
      $181,064

      Total Liabilities and Equity
      $349,493

```python
stmts[['2014-12-31', '2015-12-31']]
```

Income Statement

      12/31/2014
      12/31/2015

      Revenue
      $364,763
      $241,406

      Cost of Goods Sold
      $234,856
      $163,605

      Gross Profit
      $129,907
      $77,801

      R&D Expense
      -
      -

      SG&A Expense
      $12,002
      $10,961

      Depreciation & Amortization Expense
      -
      -

      Other Operating Expenses
      $64,857
      $32,834

      Operating Expense
      $94,156
      $61,843

      Earnings Before Interest and Taxes
      $34,082
      $14,435

      Interest Expense
      $286
      $311

      Gain on Sale of Investments
      $-5
      $-42

      Gain on Sale of Assets
      $3,151
      $226

      Impairment Expense
      -
      -

      Earnings Before Tax
      $51,630
      $21,966

      Income Tax Expense
      $18,015
      $5,415

      Net Income
      $32,520
      $16,150

Balance Sheet

      12/31/2014
      12/31/2015

      Cash and Cash Equivalents
      $4,616
      $3,705

      Short-Term Investments
      -
      -

      Cash and Short-Term Investments
      $4,616
      $3,705

      Receivables
      $18,541
      $13,243

      Inventory
      $16,678
      $16,245

      Deferred Tax Assets, Current
      $2,001
      $1,329

      Other Current Assets
      $1,564
      $1,469

      Total Current Assets
      $52,910
      $42,623

      Grosss Property, Plant & Equipment
      -
      -

      Accumulated Depreciation
      $194,121
      $195,732

      Net Property, Plant & Equipment
      $252,668
      $251,605

      Goodwill and Intangible Assets
      -
      -

      Long-Term Investments
      $20,543
      $20,611

      Deferred Tax Assets, Long-Term
      $3,955
      $3,421

      Other Long-Term Assets
      $19,417
      $18,498

      Total Non-Current Assets
      $296,583
      $294,135

      Total Assets
      $349,493
      $336,758

      Payables
      $25,286
      $18,074

      Short-Term Debt
      $16,698
      $18,204

      Current Portion of Long-Term Debt
      $770
      $558

      Tax Liabilities, Short-Term
      $39,230
      $36,818

      Other Current Liabilities
      $13,651
      $11,401

      Total Current Liabilities
      $64,633
      $53,976

      Long-Term Debt
      $11,278
      $18,687

      Total Debt
      $29,121
      $38,687

      Deferred Revenue
      -
      -

      Tax Liabilities, Long-Term
      $39,230
      $36,818

      Deposit Liabilities
      -
      -

      Other Long-Term Liabilities
      $27,111
      $26,582

      Total Non-Current Liabilities
      $77,619
      $82,087

      Total Liabilities
      $168,429
      $159,948

      Common Stock
      $10,792
      $11,612

      Other Comprehensive Income
      $-18,957
      $-23,511

      Retained Earnings
      $408,384
      $412,444

      Minority Interest
      $6,665
      $5,999

      Total Stockholder's Equity
      $181,064
      $176,810

      Total Liabilities and Equity
      $349,493
      $336,758

```python
stmts[['2014-12-31', '2015-12-31']].total_equity
```

    2014-12-31    181064.0
    2015-12-31    176810.0
    dtype: float64

### Calculating FCFs Using `finstmt`

I have already built FCF calculation into the package. So we can simply do:

```python
stmts.fcf
```

    2014-12-31        NaN
    2015-12-31    15916.0
    2016-12-31    18605.0
    2017-12-31    10385.0
    2018-12-31    28094.0
    2019-09-30    21350.0
    dtype: float64

If we wanted to calculate it manually for some reason, it would also be much easier. This not only because all the items are consolidated, but also calculating lags and changes is easier.

```python
stmts.net_ppe
```

    2014-12-31    252668
    2015-12-31    251605
    2016-12-31    244224
    2017-12-31    252630
    2018-12-31    247101
    2019-09-30    257065
    dtype: int64

```python
stmts.lag('net_ppe', 1)
```

    2014-12-31         NaN
    2015-12-31    252668.0
    2016-12-31    251605.0
    2017-12-31    244224.0
    2018-12-31    252630.0
    2019-09-30    247101.0
    dtype: float64

```python
stmts.change('net_ppe')
```

    2014-12-31       NaN
    2015-12-31   -1063.0
    2016-12-31   -7381.0
    2017-12-31    8406.0
    2018-12-31   -5529.0
    2019-09-30    9964.0
    dtype: float64

Also the components of FCF are precalculated.

```python
stmts.net_income + stmts.non_cash_expenses - stmts.change('nwc') - stmts.capex
```

    2014-12-31        NaN
    2015-12-31    15916.0
    2016-12-31    18605.0
    2017-12-31    10385.0
    2018-12-31    28094.0
    2019-09-30    21350.0
    dtype: float64

### Other Notes

`finstmt` is a general package which can work with a variety of data providers' financial statements. So far, I have confirmed it working with statements from Stockrow and from Capital IQ. Now you can write one set of code that will work regardless of where you are getting your data.

There may still be some rough edges. I put this package together in a couple days. It also has features for forecasting that we will cover in our next lecture. Please let me know if you run into any issues with the package.

docsrc/source/_static/Examples/DCF/Historical FCF/Calculating Historical FCF.ipynb