dp=Function[{f,g},Integrate[f*g,{x,-1,1}]]
nm=Function[f,Sqrt[dp[f,f]]]
dp[x^2,x^4]
nm[x]
w[0]=1
v[0]=w[0]/nm[w[0]]
w[1]=x-dp[v[0],x]*v[0]
v[1]=w[1]/nm[w[1]]
w[2]=x^2-dp[v[0],x^2]*v[0]-dp[v[1],x^2]*v[1]
v[2]= Expand[w[2]/nm[w[2]]]
N0=8
For[k=0,k<=N0,k++,
    w[k]=x^k;
    For[j=0,j<k,j++,
        w[k]=w[k]-dp[v[j],x^k]*v[j]];
    v[k]=Simplify[w[k]/nm[w[k]]];
    Print["v[",k,"]=",v[k]]]
Plot[v[5],{x,-1,1}]
R5=x/.Solve[v[5]==0,x]
R5n=N[R5,16]
Print[R5n]
