  Fractional calculus with respect to function $\psi$, also named as
$\psi$-fractional calculus, generalizes the Hadamard and the Riemann-Liouville
fractional calculi, which causes challenge in numerical treatment. In this
paper we study spectral-type methods using mapped Jacobi functions (MJFs) as
basis functions and obtain efficient algorithms to solve $\psi$-fractional
differential equations. In particular, we setup the Petrov-Galerkin spectral
method and spectral collocation method for initial and boundary value problems
involving $\psi$-fractional derivatives. We develop basic approximation theory
for the MJFs and conduct the error estimates of the derived methods. We also
establish a recurrence relation to evaluate the collocation differentiation
matrix for implementing the spectral collocation algorithm. Numerical examples
confirm the theoretical results and demonstrate the effectiveness of the
spectral and collocation methods.
