How to do uncertainity calculations in Julia

First you will need to go to the website juliabox.com and register for an account. Once you have logged in to your account click on jupyter in the upper left corner. Then you should see a menu with files and such listed.

On the top right of the file menu you should see a button "new" click that and select the one that says Julia 1.0...

This should open a screen that looks kinda like this notebook. Since this is your first time we will have to do a couple of setup commands:

Setup (First Time Only)

For your first time using JuliaBox you need to add the Measurements package. Type the below commands into your prompt and then evaluate them by doing Shift+Enter with the cursor in the box you want to evaluate

In [1]:
using Pkg
Pkg.add("Measurements")
 Resolving package versions...
  Updating `~/.julia/Project.toml`
 [no changes]
  Updating `~/.julia/Manifest.toml`
 [no changes]

Doing Uncertainty Calculations

After you have run the above commands the first time you use JuliaBox you can start with the below. Suppose we have measured two quantities $a=1.2 \pm 2.3$ and $b= 2.4 \pm 5.6$ and we want to find the uncertainity for the quantity $p=\frac{1}{2}a b^2$. We can run the below commands:

In [2]:
using Measurements
In [3]:
a=1.2 ± 2.3
b=2.4 ± 5.6

1/2*a*b^2
Out[3]:
$3.456 \pm 17.43530211955044$

This finds the uncertaity in and estimate for p as $3.456 \pm 17.435$. If you want to type in your own quantities for this then you need to type them like so:

a=1.2 \pm TAB 2.3 b=2.4 \pm TAB 5.6

1/2ab^2

The \pm means to do the $\pm$ sign. Hit tab after \pm as you are typing then Julia will convert \pm to $\pm$ for you.

In [5]:
c=1 ± 5.6
Out[5]:
$1.0 \pm 5.6$
In [6]:
sin(c^2)*a+b+10.0
Out[6]:
$13.409765181769476 \pm 9.372163985740231$