User Tools

Site Tools


gibson:teaching:fall-2016:math753:notebook-workflow

This is an old revision of the document!


A PCRE internal error occured. This might be caused by a faulty plugin

====== Working with Julia notebooks ====== A Julia notebook has three types of //cells// - Textual annotation, written in the [[https://daringfireball.net/projects/markdown/|Markdown]] mark-up language (see also [[https://en.wikipedia.org/wiki/Markdown|wikipedia]]). - Live Julia code - Graphical output ====== Executing Julia code in a notebook ===== Our first concern is working with the live Julia code cells. I'll illustrate on the "Numbers, variables, and basic functions" notebook from the Hands-on Julia tutorial. You should start that notebook and follow along (see [[:gibson:teaching:fall-2016:math753:julia-notebooks]]). ----- ===== Executing a line of code with shift-enter ===== 1. Click on the line ''In [ ]: typeof(10)''. The line will be highlighted with a green box, and you should see a blinking cursor after ''typeof(10)''. 2. Hold down the shift key while pressing "enter" (we'll call this "shift-enter"). This will make the Julia computational engine execute the line of Julia code and print its return value. You should now see the following. Note that Julia has told us that the value 10 has type Int64, i.e. 64-bit integer. {{ :gibson:teaching:fall-2016:math753:notebookworkflow1.jpg |}} 3. Try clicking on the ''typeof(10)'' line again, modifying it to read ''typeof(10.0)'', and hitting shift-enter. You will see that the type of 10.0 is Float64, i.e. a 64-bit floating-point number. {{ :gibson:teaching:fall-2016:math753:notebookworkflow2.jpg |}} ===== Adding a new Julia-code cell with ctrl-m-b ===== The notebook has asked you to try a few calculations even before the ''typeof(10)'' statement. To do this, click on the section of text starting ''[1] Type different types of integers ...'' and then either select Insert -> Insert Cell Below from the menu, or use the quicker keyboard shortcut "control-m b" (or "ctrl-m b"). That is, hold the control key, type "m", and then let go of control and type "b". This will insert an empty Julia-code cell, which you can type Julia commands into and execute with shift-enter. After entering the suggested ''3/4'' and hitting shift-enter, you'll see {{ :gibson:teaching:fall-2016:math753:julia-notebooks:notebookworkflow3.jpg |}} =====

gibson/teaching/fall-2016/math753/notebook-workflow.1472749442.txt.gz · Last modified: 2016/09/01 10:04 by gibson