helpers.jl (569B)
1 #/usr/bin/julia 2 3 using LinearAlgebra 4 using Plots 5 using Plots.Measures 6 using Distributions 7 using LaTeXStrings 8 using TSVD: tsvd 9 using TensorToolbox: tenmat, ttm, contract # todo:implement 10 11 @doc raw""" 12 Helper functions to calculated the tensor values of the Chebyshev Polynomials \textit{che_pol} 13 on a Grid \textit{t(n)} 14 """ 15 16 t(n) = [2*(i-1)/(n-1)-1 for i ∈ 1:n] 17 18 function che_pol(x, q) 19 if abs(x) ≤ 1 20 return cos(q*acos(x)) 21 elseif x ≥ 1 22 return cosh(q*acosh(x)) 23 elseif x ≤ -1 24 return (-1)^q * cosh(q*acosh(-x)) 25 end 26 end