Asked by yashika dhote
on 11 Feb 2019

Hello All,

Can we determine ortho-normal basis vectors for polynomial functions series, like f(x) =[x, x^2, x^4.......x^100].

I tried function orth for the same but i guess it is not for matrices and not for functions.

Answer by John D'Errico
on 11 Feb 2019

Accepted Answer

Of course orth is not designed to solve that problem, since it uses linear algebra.

Nothing stops you from writing an orthognalization code. Of course, you will be unable to do so using double precision arithmetic, because you will rapidly run into numerical problems, long before you get that high. (So my own sympoly toolbox would fail quickly.)

You could do it using symbolic tools. But why? A family of orthogonal polynomials already exists in the form of the Legendre polynomials. Ok, I suppose the set you have provided does not include the zero'th order term, a constant. I'm not sure if you just decided not to do so, or if that was by choice.

Or, do you have some other weight function, than one of the standard choices?

For example, suppose you decided to use syms. I'll pick an arbitrary interval of [-1,1], since unless a weight function is used with the correct properties, OR you have a finite interval, no such orthogonalization will be possible.

For example, suppose we start with the family

syms x

n = 5;

P = x.^(1:n);

that we wish to be orthonormal on the interval [-1,1]. Start with P(1).

Q(1) = P(1);

Q(1) = Q(1)/sqrt(int(P(1)^2,[-1,1]))

Q =

[ (2^(1/2)*3^(1/2)*x)/2, 0, 0, 0, 0]

So Q(1) is properly normalized. We can test that fact.

sqrt(int(Q(1)^2,[-1,1]))

ans =

1

for i = 2:n

Q(i) = P(i);

for j = 1:i-1

Q(i) = Q(i) - Q(j)*int(Q(i)*Q(j),[-1,1]);

end

Q(i) = Q(i)/sqrt(int(Q(i)^2,[-1,1]));

end

Which all seems pretty simple to me.

int(Q(5)^2,[-1,1])

ans =

1

vpa(Q(5),5)

ans =

18.469*x^5 - 20.521*x^3 + 4.3973*x

vpa(Q(4),5)

ans =

7.4246*x^4 - 5.3033*x^2

So an orthognal basis of the family in P. WTP? Yes, if you want to go as high as n=100, things will get messy.

yashika dhote
on 12 Feb 2019

John D'Errico
on 12 Feb 2019

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.