### Yes, you can call python

In [1]:
using PyCall

In [2]:
@pyimport matplotlib.pyplot as plt
x = linspace(0,2*pi,1000); y = sin(3*x + 4*cos(2*x));
plt.plot(x, y, color="red", linewidth=2.0, linestyle="--")
plt.show()

In [3]:
x

Out[3]:
linspace(0.0,6.283185307179586,1000)

In [4]:
@pyimport scipy.optimize as so
opt = so.newton(x -> cos(x) - x, 1)

Out[4]:
0.7390851332151607

In [5]:
opt

Out[5]:
0.7390851332151607

### No, zero indexing is too convenient so it's not allowed

In [6]:
x[0]

LoadError: BoundsError: attempt to access linspace(0.0,6.283185307179586,1000)
at index [0]

in throw_boundserror at abstractarray.jl:156
in getindex at range.jl:359

### You like Matlab? Great!

In [7]:
mat = [1 2 3; 4 5 6; 7 8 9]

Out[7]:
3x3 Array{Int64,2}:
1  2  3
4  5  6
7  8  9

In [8]:
eig(mat)

Out[8]:
([16.116843969807043,-1.1168439698070427,-1.3036777264747022e-15],
3x3 Array{Float64,2}:
-0.231971  -0.78583     0.408248
-0.525322  -0.0867513  -0.816497
-0.818673   0.612328    0.408248)

In [9]:
mat1 = 1:9
reshape(mat1,3,3)

Out[9]:
3x3 Array{Int64,2}:
1  4  7
2  5  8
3  6  9

### Not Parallel? No Problem!

In [10]:
size = 1000
mat = rand(size,size);

In [11]:
t1 = @elapsed eig(mat);
t4 = @elapsed eig(mat);

In [12]:
t1/t4

Out[12]:
1.3382065340608484

In [13]:
c::Int = 0
for i=1:n
c += rand(Bool)
end
c
end

fetch(a)+fetch(b)
t

Out[13]:
0.128749351

In [14]:
t = @elapsed nheads = @parallel (+) for i=1:200000000
Int(rand(Bool))
end
t

Out[14]:
1.035454747

In [15]:
t = @elapsed for i=1:200000000
end
t

Out[15]:
6.415653179

### Macros vs. Functions

In [16]:
macro sayhello()
return :( println("Hello!") )
end

In [17]:
@sayhello

Hello!

In [ ]: