# Symbolic Associated Legendre Polynomials

30 views (last 30 days)
Marko Simic on 21 Jul 2020
Edited: masoud nazari on 2 Aug 2021
Hello!
I am trying to create the symbolic associated legendre polynomials of degree n and order m.
I found this forum entry: https://www.mathworks.com/matlabcentral/answers/9485-how-do-i-specify-m-for-orthpoly-legendre but unfortunately MuPad has been removed and I have no idea how I can implement that in the same way.
Is there any possibility? The function legendreP gives me only the unassociated legendre polynomial.
I am currently using Matlab R2018a with the Symbolic Toolbox.

masoud nazari on 2 Aug 2021
Edited: masoud nazari on 2 Aug 2021
associated Legendre functions could be found from Legendre functions according to the following formula
so in MATLAB you can define a function like this
function plm = assocLegendre(l,m)
% get symbolic associated legendre function P_lm(x) based on
% legendre function P_l(x)
syms x;
% get symbolic form of Legendre function P_l(x)
leg = legendreP(l,x);
% differentiate it m times
legDiff = diff(leg,x,m);
% calculate associated legendre function P_lm(x)
plm = ((-1)^m)*((1 - x^2)^(m/2))*legDiff;
end
to get associated Legendre functions in symbolic form.

R2018a

### Community Treasure Hunt

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

Start Hunting!

Translated by