## Getting started with MUQ examples

MUQ contains many usage examples, in both c++ and python, that are based on IPython notebooks. If you are reading this on the MUQ website, this web page was actually created from an IPython notebook. The goal of this example is to acquaint you with the formatting of our IPython examples.

We should point out that all examples hosted on the MUQ website (including this one) are produced from notebooks in the MUQ/examples/ folder of the MUQ source.

### Cells

IPython notebooks are composed of many cells that each contain a short segment of code or documentation. When code cells containing Python are run, they can also produce output cells, which are placed immediately following the code. On the MUQ website, code cells have a light gray background and output cells have a dark gray background. The following "Hello World" example illustrates this in Python.

print "Hello World!"

Hello World!



Variables persists between cells. Thus, a variable defined in one cell can be used in any subsequent cells. The following two cells illustrate this fact.

myGreeting = "Hello World!"

print myGreeting

Hello World!



### Full example files

On each example page, the code snippets are concatenated into a complete listing at the bottom of the page. This completed code can then be copied and used to build up your own applications.

### Handling c++

MUQ is primarily written in c++, but IPython (and Jupyter) notebooks are designed for interpreted languages like Python, Julia, and R. To overcome this, we perform a few tricks with IPython magic commands. See this example for details.

## Completed code:

print "Hello World!"

myGreeting = "Hello World!"

print myGreeting


Test Status
• ##### Develop Branch
OS Compiler
OSX Clang
Ubuntu Clang
Ubuntu g++ 4.7
Ubuntu g++ 4.8
Ubuntu g++ 4.9
Acknowledgments
This material is based upon work supported by the National Science Foundation under Grant No. 1550487.

This work was supported by the DOE Office of Science through the QUEST SciDAC Institute.

Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.