In [2]:
Pkg.add("Optim")


INFO: Cloning cache of Calculus from git://github.com/johnmyleswhite/Calculus.jl.git
INFO: Cloning cache of DualNumbers from git://github.com/JuliaDiff/DualNumbers.jl.git
INFO: Cloning cache of NaNMath from git://github.com/mlubin/NaNMath.jl.git
INFO: Cloning cache of Optim from git://github.com/JuliaOpt/Optim.jl.git
INFO: Installing Calculus v0.1.10
INFO: Installing DualNumbers v0.1.3
INFO: Installing NaNMath v0.1.0
INFO: Installing Optim v0.4.2
INFO: Package database updated
INFO: METADATA is out-of-date — you may not have the latest version of Optim
INFO: Use `Pkg.update()` to get the latest versions of your packages

In [3]:
using Optim


INFO: Precompiling module NaNMath...

In [10]:
optimize(x -> x*x -2 , -5, 5).f_minimum


Out[10]:
-2.0

In [16]:
typeof(optimize( x -> x[1]*x[1] + 3*(x[2]-2)*x[2], [0.5,1.0]))


Out[16]:
Optim.MultivariateOptimizationResults{Float64,1}

In [5]:
sub2ind((3,4), (4,1)...)


Out[5]:
4

In [6]:
clamp((4,1), (0,0), (3,4))


Out[6]:
(3,4)

In [7]:
?clamp


search: 
Out[7]:
clamp(x, lo, hi)

Return x if lo <= x <= hi. If x < lo, return lo. If x > hi, return hi. Arguments are promoted to a common type. Operates elementwise over x if it is an array.

clamp clamp!


In [8]:
clamp(4,0,3)


Out[8]:
3

In [9]:
clamp(1,0,4)


Out[9]:
1

In [11]:
for i in (1,2,3)
    print(i)
end


123

In [12]:
length((1,2,3))


Out[12]:
3

In [15]:
(2,2) < (2,3)


Out[15]:
true

In [ ]: