I am working with an equation from a book and it works when I used Mathematica to solve it. It essentially contains the integral of certain orders of Legendre polynomials. E.g. P_1(x), P_2(x), P_3(x).
When I use Mathematica for a particular case e.g.
LegendreP[3, 0.5]
I get
-0.4375
which allows me to continue with my evaluation. But in MATLAB I get:
>> legendre(3,0.5)
ans =
-0.4375
-0.3248
5.6250
-9.7428
The first returned value is always correct but then it spits out... I think the other coefficients? So what I would like to do is tell MATLAB just to return the first value. Is there a way to do this without assigning it to its own variable afterwards? Eg. something like
legendre(3,0.5)(1)
Obviously wont work because it doesn't exist in memory yet. Am I even going about this the right way?
Thanks