# This part will be explained later using Pkg Pkg.activate("..") Pkg.instantiate(); a = 3 typeof(a) a = 3.0 typeof(a) a = convert(Float64, 2) typeof(a) a = "3" typeof(a) ab = "a"*"b" "a = $a" s = :foo typeof(s) x = [1,2,3,4] x = [1 2 3 4] X = [1 2; 3 4] X = zeros(2,3) Y = ones(2,3) Z = randn(2,3) A = [3 2 1; 2 3 2; 1 2 3] x = [0, 1, 2] b = A*x c = x'*A*x 3 .*[1 2 3] sin.([1., 2., 3.]) for n = 1:2:5 println(n) end num_range = range(0, stop=4, length=2) for n in num_range println(n) end for (j,n) in enumerate(num_range) println("$j, $n") end ["n = $n" for n in num_range] a = 3.0 if a < 0 println("Negative") elseif a == 0 println("0.0") else println("Positive") end a > 0 ? println("Positive") : println("Not positive") function foo(bar::Float64) message = "Boo!" return message end function foo(bar::Integer) message = "Bah!" return message end foo(1) fn(x::Number) = 1/x fn(4) fn(; number::Number = 1) = 1/number [fn() fn(number=3)] x = [1, 3, 2] [sort(x) x] [sort!(x) x] using Pkg Pkg.activate("..") Pkg.instantiate(); using LinearAlgebra E,V = eigen([3. 2.;2. 0.4]) using DataFrames x = Dict( "a" => 1, "b" => 2, "c" => 3 ) df = DataFrame(x) using Distributions px = Normal(1.0, 0.5) pdf(px, 0.0) using Plots x = range(-3, stop=3, length=301) plot(x, pdf.(px, x), xlabel="x", ylabel="p(x)", label="pdf", color="red", linewidth=5, linestyle=:dash) X = randn(10,2) scatter(X[:,1], X[:,2], xlabel="X_1", ylabel="X_2", markersize=10, markershape=:cross) plot(x, pdf.(Normal(0.,1.), x), xlabel="x", ylabel="p(x)", label="N(0,1)", color="red", linewidth=5, linestyle=:dash) plot!(x, pdf.(Normal(1.,0.5), x), xlabel="x", ylabel="p(x)", label="N(1,0.5)", color="blue", linestyle=:solid) using ProgressMeter @showprogress for n in 1:10 sleep(0.1) end function add1(a::Integer) return a + 1 end add1(3.0) add1(3) function add(a::Integer, b::Integer) return a+b end add(3.0,4) add(3,4) y = 3*aa aa = MvNormalMeanVariance() yy = 3*2 zz = 3*yy xx = yy*xx zz = yy*xx