I have a system of K equations, that I would like to solve as a
function of K. As I could not figure out a way of doing it "directly"
in maxima, I used the "human" way of solving it: express a variable,
and substitute it in the next equation, then loop this.
Finally, this recursion gives a relatively simple equation, shown in
the next 4 lines (lines 1, 2, 4).
But when I solve the whole system, maxima always expands the f(k)
function. How can I ask her to leave f(k) as f(k)?
(To give some meaning to all this. It's a pricing question in
ecomonics, so p[i] is the price set by the ith firm. Kim1, Kip1 stands
for K_i-1, K_i+1 respectively.)
Here is my code:
f(k) := (2+sqrt(3))^k-(2-sqrt(3))^k$
ci(k) := ((1-sqrt(3))*(sqrt(3)*f(k)-6))/(6*(N+L)^2)$
cj(k) := ((1-sqrt(3))*(sqrt(3)*f(k)-6))/(6*(N-L)^2)$
pi(k) := sqrt(3)/6*(f(k-1)*p[2]-f(k-2)*p[1])+ci(k-1)$
/*
we can express K_i, K_i-1 from the recursion
then K_i+1, K_i+2 from the FOC of K_i and K_i+1 respectively
then we can use the recursion to get K_j
*/
p[Kim1] : pi(Ki-1)$
p[Ki] : pi(Ki)$
p[Kip1] : 2*((N+L)*d1+1)*p[Ki]-d1*(N+L)*p[Kim1]-(d1*(d1+1))/(N+L)-(vi-vj)$
p[Kip2] : 2*((N-L)*d1+1)/(d1*(N-L))*p[Kip1]-(p[Ki]+(vi-vj))/(d1*(N-L))-(d1+1)/(N-L)^2$
pj(k) := sqrt(3)/6*(f(k-1)*p[Kip2]-f(k-2)*p[Kip1])+cj(k-1)$
p[Kj] : pj(Kj)$
p[Kj-1] : pj(Kj-1)$
/*
now use the FOC of p[Kj] to express p[1]
similarly, express p[1] by substituting p[Kj] into the FOC of p[1]
finally, solve for p[2]
*/
zeta[i0] : (d0*(d0+1))/(2*(N+L)*((N+L)*d0+1))+(vi-vj)/(2*((N+L)*d0+1))$
zeta[j0] : (d0*(d0+1))/(2*(N-L)*((N-L)*d0+1))-(vi-vj)/(2*((N-L)*d0+1))$
focKj : p[Kj]=zeta[j0]+(p[Kj-1]*d0*(N-L)+p[1])/(2*((N-L)*d0+1))$
foc1 : p[1]=zeta[i0]+(p[2]*d0*(N+L)+p[Kj])/(2*((N+L)*d0+1))$
solve([focKj, foc1], [p[1], p[2]]);
thanks for your help!
V