Non-variable 2nd argument to DIFF:



Hello,

I'm a newbie who is trying to write a function that accepts a function in its 
argument list. Unfortunately, I'm failing, so:

/* Function to perform the numerical integration */
quad(order,func):=
    block([sum, x, w],
        sum:0,
        for i:0 thru order-1 do (
            x : legendre_root(order,i),
            w : gauss_legendre_weight(order,i),
            sum : sum + (w * func(x))),
        return(sum)
    )$

Ai11(xi):=phi1(xi)*V1*diff(phi1(xi)*A(xi,t),xi);
A11q:quad(4,lambda([xi],Ai11(xi)));

(%i336)             A11q : quad(4, LAMBDA([XI], Ai11(XI)))
Non-variable 2nd argument to DIFF:
ERREXP1

I can see what the problem is, but I have no idea about how to fix it. Any 
clues? (Full script attached.)

Regards,
Angus

Attached file: trial.mac