How can I append output to a list then plot the list.
- To: mathgroup at smc.vnet.net
- Subject: [mg45800] How can I append output to a list then plot the list.
- From: "T.S. Kochanski" <tskochanski at yahoo.com>
- Date: Mon, 26 Jan 2004 01:53:06 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Below I have an excerpt from a program that solves a profit maximizing problem and reports the profits of firm 1 then firm 2. I would like to add an additional element to this. I would like to assume firm 1 has developed technology that decreases costs by a certain amount every time period (iteration). As a result, although both firms made equal profits in the first time period, firm 1 will enjoy increased profits over time while firm 2's profits will remain constant. I have generated the appropriate output but I can't get my code to work so that I can plot both profit functions (firm 1 and firm 2) out together on the same graph. can anyone make any sense out of the code provided below? CODE ===== (list1=Table[{x,x1},{x,1,10,1}]; list2=Table[{x,x2},{x,1,10,1}];); For[i=1,i<5,i++,Print[CournotProfit1]; Print[CournotProfit2]; Cost1=Cost1-.1Cost1; Print["new cost firm1"]; Print[Cost1]; CournotProfit1=Simplify[q1cournot*(Pcournot-Cost1)]; CournotProfit2=Simplify[q2cournot*(Pcournot-Cost2)]; x1=CournotProfit1; x2=CournotProfit2; Append[list1,x1]; Append[list2,x2]] MultipleListPlot[list1,list2] OUTPUT (profits for firm 1 and firm 2 over time (iterations)) ======= 7.11111 7.11111 7.64444 7.11111 8.12444 7.11111 8.55644 7.11111 etc.... ||||||||||||||||||||||||||||||||||||||||||||||||| Timothy S. Kochanski M.S. Economics Eugene, Oregon (541) 543-9742 "Success is going from failure to failure without a loss of enthusiasm." Sir Winston Churchill |||||||||||||||||||||||||||||||||||||||||||||||||||| --------------------------------- Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it!