Question: How to input calculated coefficients to corresponding terms in a summation

I have calculated coefficients in maple using a "for...end do" command. For example,


for n from 0 to 1 do A[n] = int(((2*n+1)*(1/2))*simplify(LegendreP(n, cos(theta)))*sin(theta), theta = 0 .. (1/2)*Pi) end do;


A[0] = 1/2

A[1] = 3/4

 

Here, I can calculate as many coefficients as I want. But, how do I use these coefficients in the following line? For example, I need to calculate a summation. But for each term in the summation, I want to input the coefficients above to the corresponding term in the sum. So. the following summation

 A[0]+A[1]*r*cos(theta)+...

will automaticlly attach the numerical values of the coefficients calculated above to the corresponding term in the sum.

 

I hope this makes sense.

Please Wait...