Esempio n. 1
0
# plt.plot(H[0,:], H[3,:],label=("normf(RW@B)"))
# plt.ylabel(r'Condition Number')
# plt.xlabel(r'Matrix Dimension')
# plt.title('Condition numbers')
# plt.legend(loc='upper left')

#numerical reasons

i = 7
j = i + 1
alpha = 0
beta = 0

#vandermonde matrix
xi = fs.jacobigl(alpha, beta, i)
P1 = fs.jacobip(xi, alpha, beta, i).T
P2 = fs.legendre(xi, i).T

#gll weights
w1 = 2 / (j * (j - 1) * (P2[:, i]**2))
W1 = np.diag(w1)
RW = np.diag(np.sqrt(w1))

#c for inv(P.T@W@P)
c1 = np.ones(i + 1)
c1[i] = i / (2 * i + 1)
C1 = np.diag(c1)

c2 = np.arange(0, i + 1) + 1 / 2
c2[i] = i / 2
C2 = np.diag(c2)
Esempio n. 2
0
import matplotlib.pyplot as plt
from matplotlib import style
#from numpy import linalg as ln


#COMPUTING THE JACOBI BASIS FUNCTIONS

N = 5

#if alpha=beta=0.0 we are talking about Legendre Polynomials
#if alpha=beta=1.0 we are talking about Chebyshev Polynomials
alpha = 0.0
beta = 0.0
x = np.arange(-1,1.0005,0.001)
Por = fs.legendre(x,N)
Pon = fs.jacobip(x,alpha,beta,N)
zeros, w = fs.jacobigq(alpha,beta,N-1)

#PLOT
#do you want the just the orthogonal or the orthonormal version?
# 1 for orthogonal
# 2 for orthonormal
ortho = 2
Pplot = Pon
if (ortho == 1):
    Pplot = Por

plt.ion()
plt.figure(1, figsize=(11, 8.5))
style.use('ggplot')