Skip to main content
Chemistry LibreTexts

5.2: Jupyter Notebooks (Executable Programming Code and Figures)

  • Page ID
    148808
  • \( \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}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Alert

    We are currently in the process of migrating from our prototypical alpha Jupyter system to our production-ready beta Jupyter backend. Please note that we cannot provide technical support for this feature until after our official feature launch shortly after August 25 as we are still in the process of making significant changes behind the scenes. Thank you for your patience as we upgrade this feature for general usage!

    Alert

    This feature is currently in alpha and for now is only available on the chemistry library.

    The Jupyter notebook system is a powerful aspect to the LibreTexts platform. The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more.

    clipboard_e7894eef8fe792997185ce256cb13ae45.png
    Figure \(\PageIndex{1}\): Python code used for making an interactive figure in the LibreTexts platform (https://libretexts.org/advanced.html).

    Jupyter code can be embedded in four steps:

    Step 1: Set Meta-Tag

    Flip the "Embed Jupyter" meta tag on the page under page settings. You need to select which code you want active on this page. Only one language per page for now.

    Jupyter.png
    Figure \(\PageIndex{2}\):

    Step 2: Insert Jupyter Template

    You need to add the Jupyter template. You do this by selecting the Template section under "Elements" on the editing toolbar

    Slide2.PNG
    Figure \(\PageIndex{3}\):

    Then select "EmbedJupyter" template.

    Slide3.PNG
    Figure \(\PageIndex{4}\):

    The template box will be added.

    Slide4.PNG
    Figure \(\PageIndex{5}\):

    Step 3: Write Code

    Click on the "+" in upper left corner of the red DekiScriipt box to be able to insert python (or any other language) code.

    Slide5.PNG
    Figure \(\PageIndex{6}\):

    Step 4: Save and Execute

    You can execute the code. Via the green "run" button

    Slide6.PNG
    Figure \(\PageIndex{7}\):

    5.2: Jupyter Notebooks (Executable Programming Code and Figures) is shared under a CC BY license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?