Question: Calculating function values for function produced by procedure

December 06 2013 Jeroen 5



First of all, I've searched already a bit around, but couldn't find a similar topic, so I thought I'd open a new one. Also, English isn't my main language, so terminology may be wrong, but I hope you'll still understand what I want to say.

So, I have this procedure:

functions:= proc(n)
local L, list, p, f, sum, i, part, g, normg, x:

for p from 2 to n do
f := x**(p-1):
sum := 0:

for i from 1 to (p-1) do
part:= int(list[i]*f*(x+1),x=-1..1)*list[i]:
sum := sum + part:
end do:

g:= f-sum:
normg:= sqrt(int(g^2*(x+1),x = -1..1)):
list := [op(list), unapply(L,x)]:
end do:
end proc:

What this procedure does, is calculating n orthonormal functions (but that doesn't really matter here). The result is a list of functions, or should be. What I get when I enter e.g. functions(5), is a list of very weird functions with 'nexpr' and more, instead of some polynomials.
When I replace the 'unapply(L,x)' in the 4th last line by just 'L', I do get the correct expressions, but I can't manage to calculate the function values for those. The expression just gets returned. By the way, I can't do that in the situation before the edit either.

So what I eventually want to do, is calculating some function values for each function in the list, or (if this isn't the right terminology) in Maple code e.g.:

f:= x -> x^2 + 3*x;
(The result should be 18 in this case)

Could someone help me? :)


Please Wait...