diffmatGJ {rjacobi} | R Documentation |
Calculates the derivative matrix of the Q point Gauss-Jacobi quadrature.
D = diffmatGJ(z, a=0.0, b=0.0) D = diffmatGLJ(z, a=0.0, b=0.0) D = diffmatGRJM(z, a=0.0, b=0.0) D = diffmatGRJP(z, a=0.0, b=0.0)
z |
Quadrature node calculated with zerosGJ
(depending on quadrature type) |
a |
α parameter of Jacobi polynomial. Defaults to 0 |
b |
β parameter of Jacobi polynomial. Defaults to 0 |
The derivative matrix is used to calculate derivatives at nodal points of functions known at the same nodal points. It is defined according to the following expression:
(frac{du(x)}{dx})_{x=x_i} = sum_{j=0}^{Q-1} D_{ij} u(x_j)
In this equation,
D_{ij} = (frac{dh_j(x)}{dx})_{x=x_i}
where h_j(x) is the Lagrange polynomial through the jth quadrature node
Different types of quadrature are possible:
GJ
GLJ
, includes both end
points
GRJM
, includes the -1 end
point
GRJP
, includes the +1 end
pointWith the derivative matrix, the derivative at quadrature points can be calculated:
df = D %*% f(x)
where x is a vector containning the quadrature nodes.
The derivative matrix
Abramowitz, Milton and Stegun, Irene (editors); "Handbook of Mathematical functions", Dover Publications 1965.
Karniadakis, George Em and Sherwin, Spencer; "Spectral/hp Element Methods for Computational Fluid Dynamics", Oxford Science Publications, 2nd edition, 2005.
## Calculates the numerical derivative of jacobi(x,4) z = zerosGJ(5) D = diffmatGJ(z) f <- jacobi(z, 4) df <- D %*% f x <- seq(-1, 1, len=51) ff <- djacobi(x, 4) plot(x, ff, ty='l', xlab="x", ylab="dP_4^(0,0)/dx", main="Analytical and Numerical derivative") points(z,df)