Micah P. Dombrowski / Jan 14 2018
with Andrea Amantini
Julia Template
Julia Template
This article can act as a starting point for any basic Julia article. It has cells to accomplish some basic setup and programming tasks, as well as a few more complex ones. Just Remix and go!
For explanations of what's going on, see this article on Bash setup and this one on Juila setup and coding.
1. System setup
1.
System setup
apt-get update >> /dev/null
apt-get install -y fortune cowsay
/usr/games/fortune | /usr/games/cowsay
pwd ls -al mkdir -p ~/.keras echo '{ "epsilon": 1e-07, "image_data_format": "channels_last", "backend": "cntk", "floatx": "float32" }' > ~/.keras/keras.json
# curl -O https://nextjournal.com/images/logo.svg wget https://nextjournal.com/images/logo.svg cp ~/.keras/keras.json /results/ cp logo.svg /results/
keras.json
Download
2. Installing Julia packages
2.
Installing Julia packages
Pkg.pin("Plots") # Keeps update from breaking it. Pkg.update() Pkg.add("Primes") Pkg.status()
3. Data intake
3.
Data intake
cubic.csv
Download
data = readcsv(cubic.csv)
# str = open(readstring, ) # waiting on bugfix str = open(readstring, "//.keras/keras.json")
print(read /results file.str)
4. Calculations
4.
Calculations
using Primes
primes(1000)
data = [x*(-1)^(i+1) for (i,x) in enumerate(read uploaded file.data[1])]
5. Plotting
5.
Plotting
Plots.scatter(read uploaded file.data, title="Cubic Function", xlab="x", ylab="f(x)", legend=:none )
Plots.gr() # switch backend Plots.scatter(read uploaded file.data, title="Cubic Function", xlab="x", ylab="f(x)", legend=:none )
var data = modify file data.data plottypes = ['lines','markers'] var traces = plottypes.map(function(ptype) { return { type: 'scatter', mode: ptype, name: ptype, x: [Array(401).keys()], y: data } }) var layout = { title: 'Split Cubic Function', xaxis: { title: 'Year' }, yaxis: { title: 'Temperature [C]' } } Nextjournal.plot(traces, layout)