hi,
I would like to create a list of Legendre polynomials... so, I tried this :
list_of_poly(degree):=(
load(orthopoly),
block([l:[]],
for i:0 thru degree do (
l:cons(legendre_p(i,x),l)
),
l:reverse(l),
return(l)
)
)$
but I can't evaluate polynomials :
l:list_of_poly(3)
l[2](5)
doesn't work (has I want !!)
it returns x(5) but I want 5 :
l[2] holds polynomial "x" -> when I write l[2](5) I would like 5
I also tried :
list_of_poly2(degree):=(
load(orthopoly),
block([l:[]],
for i:0 thru degree do (
l:cons(lambda([x], legendre_p(i,x)),l)
),
l:reverse(l),
return(l)
)
)$
now, I can evaluate polynomials but "i" is not evaluate :
l:list_of_poly2(3)
l[2](5)
returns "legendre_p(i, 5)"
How I can store functions in lists and evaluate them ?
Thanks