from argparse import ArgumentParser
from pysgpp.extensions.datadriven.uq.parameters.ParameterBuilder import ParameterBuilder
from pysgpp.extensions.datadriven.uq.plot.colors import insert_legend
from pysgpp.extensions.datadriven.uq.plot.plot1d import plotFunction1d
from pysgpp.pysgpp_swig import DataVector, CombigridOperation,\
CombigridMultiOperation, CombigridTensorOperation
import pysgpp
import os
import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import quad, dblquad
from pysgpp.extensions.datadriven.uq.dists import Uniform
from pysgpp.extensions.datadriven.uq.dists.Beta import Beta
from numpy import square
degree = 5
basis = pysgpp.SNakBsplineBoundaryCombigridBase(degree)
l1 = 1
i1 = 1
l2 = 1
i2 = 1
scalarProduct =
quad(
lambda x: basis.eval(l1,i1,x) * basis.eval(l2,i2,x), 0,1)
print(scalarProduct)
B00=[];B01=[]
B11=[]
B21=[];B23=[]
B31=[];B33=[];B35=[];B37=[]
B41=[];B43=[];B45=[];B47=[];B49=[];B411=[];B413=[];B415=[]
B51=[];B53=[];B55=[];B57=[];B59=[];B511=[];B513=[];B515=[];B517=[];B519=[];B521=[];B523=[];B525=[];B527=[];B529=[];B531=[]
X = np.linspace(0,1,250)
for i in range(0,len(X)):
B00.append(basis.eval(0,0,X[i])); B01.append(basis.eval(0,1,X[i]));
B11.append(basis.eval(1,1,X[i]))
B21.append(basis.eval(2,1,X[i])); B23.append(basis.eval(2,3,X[i]))
B31.append(basis.eval(3,1,X[i])); B33.append(basis.eval(3,3,X[i])); B35.append(basis.eval(3,5,X[i])); B37.append(basis.eval(3,7,X[i]))
B41.append(basis.eval(4,1,X[i])); B43.append(basis.eval(4,3,X[i])); B45.append(basis.eval(4,5,X[i])); B47.append(basis.eval(4,7,X[i]));B49.append(basis.eval(4,9,X[i])); B411.append(basis.eval(4,11,X[i])); B413.append(basis.eval(4,13,X[i])); B415.append(basis.eval(4,15,X[i]))
B51.append(basis.eval(5,1,X[i])); B53.append(basis.eval(5,3,X[i])); B55.append(basis.eval(5,5,X[i])); B57.append(basis.eval(5,7,X[i]));B59.append(basis.eval(5,9,X[i])); B511.append(basis.eval(5,11,X[i])); B513.append(basis.eval(5,13,X[i])); B515.append(basis.eval(5,15,X[i])); B517.append(basis.eval(5,17,X[i])); B519.append(basis.eval(5,19,X[i])); B521.append(basis.eval(5,21,X[i])); B523.append(basis.eval(5,23,X[i]));B525.append(basis.eval(5,25,X[i])); B527.append(basis.eval(5,27,X[i])); B529.append(basis.eval(5,29,X[i])); B531.append(basis.eval(5,31,X[i]))
fig = plt.figure()
plt.plot(X,B41);plt.plot(X,B43);plt.plot(X,B45);plt.plot(X,B47);plt.plot(X,B49);plt.plot(X,B411);plt.plot(X,B413);plt.plot(X,B415)
plt.xticks(np.linspace(0, 1, 2**4 + 1))
plt.show()