using Plots
plot(cumsum(randn(100)))
savefig("mycs520-figure.pdf")
"/Users/dgleich/Dropbox/courses/cs520-2023/web/input/julia/mycs520-figure.pdf"
X = randn(100,1)
100×1 Matrix{Float64}:
0.5555303079694842
-0.9643002501710098
0.3185010143105035
0.5358656681010048
0.7244377283963698
0.5569010993317579
-0.9611473632444195
-1.148041116380844
0.3843077757385845
-0.3025517548094711
0.8194927722534551
0.3279550861596789
0.9510116176144341
⋮
0.28409673421421444
0.20611881070430307
0.2614144461558663
1.1483960474582213
-1.2700992620048341
-0.14953798800856735
-0.6055185948384988
0.7126834557906986
0.4641266750064072
0.20364395101511182
0.10196471677395817
-0.4917173113725836
vec(X) == X
false
1
1
typeof(1)
Int64
typeof(1.0)
Float64
1/5
0.2
0 ÷ 5
0
div(0,5)
0
α = 5.0
5.0
β = 2.3
2.3
α*β
11.5
😀 = 10
10
factorial(😀)
3628800
X = [1.0, 2, 3]
3-element Vector{Float64}:
1.0
2.0
3.0
X[1]
1.0
import Pkg; Pkg.add("OffsetArrays")
┌ Warning: could not download https://pkg.julialang.org/registries │ exception = Could not resolve host: pkg.julialang.org while requesting https://pkg.julialang.org/registries └ @ Pkg.Registry /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-macmini-aarch64-4.0/build/default-macmini-aarch64-4-0/julialang/julia-release-1-dot-8/usr/share/julia/stdlib/v1.8/Pkg/src/Registry/Registry.jl:68 Updating registry at `~/.julia/registries/General` Updating git-repo `https://github.com/JuliaRegistries/General.git` ┌ Error: Some registries failed to update: │ — /Users/dgleich/.julia/registries/General — failed to fetch from repo: failed to fetch from https://github.com/JuliaRegistries/General.git, error: GitError(Code:ERROR, Class:Net, failed to resolve address for github.com: nodename nor servname provided, or not known) └ @ Pkg.Registry /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-macmini-aarch64-4.0/build/default-macmini-aarch64-4-0/julialang/julia-release-1-dot-8/usr/share/julia/stdlib/v1.8/Pkg/src/Registry/Registry.jl:449 Resolving package versions... Updating `~/.julia/environments/v1.8/Project.toml` [6fe1bfb0] + OffsetArrays v1.12.8 No Changes to `~/.julia/environments/v1.8/Manifest.toml`
using OffsetArrays
x = OffsetVector(rand(10), 0:9)
10-element OffsetArray(::Vector{Float64}, 0:9) with eltype Float64 with indices 0:9:
0.7678722316084888
0.7713737318835239
0.6812864288721118
0.9446438842898601
0.13310007421807857
0.8870429102714432
0.9282221974850758
0.7819518714458586
0.7796844465528503
0.5874710198835819
x[0]
0.7678722316084888