Guessing the Legendre Polynomial Expansion of a Function
By Corinne Manogue and Kerry Browne
Copyright 2000 Corinne Manogue

f[z__]=(1/8)-z-(33/4)*z^2+(105/8)*z^4

Look at the function f(z) plotted below

Plot[f[z],{z,-1,1},PlotStyle->{Red},AxesLabel->{"z"}]

It is a linear combination of P(l,z) for different values of l, i.e.
f(z)=(Subscript[c, 0])(Subscript[P, 0])(z)+(Subscript[c, 1])(Subscript[P, 1])(z)+(Subscript[c, 2])(Subscript[P, 2])(z)+(Subscript[c, 3])(Subscript[P, 3])(z)+...

Your job is to guess the values of the coefficients (Subscript[c, l]).  To make your job a little easier, I have put in only 3 nonzero terms, all of the coefficients are positive or negative integers, and I have not included any terms for l>4.

Look at the (Subscript[P, l])(z)'s
You might want to start by plotting  for various values of l if you don't remember what this function looks like:

Plot[LegendreP[2,z],{z,-1,1},AxesLabel->{"z"}]

Guess the most important terms
Plot your guess and the function f(z) on the same graph.  Keep guessing more and more terms until the graph for your guess and the graph for f(z) completely coincide.  For Example:

myguess=2*LegendreP[2,z]

plotmyguess:=Plot[myguess,{z,-1,1},AxesLabel->{"z"},PlotStyle->{Blue}]
plotf:=Plot[f[z],{z,-1,1},AxesLabel->{"z"},PlotStyle->{Red}]
Show[plotmyguess,plotf]