Figure 2.29:

Hat functions for N=2.

Code for Figure 2.29

Text of the GNU GPL.

main.py


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import numpy as np
import matplotlib.pyplot as plt

points = np.array([
    [0, 0, 0.5, 1, 0, 1, 0.5, 0, 0, 0, 0.5, 0],
    [0.5, 1, 1, 0, 0.5, 0, 1, 0, 0.5, 0, 1, 1]
])

with open("hatfunc.dat", "w") as f:
    np.savetxt(f, points, fmt='%f')