Skip to main content
Engineering LibreTexts

4: Memory pictures

  • Page ID
    39361
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)

    Now that we’ve talked about the three important kinds of atomic variables, let’s consider the question of where they live. It might sound like a strange question. Aren’t they “in” the Jupyter Notebook cell in which they were typed?

    Actually, no. And that brings me to the first mission-critical lesson of the semester, which is a bane to all students who don’t deeply grasp it. The lesson is:

    "The code itself is only a means to an end. The purpose of the code is to read or write what’s in memory."

    Memory is the part of the computer in which variables and their values are stored. To use the terminology of Chapter 3, memory is where the environment lives. It is invisible to the programmer, but it is also very much there. The single most important trick to learning how to write correct code is being able to summon to mind what memory looks like at any point in time. The code you must write is a natural consequence of that.


    4: Memory pictures is shared under a CC BY-SA license and was authored, remixed, and/or curated by Stephen Davies (allthemath.org) .

    • Was this article helpful?