associated legendre functions matlab

조회 수: 8 (최근 30일)
chaitanya acharya
chaitanya acharya 2019년 12월 7일
댓글: David Goodmanson 2020년 4월 17일
In the function legendre(1,-0.7071), the value corresponding to P11(-0.7071) is coming wrong when checked with standard solutions. Matlab is giving the solution as -0.7071. whereas, the actual solution is +0.7071. Please have a look at it. Or please suggest me how to correct it.
One can verify using online calculator in the link. https://keisan.casio.com/exec/system/1287453184
  댓글 수: 6
Tomy Duby
Tomy Duby 2020년 4월 16일
The issue is caused by two different definitions of associated Legendre polynomials:
  • with non-negative integers.
  • is the definition DLMF (Digital Library of Mathematical Functions) and Matlab are using.
The relation between the two definitions for real x is:
This relation is in the printed edition of Abramowitz and Stegun. I could not find it in DLMF.
I hope this helps.
TD
David Goodmanson
David Goodmanson 2020년 4월 17일
Hi Tony,
That's yet another reason why Abramowitz and Stegun is a better book than DLMF. There is a cornocopia of useful equations in A&S, and when they did DLMF you would think they would have supplemented those to make it even better. Instead they threw out a bunch of them and refer you to reference book blah blah blah if you want to find what you need. No excuse for that.

댓글을 달려면 로그인하십시오.

채택된 답변

David Goodmanson
David Goodmanson 2019년 12월 7일
Hi chaitanya,
It's apples and oranges. When the domain of the argument is -1 <= x <= 1, the function is -sqrt(1-x^2). That's what Matlab is doing, and that's what it says it is doing. When the domain is opened up, 0 <= theta < 2pi with x = cos(theta), then the function can become -sin(theta). Both results are in Wikipedia.
  댓글 수: 1
chaitanya acharya
chaitanya acharya 2019년 12월 9일
Run this code: you will understand where the problem is occuring.
theta=linspace(0,2*pi,9);
phi=0;
n=1; m=1;
% legendre calculated from matlab
leg1=legendre(1,cos(theta));
leg_matlab=leg1(m+1,:);
% legendre analytical solution for cos(theta) at n=1 and m=1 is -sin(theta)
leg_analytical=-sin(theta);
figure(1)
plot(leg_matlab)
hold on
plot(leg_analytical)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Time Series에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by