math Legendre problem

2 次查看(过去 30 天)
George
George 2012-4-1
Initial conditions p(0)=1 and p(1)=x , we also have that p(n+1)=((2*n+1)*x*p(n)-n*p(n-1))/(n+1).
As we all know, matlab cannt start from p(0), therefor i do this :
p(1)=1, p(2)=x and p(n)=((2*n-1)*x*p(n-1)-(n-1)*p(n-2))/n
but i DON'T take the same results and i don't know the reason !! As you see i am working with Legendre Polynomials !!
Thanks !!

采纳的回答

Geoff
Geoff 2012-4-1
That's almost right, but wherever you had p(n) etc, you shouldn't adjust n. You should only have subtracted 1 from the instances of n that are on their own. So change all your p(??) bits back to their original values and it should work.
  4 个评论
George
George 2012-4-1
can you please write down the formula ??? Thanks !!
George
George 2012-4-1
p(k+2) = ((2*k+1)*x*p(k+1) - (k)*p(k))/(k+1) ;
i think i've got it right now !!!! THANKS !!!!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Polynomials 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by