Mathematica Asked by Pino Savana on July 30, 2021
I am a Mathematica beginner. I am trying to solve an economics optimisation problem by using the lagrangian method.
So I formalised my problem in the following way:
budget = P[t]*Cs[t] + Q[t]*B[t] - B[t - 1] - W[t]*NN[t] - T[t];
L[Cs_, l_, B_, P_, Q_, W_, NN_, T_] = Sum[β^t*{(Cs[t]^(1 - sigma)/(1 - sigma) - l[t]^(phi + 1)/(phi + 1)) - budget*λ[t]}, {t, 0, Infinity}];
When Mathematica takes the derivative generalises it across all the t and puts a kronecker delta as sort of ‘if’ operator. How can I simplify it in order to have the derivative taken at a given t (e.g. t==1)?
D[L[Cs, l, B, P, Q, W, l, T], B[t]]
Sum[(-β^K[1])*(-KroneckerDelta[t, -1 + K[1]] + KroneckerDelta[t, K[1]]*Q[K[1]])*λ[K[1]], {K[1], 0, Infinity}]
I'm also new to mathematica (and stack-exchange) so take this with a grain of salt, but I think you should be able to evaluate the derivative at e.g. t = 1 with
D[L[Cs, l, B, P, Q, W, l, T], B[t]] /. t -> 1
this results in
{-[Beta] Q[1] [Lambda][1] + [Beta]^2 [Lambda][2]}
Correct answer by markus_hofer on July 30, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP