help! where a function was expected.



>   Date: Fri, 22 Nov 2013 12:55:09 +0800
>   From: elan sun <skf0558 at gmail.com>
>
>
>   hi:
>   I have a script but some thing ,solve ode use series.
>   rightfun(x):=taylor(sin(x),x,0,5);
>   yp(x):=diff(ys(x),x);
>   ydp(x):=diff(ys(x),x,2);

You should write

define(yp(x), diff(ys(x),x));
define(ypp(x), ...);

after you have defined yp. Otherwise, you will end up with mysterious
messages about diff and constants.

>   eqn1:ydp(x)+2*yp(x)+ys(x)-sin(x)=0;
>   c:[1,0,-1/2,1/2,-5/24,1/20];
>   ys(x):=sum(c(n)*x^n,n,0,5);

You likely want c[n] or part(c,n) in your sum.

>   sequ:lhs(eqn1);
>   subst(seqn,makelist(c(i),i,0,5));

The error message is due to the fact that Maxima reads c(i), evaluates
c to the list you stored in c above, and then Maxima is confused
because it sees a list where a function name should be. Again, you want

c[i] or part(c,i)

to access the i-th element of the list c.

>
>   an error is:
>    apply: found c evaluates to [1,0,-1/2,1/2,-5/24,1/20] where a function was
>   expected.
>    what's matter

Explained above.

HTH, Leo.