Ejemplo n.º 1
0
def showHerm(hdat):
    #Y's for Herm(X)
    HFunc = interpolation.HMethod(hdat)
    HY = [interpolation.evalPoly(HFunc,t) for t in interval]

    #plot graph
    plt.plot(interval, HY, color="green", label = r'$Hermite P(x)$')
Ejemplo n.º 2
0
def showLan(ldat):
    #Y's for Lan(X)
    LFunc = interpolation.LMethod(ldat)
    LY  = [interpolation.evalPoly(LFunc,t) for t in interval]
    
    #plot graph
    plt.plot(interval, LY, color="red", label = r'$Langrange P(x)$')
Ejemplo n.º 3
0
def getSplineY(S, data, num):
    k = -1
    for i in range(1,len(data)):
        if (num >= data[i-1][0]) and (num <= data[i][0]):
            k = i-1
            break
    if k>=0:
        return interpolation.evalPoly(S[k], num)
    else:
        return interpolation.F(num)
Ejemplo n.º 4
0
def showLsixes():
    mat = multLsix

    for i in range(len(mat)):
        matY = [interpolation.evalPoly(mat[i], t) for t in interval]
        plt.plot(interval, matY, label = ("L6(X)-%i" %(i)) )
        
    #Change Axis
    plt.axis([-0.6, 1.6, -5, 5], 'equal')

    #put horizontal and vertical lines for Axis
    plt.axhline(y=0, color='black')
    plt.axvline(x=0, color='black')

    # legen of the two plots in lower right hand corner
    plt.legend(loc='lower right')
    
    #save plot
    plt.show()
    #plt.savefig("Fx.svg")
    plt.savefig("fx.png")