On 2/1/07, Viktor Nagy <viktor.nagy at gmail.com> wrote:
> I would like to have a simple Lagrangian with an index, like
> L[i] : x[i]^(1-alfa)*sum(g[i],i,1,2)^alfa - lambda[i]*(g[i]+x[i]-m[i]);
>
> And after when solving, I have to take the derivatives, but given that
> the sum(g[i],i,1,2) is evaluated to g1+g2, when I take
> diff(L[i],g[i]), I get only -lambda[i], instead of alfa *
> x[i]^(1-alfa) * sum(g[i],i,1,2)^(alfa-1)-lambda[i].
It might not be possible to convince Maxima to do the right thing here.
It appears you want to see 1 as the result of diff(g[1] + g[2], g[i]) but
Maxima says that is 0, and I don't know how to convince it otherwise.
You might be able to make some progress by writing
L[i] := ... (i.e. a subscripted function; note that L[i] : ... defines exactly
one value, L sub literal i, which is not related to L[1] and L[2] so far
as Maxima knows), and also by writing 'diff(...) (i.e. postpone the
differentiation, until i has a known integer value).
Hope this helps. Seems like an interesting problem -- best of luck.
Robert Dodier