In [1]:
# Standard stuff to get started
using Plots, LinearAlgebra, Statistics, Random, Printf
In [2]:
# Write a function to generate the sequence
""" This function generates the first n terms
of the sequence
xk = [cos(2*pi*k/10 + 2^{-k}); sin(2*pi*k/10 + 2^{-k})]
"""
function seqvals(n)
    X = zeros(n,2) # allocate a n-by-2 array
    for k=1:n
        X[k,1] = cos(2*pi*k/10 + 2.0^(-k))
        X[k,2] = sin(2*pi*k/10 + 2.0^(-k))
    end
    return X
end
seqvals(5)
Out[2]:
5×2 Matrix{Float64}:
  0.42818     0.903693
  0.0641153   0.997943
 -0.425179    0.905109
 -0.84415     0.536107
 -0.999512   -0.0312449
In [3]:
X = seqvals(1000); scatter(X[:,1],X[:,2])
Out[3]:
In [4]:
n = 1000
subset = 1:10:n
X = seqvals(n)
scatter(X[subset,:]) # show the columns independently
Out[4]:
In [5]:
X[subset,:]
Out[5]:
100×2 Matrix{Float64}:
 0.42818   0.903693
 0.80873   0.58818
 0.809017  0.587786
 0.809017  0.587785
 0.809017  0.587785
 0.809017  0.587785
 0.809017  0.587785
 0.809017  0.587785
 0.809017  0.587785
 0.809017  0.587785
 0.809017  0.587785
 0.809017  0.587785
 0.809017  0.587785
 ⋮         
 0.809017  0.587785
 0.809017  0.587785
 0.809017  0.587785
 0.809017  0.587785
 0.809017  0.587785
 0.809017  0.587785
 0.809017  0.587785
 0.809017  0.587785
 0.809017  0.587785
 0.809017  0.587785
 0.809017  0.587785
 0.809017  0.587785
In [6]:
# Write a function to generate the sequence
""" This function generates the first n terms
of the sequence
xk = [cos(2*pi*k/10 + 2^{-k}); sin(2*pi*k/10 + 2^{-k})]
"""
function seqvals(n)
    X = zeros(n,2) # allocate a n-by-2 array
    for k=1:n
        X[k,1] = cos(2*pi*k/10 - 1/sqrt(k))
        X[k,2] = sin(2*pi*k/10 - 1/sqrt(k))
    end
    return X
end
seqvals(5)
Out[6]:
5×2 Matrix{Float64}:
  0.931718  -0.363183
  0.85277    0.522287
  0.260163   0.965565
 -0.42818    0.903693
 -0.901656   0.432455
In [7]:
X = seqvals(1000); scatter(X[:,1],X[:,2])
Out[7]:
In [8]:
n = 1000
subset = 1:10:n
X = seqvals(n)
scatter(X[subset,:]) # show the columns independently
Out[8]:
In [ ]: