- #1
member 428835
Hi PF!
I'm doing several operations involving integrating Legendre polynomials. Since I am trying to loop through, my approach is something like
where I then perform Gram-Schmidt over each ##v## vector. Desired accuracy implies I need to have ##x## have about 1000 components (actually more). I would like to do this symbolically, but I'm unsure how to build ##v## as a function handle (the looping is throwing me off). Any help?
I have it working well in Mathematica, but it's a little slower than I'd prefer.
I'm doing several operations involving integrating Legendre polynomials. Since I am trying to loop through, my approach is something like
Code:
N = 5;
a = 0.5;
x =linspace(-1,1,100);
for k=1:N
v(:,k) = legendreP(k+1,x)-legendreP(k+1,a)/legendreP(1,a)*legendreP(1,x);
end% for j
where I then perform Gram-Schmidt over each ##v## vector. Desired accuracy implies I need to have ##x## have about 1000 components (actually more). I would like to do this symbolically, but I'm unsure how to build ##v## as a function handle (the looping is throwing me off). Any help?
I have it working well in Mathematica, but it's a little slower than I'd prefer.