function [SSC, SCS, CCC, CSS, DSC, DCS] = TSbox_SCD_matrices(nmax) 
% TSbox_SCD_matrices(nmax) computes the discretized matrices associated with the multiplication by sine and cosine, and the differentiation. Written by Ben Miquel, 2017. Additional material to: "Hybrid Chebyshev function bases for sparse spectral methods in parity-mixes PDEs on an infinite domain", submitted to J. Comput. Phys.

SCS = zeros(nmax);
CSS = zeros(nmax);
CCC = zeros(nmax);
DCS = zeros(nmax);
DSC = zeros(nmax);

% SSC
SSC =       1/2*eye(nmax);
SSC = SSC - 1/2*diag(ones(1,nmax-2),2);
% first column is an exception
SSC(:,1) =0;
SSC(1,1) =1;
 
% SCS
SCS =       1/2*eye(nmax);
SCS = SCS - 1/2*diag(ones(1,nmax-2),-2);

% CCC
CCC =       1/2*diag(ones(1,nmax-1),-1);
CCC = CCC + 1/2*diag(ones(1,nmax-1), 1);
% first column an exception
CCC(:,1)=0;
CCC(2,1) = 1;

% CSS
CSS =       1/2*diag(ones(1,nmax-1),-1);
CSS = CSS + 1/2*diag(ones(1,nmax-1), 1);

% DSC
DSC = -diag((1:nmax-1),1);

% DCS
DCS = diag((1:nmax-1),-1);

%sparsify the result
SSC = sparse(SSC);
SCS = sparse(SCS);
CCC = sparse(CCC);
CSS = sparse(CSS);
DSC = sparse(DSC);
DCS = sparse(DCS);


