wxMaxima in Economics

Applying the open-source computer algebra program to economic analysis

Text Workbooks

This page is under development. We have posted workbooks for all chapters, but we will continually revise the material.

This set of files contains all of the analytical material found in the text. It contains enough text material to provide a sense of the purpose of each cell’s content. You should refer to the text as you work through each file, as it contains more thorough explanations of the economics and how Maxima operates. Conversely, you should work through these files as you read the book.

For most chapters, the analytical material will appear in multiple workbooks. In a few, a single workbook contains all of the material. When multiple workbooks contain a chapter’s material, section headings are provided to indicate the location of the file in the book’s progression.

These workbooks are wxmx files, not wxm files. The former are a bit more portable in that wxm files can, in rare cases, fail to open in some variants of Linux. If you wish, you can save any workbook as a wxm file. The difference is that the wxmx file is a compressed folder that contains both the commands and the output for the last time the workbook’s commands were executed, unless the output has been deleted before the file was saved. Be aware that, though the output might appear when you open a wxmx file, the operations have not been carried out in the current session. Therefore, any values and relationships that executing the file is designed to establish are not in Maxima’s memory.

Chapter 1. Introduction

This chapter introduces Maxima and its graphic user interface wxMaxima. You will likely return to the files in this chapter as you work through material that appears later in the text.

  • The first file in the Chapter 1 folder, 0101_Intro.wxmx, contains the chapter’s first four sections. These sections introduce some basic aspects of Maxima commands, the screen for the wxMaxima user interface, mathematical functions expressed as Maxima input, and referring to and evaluating expressions.
  • The second file, 0102_SetsEquations.wxmx, contains the next two sections. These deal with sequences, lists, and sets. They also introduce using Maxima to solve equations and systems of equations. The material on solving equations addresses both analytical and numerical methods of obtaining solutions.
  • The third file, 0103_CalculusODEs.wxmx, contains calculus-related topics: differentiation, integration, and differential equations.
  • The fourth file, 0104_ManipulatePlot.wxmx, contains the last two sections. These deal with manipulation and graphing of expressions.

Chapter 2: Simple Economic Models

This chapter illustrates two models using Maxima: the production possibilities model and the supply and demand model of a single market. Four workbooks are used to show the content of Chapter 2 of the text. Some added material, including animation, is included. The first workbook illustrates production possibilities; the next three illustrate topics related to the simple model of a single market.

  • The first workbook, 0201ProductionPossibilities.wxmx, illustrates the production possibilities curve using a simple functional form that exhibits the bowed-out shape that is consistent with increasing opportunity cost, a concept which is also illustrated.
  • The second workbook, 0202DemandSupply.wxmx, introduces the simple model. It discusses equilibrium and the effects of shifts.
  • The third workbook, 0203Elasticities.wxmx, analyzes the price elasticity of demand for the product and how it determines the relationship between price and total spending on a good. It also expresses the effects of income and the price of a related good on the demand for a good in terms of elasticities. Finally, it examines the price elasticity of supply.
  • The final workbook, 0204Surpluses.wxmx, looks at the surpluses created by the exchanges that occur in a competitive market.

Chapter 3. Demand Theory: Preferences

This chapter develops two illustrative models of consumer preferences. In both cases, the consumer is treated as being able to compare any two bundles of two goods. Most of the chapter uses the Constant Elasticity of Substitution (CES) function to represent preferences. The final section uses a function that allows for a “bliss point” beyond which a person would not want any more of either good.

  • The first workbook, 0301UtilityFunction.wxmx, introduces the utility function and discusses its salient features.
  • The second workbook, 0302IndifferenceCurves.wxmx, represents the utility function using indifference curves. These will be paired with budget lines in Chapter to generate a simple model of consumer choice.
  • The third workbook, 0303BlissPoint.wxmx, replaces the CES functional form with one that allows for a bliss point, and it replicates the steps in the first two workbooks.

Chapter 4. Demand Theory: Constraints and Optimization

This chapter introduces budget constraints, which are combined with utility functions to illustrate the nature of optimization. It considers both homothetic and non-homothetic utility functions. After examining optimization when two goods are considered, the analysis extends to multiple goods, using the method of Lagrangian multipliers.

  • The first workbook, 0401Budget_Optimization.wxmx, introduces budget lines for two goods and develops the nature of optimization for the case of a homothetic utility function.
  • The second workbook, 0402Nonhomothetic_Inferior.wxmx, extends the analysis to non-homothetic functions. Among these is a class of functions that result in one good being inferior: for a given set of prices, its quantity changes in a direction opposite to income changes.
  • The third workbook, 0403MultipleVariables.wxmx, extends the analysis to multiple goods.

 Chapter 5. Preferences and Demand

This chapter extends the analysis to derive the implications of price changes, deriving demand curves from utility functions. It considers the CES function and a function that generates an inferior good and a subset of the inferior good, the Giffen good, for which the demand curve slopes upward.

  • The first workbook, 0501CESfunction.wxmx, shows the relationship between price and quantity when preferences are characterized by a CES utility function.
  • The second workbook, 0502GiffenGood.wxmx, does the same thing for a function that can generate a Giffen good.

Chapter 6: Production Theory

The material for this chapter consists of the workbook, ch06Production.wxmx. The first section introduces a production function that generalizes the Cobb-Douglas function, allowing variable returns to scale. The next section examines the function’s behavior when the ratio of the two inputs is held constant. The third section treats the case in which the ratio of inputs can be varied. The fourth section treats the final case, in which the employment level for one input is fixed and the employment level for the other input can vary. The final section recasts the material in terms of isoquants.

Chapter 7: Cost Theory

As with Chapter 6, a single workbook contains the material on which the text is based. That workbook is ch07Costs.wxmx. The workbook begins by examining the optimal input mix when input levels are freely variable. It then derives the implications that the optimality condition implies for cost when all inputs are variable (the long run).Then it examines the nature of cost curves when a single input’s employment can vary (the short run). Next, it restates the material in the preceding two sections in terms of isoquants and iso-cost lines. The last two, relatively short, sections examine fixed and variable costs in the short run and the notion that the long-run cost curve is a planning curve.

Chapter 8. Firm and Industry Supply in the Short-run

Again, a single file, ch08SupplyShortRun.wxmx, contains the Maxima material used in this chapter. The first section specifies a cost function that is used to illustrate the firm’s short-run behavior and the implications for the industry that it inhabits. The section section examines the implications of a cost curve and a revenue function for the firm’s behavior (i. e., the quantity that it produces). The third section addresses the important special case of the price-taking firm and derives the firm’s supply curve. It also shows the implied industry supply curve when the number of firms is fixed (the short run) and shows an equilibrium situation.

Chapter 9. Long-run Supply

In the long run, the number of firms can vary in response to profits or losses. The material used in the text appears in three workbooks.

  • The first workbook, ch0901ConstantCost.wxmx, considers the relatively simple case in which all firms are identical (have exactly the same cost curves) and the those cost curves are unaffected by the number of firms in the industry.
  • The second workbook, ch0902VariableCost.wxmx, keeps the assumption of identical cost curves but allows for the number of firms to affect those cost curves.
  • The final workbook, ch0903Non_IdenticalFirms.wxmx, replaces the assumption that all firms have identical cost curves with a functional relationship that generates unique cost curve for each firm. It does reinstate the assumption that these cost curves are not affected by the number of firms in the industry.

Chapter 10. Competitive Markets: Extensions and Application

Two workbooks contain the content for this chapter, which extends the analysis developed in Chapter 9.

  • The first workbook, 1001Shifts.wxmx, develops a framework for analyzing the effects of demand or supply shifts on the market price and quantity.
  • The second workbook, 1002Efficiency.wxmx, returns to the issue of economic efficiency, first raised in Chapter 2.

Chapter 11. General Equilibrium

The single workbook ch11GeneralEquilibrium.wxmx contains the Maxima material used in this chapter. It begins with a production model in which an economy consists of two competitive industries, each producing a single good and employ two resources. The resource supplies are fixed. The chapter examines the nature of efficiency in the model and concludes that the efficient outcomes coincide with the efficient outcomes, given the appropriate set of assumptions. It then examines consumption in a manner that largely follows the treatment of production. Finally, it determines the equilibrium values for the prices and quantities of the goods, for the payments to resource owners, and the values of Gross Domestic Product and, equivalently, Gross Domestic Income.

 Chapter 12. Price-Searcher Markets

This chapter’s Maxima material is spread over five workbooks. Two relate to simple monopoly. The other three relate to three types of cost curves in monopolistic competition: when all firms are identical and costs are not affected by the number of firms, when all firms are identical and costs are directly related to the number of firms in the industry, and when each firm has unique cost curves (which are not affected by the number of firms in the industry).

  • The first file, 1201Monopoly.wxmx, introduces the chapter and treats the case of simple monopoly. It extends the analysis to consider efficiency issues, including the implications of an excise tax on the monopolist’s product.
  • The second file, 1202UpwardSlopingMR.wxmx, treats an possible anomaly in a monopoly market, when the demand curve’s curvature generates a marginal revenue curve that slopes upward over some part of the output range.
  • The third file, 1203MonopCompConstCost.wxmx, introduces monopolistic competition and examines the simplest case in which all firms have identical cost curves that are independent of the number of firms in the industry. The section examines the effect on price of a demand shift, and it addresses efficiency issues.
  • The fourth file, 1204MonopCompIncreasingCost.wxmx, treats the cases in which the firms have identical cost curves, but these curves are directly affected by the number of firms in the industry.
  • The final file, 1205MonopCompUniqueCost.wxmx, treats the case in which each firm has unique cost curves.

Chapter 13.Nonlinear Pricing: Capturing Consumer Surplus

The firms examined in Chapter 12 engage in simple “linear” pricing. This chapter deals with ways in which firms can develop more sophisticated pricing schemes that add to their profits.

  • The first workbook, 1301Introduction.wxmx, reviews simple pricing and shows the potential for increasing profit by extracting consumer surplus and by reducing deadweight loss.
  • The second workbook, 1302FirstDegree.wxmx, discusses first-degree price discrimination and schemes under which firms can implement pricing schemes that enable them to approximate the advantages of this type of discrimination.
  • The third workbook, 1303SegmentedMarkets.wxmx, discusses third-degree price discrimination, in which a firm charges different prices in different market segments, with the prices depending on demand elasticities.
  • The final workbook, 1304ProductLine.wxmx, applies the logic that the third workbook develops to a firm that sells a line of products that are related via demand.

Chapter 14. Oligopoly

This chapter deals with the final sort of price-taking industry, oligopoly. It introduces game theory and applies a game-theoretic approach to three models of oligopoly in which the firms produce identical products: Cournot, Stackeberg, and Bertrand. It considers the same three models when the oligopolists’ products are similar but not identical.

  • The workbook 1401Cournot.wxmx introduces game theory and explains why it applies to an oligopolistic market. It develops the Cournot model and compares it to perfect competition and to pure monopoly.
  • The workbook 1402Stackelberg.wxmx develops the Stackelberg model and compares it to perfect competition and to pure monopoly.
  • The workbook 1403Bertrand.wxmx develops the Bertrand model and compares it to perfect competition and to pure monopoly.
  • The workbook 1404NonidenticalProducts.wxmx repeats the development of the three models, when the firms’ products are similar but not identical.

Chapter 15. Time

This chapter considers two aspects of time. The first involves the analysis of decisions whose effects have implications over time for costs or revenues. The second involves processes that play out over time, in a dynamic fashion. Four workbooks are used to provide the analytical material presented in this chapter.

  • The file 1501_02Intro_Review.wxmx contains the material in section 2 of the text. It reviews basics of compounding and discounting values.
  • The file 1503Investment.wxmx addresses investment decisions: investments by firms and human capital investments of individuals. It incorporates uncertainty, introducing the concept of the expected present value of an investment. It examines conditions under which “maximize the expected present value” might not lead to wealth maximization.
  • The file 1504HarvestRotation.wxmx examines a case in which an investment is in the growth of a population (forest or fishery, for example) and determines the conditions for selecting the length of the harvest rotation that results in maximum wealth.
  • The file 1505Dynamics.wxmx shows a model of a dynamic market. It highlights the importance that expectations play in such a market.


Chapter 16.Uncertainty

This chapter considers the making of decisions when the result of the decision cannot be known beforehand but can be characterized by a probability distribution function. Three files are used for this chapter.

  • The file 1601RiskPreferences.wxmx introduces risk aversion, explaining why a person would not be willing to pay an amount equal to the present value of a risky game to enter that game.
  • The file 1602MeasuringRiskAversion.wxmx examines some widely-used measures of risk aversion.
  • The file 1603Insurance.wxmx applies the analysis that the preceding two workbooks develop to the demand for insurance. Specifically, it shows how risk affects a consumer’s willingness to pay a premium for insurance.