Message Boards Message Boards

1 Reply
2 Total Likes
View groups...
Share this post:

what is wrong with this Mathematica code?

Posted 10 years ago

I have written the attached Mathematica code for a general equilibrium model? However, I am having problems with running it. The subscripts and superscripts create problem and even sometime a simple assignment n=30 does not work and if it works then I cannot Clear[n].


POSTED BY: Tugrul Temel
Posted 10 years ago

If I use Notepad to inspect just the first line of your notebook then I see

Clear[Subscript[\[Alpha], 1], Subscript[\[Alpha], 2], \[Gamma], \[Eta], \[Mu], \[Theta], \[Lambda], \[Epsilon], 
  Subscript[\!\(\*SubscriptBox[\(\[Tau]\), \(\[InvisibleComma]\)]\), K], Subscript[\!\(\*SubscriptBox[\(\[Tau]\),
  \(\[InvisibleComma]\)]\), L], Subscript[\[Delta], 1], Subscript[\!\(\*SubscriptBox[\(\[Delta]\), \(\[InvisibleComma]\)]\), 2],
  \[Phi],Subscript[g, 1\[InvisibleComma]0], Subscript[g, 2\[InvisibleComma]0], Subscript[w, 1], Subscript[r, 1], n, 
  \!\(\*OverscriptBox[\(K\), \(_\)]\), \!\(\*OverscriptBox[\(L\), \(_\)]\)];

It appears that you have desktop published your notation to the point where it looks so good that it is nonfunctional.

If I comment out the items containing SubscriptsBoxes, etc in that line then I can at least get past the first wave of warnings and error messages.

Then inside your first dynamicSolution = Table[{... if I comment out all the code starting with

(* , Subscript[r, t + 1] = Subscript[\[Alpha], 1]...

then I can get some results in your table while if I instead comment out all the code starting with the next line

(* , Subscript[\!\(\*SubscriptBox[\(w\), \(\[InvisibleComma]\)]\),  t + 1] = (1 - Subscript[\[Alpha], 1]) ...

then the calculation appears to go into an infinite loop.

I sincerely tried three times to hack your code into something that would work, didn't depend on subscripts and which would still make all your variable names depend on t. I'm sorry. I failed.

POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract