1. Trang chủ
  2. » Thể loại khác

The Expenditure Output Model

34 138 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 34
Dung lượng 7,52 MB

Nội dung

Tutorial – XML Programming in Java Section 3 – The Document Object Model (DOM) 9 Section 3 – The Document Object Model (DOM)    Dom, dom, dom, dom, dom,    Doobie-doobie,       Dom, dom, dom, dom, dom… The DOM is a common interface for manipulating document structures. One of its design goals is that Java code written for one DOM-compliant parser should run on any other DOM-compliant parser without changes. (We’ll demonstrate this later.) As we mentioned earlier, a DOM parser returns a tree structure that represents your entire document. Sample code Before we go any further, make sure you’ve downloaded our sample XML applications onto your machine. Unzip the file xmljava.zip, and you’re ready to go! (Be sure to remember where you put the file.) DOM interfaces The DOM defines several Java interfaces. Here are the most common: • Node: The base datatype of the DOM. • Element: The vast majority of the objects you’ll deal with are Elements. • Attr: Represents an attribute of an element. • Text: The actual content of an Element or Attr. • Document: Represents the entire XML document. A Document object is often referred to as a DOM tree. Section 3 – The Document Object Model (DOM) Tutorial – XML Programming in Java 10 Common DOM methods When you’re working with the DOM, there are several methods you’ll use often: • Document.getDocumentElement() Returns the root element of the document. • Node.getFirstChild() and Node.getLastChild() Returns the first or last child of a given Node. • Node.getNextSibling() and Node.getPreviousSibling() Deletes everything in the DOM tree, reformats your hard disk, and sends an obscene e-mail greeting to everyone in your address book. (Not really. These methods return the next or previous sibling of a given Node.) • Node.getAttribute(attrName) For a given Node, returns the attribute with the requested name. For example, if you want the Attr object for the attribute named id, use getAttribute("id"). <?xml version="1.0"?> <sonnet type="Shakespearean"> <author> <last-name>Shakespeare</last-name> <first-name>William</first-name> <nationality>British</nationality> <year-of-birth>1564</year-of-birth> <year-of-death>1616</year-of-death> </author> <title>Sonnet 130</title> <lines> <line>My mistress’ eyes are . Our first DOM application! We’ve been at this a while, so let’s go ahead and actually do something. Our first application simply reads an XML document and writes the document’s contents to standard output. At a command prompt, run this command: java domOne sonnet.xml This loads our application and tells it to parse the file sonnet.xml. If everything goes well, you’ll see the contents of the XML document written out to standard output. The domOne.java source code is on page 33. Tutorial – XML Programming in Java Section 3 – The Document Object Model (DOM) 11 public class domOne { public void parseAndPrint(String uri) . public void printDOMTree(Node node) . public static void main(String argv[]) . domOne to Watch Over Me The source code for domOne is pretty straightforward. We create a new class called domOne; that class has two methods, parseAndPrint and printDOMTree. In the main method, we process the command line, create a domOne object, and pass the file name to the domOne object. The domOne The Expenditure-Output Model The Expenditure-Output Model By: OpenStaxCollege (This appendix should be consulted after first reading The Aggregate Demand/ Aggregate Supply Model and The Keynesian Perspective.) The fundamental ideas of Keynesian economics were developed before the AD/AS model was popularized From the 1930s until the 1970s, Keynesian economics was usually explained with a different model, known as the expenditure-output approach This approach is strongly rooted in the fundamental assumptions of Keynesian economics: it focuses on the total amount of spending in the economy, with no explicit mention of aggregate supply or of the price level (although as you will see, it is possible to draw some inferences about aggregate supply and price levels based on the diagram) The Axes of the Expenditure-Output Diagram The expenditure-output model, sometimes also called the Keynesian cross diagram, determines the equilibrium level of real GDP by the point where the total or aggregate expenditures in the economy are equal to the amount of output produced The axes of the Keynesian cross diagram presented in [link] show real GDP on the horizontal axis as a measure of output and aggregate expenditures on the vertical axis as a measure of spending 1/34 The Expenditure-Output Model The Expenditure-Output Diagram The aggregate expenditure-output model shows aggregate expenditures on the vertical axis and real GDP on the horizontal axis A vertical line shows potential GDP where full employment occurs The 45-degree line shows all points where aggregate expenditures and output are equal The aggregate expenditure schedule shows how total spending or aggregate expenditure increases as output or real GDP rises The intersection of the aggregate expenditure schedule and the 45-degree line will be the equilibrium Equilibrium occurs at E0, where aggregate expenditure AE0 is equal to the output level Y0 Remember that GDP can be thought of in several equivalent ways: it measures both the value of spending on final goods and also the value of the production of final goods All sales of the final goods and services that make up GDP will eventually end up as income for workers, for managers, and for investors and owners of firms The sum of all the income received for contributing resources to GDP is called national income (Y) At some points in the discussion that follows, it will be useful to refer to real GDP as “national income.” Both axes are measured in real (inflation-adjusted) terms The Potential GDP Line and the 45-degree Line The Keynesian cross diagram contains two lines that serve as conceptual guideposts to orient the discussion The first is a vertical line showing the level of potential GDP Potential GDP means the same thing here that it means in the AD/AS diagrams: it refers to the quantity of output that the economy can produce with full employment of its labor and physical capital 2/34 The Expenditure-Output Model The second conceptual line on the Keynesian cross diagram is the 45-degree line, which starts at the origin and reaches up and to the right A line that stretches up at a 45-degree angle represents the set of points (1, 1), (2, 2), (3, 3) and so on, where the measurement on the vertical axis is equal to the measurement on the horizontal axis In this diagram, the 45-degree line shows the set of points where the level of aggregate expenditure in the economy, measured on the vertical axis, is equal to the level of output or national income in the economy, measured by GDP on the horizontal axis When the macroeconomy is in equilibrium, it must be true that the aggregate expenditures in the economy are equal to the real GDP—because by definition, GDP is the measure of what is spent on final sales of goods and services in the economy Thus, the equilibrium calculated with a Keynesian cross diagram will always end up where aggregate expenditure and output are equal—which will only occur along the 45-degree line The Aggregate Expenditure Schedule The final ingredient of the Keynesian cross or expenditure-output diagram is the aggregate expenditure schedule, which will show the total expenditures in the economy for each level of real GDP The intersection of the aggregate expenditure line with the 45-degree line—at point E0 in [link]—will show the equilibrium for the economy, because it is the point where aggregate expenditure is equal to output or real GDP After developing an understanding of what the aggregate expenditures schedule means, we will return to this equilibrium and how to interpret it Building the Aggregate Expenditure Schedule Aggregate expenditure is the key to the expenditure-income model The aggregate expenditure schedule shows, either in the form of a table or a graph, how aggregate expenditures in the economy rise as real GDP or national income rises Thus, in thinking about the components of the aggregate expenditure line—consumption, investment, government spending, exports and imports—the key ... Chapter 17. The Document Object Model document object model (DOM) is an application programm g interface (API) for a document (such as an HTML docum m g s elements (such as HTML tags f text) at make up ocument. JavaScript-enabled web browsers have always defi ed a document object a web-browse ay specify, ple, that the forms in an HTML ocument are accessible through the forms[] array of the Document object. In this chapter, we'll discuss the W3C DOM, a standard document object model defined by the World Wide Web Consortium and implemented (at least partially) by Netscape 6 and Internet Explorer 5 and 6. This DOM standard [1] A in representing he variou ent) and accessing and nd strings o anipulatin att d a th n th model; r DOM m for exam d is a full-featured superset of the traditional web-browser DOM. It represents HTML (and XML) documents in a tree structure and defines properties and methods for traversing the tree and examining and modifying its nodes. Other portions of the standard specify techniques for defining event handlers for the nodes of a document, working with the style sheets of a document, and manipulating contiguous ranges of a document. [1] Technically, the W3C issues "recommendations." These recommendations serve the same purpose and carry the same weight as international standards do, however, and are called "standards" in this book. This chapter begins with an overview of the DOM standard and then describes the core portions of the standard for working with HTML documents. The discussion of the core standard is followed by short sections that explain the DOM-like features of Internet s of nced HTML documents have a hierarchical structure that is represented in the DOM as a tree structure. The nodes of the tree represent the various types of content in a document. The tree representation of an HTML document primarily contains nodes representing elements or tags such as <body> and <p> and nodes representing strings of text. An HTML document may also contain nodes representing HTML comments. [2] Explorer 4 and Netscape 4. The chapter ends with an overview of two optional part the DOM standard that are closely related to the core. Later chapters cover adva DOM features for working with style sheets and events. 17.1 An Overview of the DOM The DOM API is not particularly complicated, but before we can begin our discussion of programming with the DOM, there are a number of things you should understand about the DOM architecture. 17.1.1 Representing Documents as Trees Consider the following simple HTML document: [2] The DOM can also be used to represent XML documents, which have a more complex syntax than HTML documents, and the tree representation of such a document may contain nodes that represent XML entity references, processing instructions, CDATA sections, and so on. Most client-side JavaScript programmers do not need to use the DOM with XML documents, and although the XML-specific features of the DOM are covered in the DOM reference section, they are not emphasized in this chapter. <html> <head> <title>Sample Document</title> <h1>An HTML Document</h1> <p>This is a <i>simple</i> document. </body> </html> The DOM representation of this document is the tree pictured in Figure 17-1 </head> <body> . Figure 17-1. The tree 4 The Three Layer Model 4.1 Introduction "The information superhighway directly connects millions of people, each both a consumer of information and a potential provider. If their exchanges are to be efficient, yet protected on matters of privacy, sophisticated mediators will be required. Electronic brokers can play this important role by organizing markets that promote the efficient production and consumption of information." from [RESN95] Although the Internet provides access to huge amounts of information, the information sources, at this moment, are too diverse and too complex for most users to use them to their full extent. "Currently, the World Wide Web (WWW) is the most successful effort in attempting to knit all these different information resources into a cohesive whole that can be interfaced through special documents (called Web pages or hyper/HTML documents). The activity best- supported by this structure is (human) browsing through these resources by following references (so-called hyper links) in the documents." 1 However, as is pointed out in [DAIG95a], "the WWW & the Internet do not adequately address more abstract activities such as information management, information representation, or other processing of (raw) information". In order to support these activities with increasingly complex information resources (such as multi-media objects, structured documents, and specialised databases), the next generation of network services infrastructure will have to be interoperable at a higher level of information activity abstraction. This may be fairly evident in terms of developing information servers and indexes that can interact with one another, or that provide a uniform face to the viewing public (e.g., through the World Wide Web). However, an information activity is composed of both information resources and needs. It is therefore not enough to make resources more sophisticated and interoperable; we need to be able to specify more complex, independent client information processing tasks 2 . In [DAIG95b] an experimental architecture is described that can satisfy both needs as were just described. In this architecture the information search process is divided into three layers: one layer for the client side of information (information searchers), one for the supply or server side of information (information providers), and one layer between these two layers to connect them in the best possible way(s) (the middle layer 3 ). Leslie Daigle is not alone in her ideas: several other parties are doing research into this concept or concepts very similar to it. 4 Fact is that more and more persons are beginning to 1 Quote taken from [DAIG95a]. 2 Note that this client may be a human user, or another software program. 3 Other names that are used to name this layer are information intermediaries, information brokers, but also a term such as (intelligent) middleware. Throughout this thesis these terms will be used interchangeably. 4 For instance, IBM is doing research into this subject in their InfoMarket project. realise that the current structure of the Internet, which is more or less divided into two layers or parties (being users and suppliers) is more and more failing to be satisfactory. 4.2 Definition Currently, when someone is looking for certain information on the Internet, there are many possible ways to do that. One of the possibilities that we have seen earlier, are search engines. The problem with these is that: 1* They require a user to know how to best operate every individual search engine; 2* A user should know exactly what information he is looking for; 3* The user should be capable of expressing his information need clearly (with the right keywords). However, 5 The OSI Reference Model 5.1 Reasons for Standardization The Open System Interconnection (OSI) Reference Model was specified by ITU, in cooperation with ISO and IEC, and is documented in Recommen- dation X.200. Although the OSI model is applicable in many areas, it is used mostly in the area of communication between computers. Its purpose is to organize and formalize the communication method. The basic idea of the OSI Reference Model is to separate the various parts that, in their totality, form a communications process. Separation of concerns is achieved by layering and modularization of transactions and tasks. This approach results from the following reasoning: • The use of microprocessors in telecommunications not only allowed for the creation of new services, but at the same time increased the requirements on communications of exchanges and computers. • When humans communicate by means of telephone or letters, they do not want to be concerned with the details of the physical transfer of the information. They just want to communicate. The same applies to the layers of the OSI Reference Model, in which each layer has a fixed role in the process of communications. • A computer is a modular structure, which starts with the transistor on the lowest level and, with modularity built on top of modularity, ends up as a super-computer. To use such a system becomes easier when the tasks themselves can be modularized. 39 • Telephone systems are used for many applications. These applications became possible only because the application itself had become more independent of the process of pure data transmission. Modems and fax machines, for instance, rely on the functionality of the services of a lower layer and adapt their own functionality accordingly. The tele- phone network, on the other hand, is not concerned with the content or the representation of the transmitted data. • The OSI Reference Model enables two products from different manufacturers to communicate. Many interworking problems cannot be solved simply by the interface specification shown in Figure 5.1. Each telephone set and every exchange can be regarded as network ele- ment A, B, or C. If, for example, the manufacturer of one network element implements all the functionality of a particular application and the second manufacturer implements only those functions that are necessary for a particular task, then, generally speaking, the two devices cannot be interconnected. 5.2 Layering in the OSI Reference Model The OSI Reference Model breaks down or separates the communication process into seven independent layers. The following are the general “rules” of the OSI model: • Two layers that lie above each other work independently. Each layer receives a service from the layer immediately below and provides a service to the layer immediately above. The lower layer does not care 40 GSM Networks: Protocols, Terminology, and Implementation Physical layer Data link layer Network layer Network node A Network node CNetwork node B Peer-to-peer protocol (e.g., ISUP, SCCP) Physical layer Data link layer Network layer Transport layer Session layer Presentation layer Application layer 7 6 1 2 3 4 5 Physical layer Data link layer Network layer Transport layer Session layer Presentation layer Application layer 7 6 1 2 3 4 5 Primitives 5 The Black Scholes Model 5.1 INTRODUCTION In the last chapter, two approaches were suggested for finding the price of an option: r Use risk neutrality to set growth rates (returns) equal to the interest rate and with these substitutions, work out the expected value of the payoff. The present value of this amount equals the fair value of the option today. r Solve the Black Scholes equation subject to the appropriate boundary conditions. Either of these methods can be used to derive the Black Scholes model for the prices of European call and put options, which is the most famous and widely used option model. It consists of a simple formula giving the value of the option as a function of a few parameters; this is called a “closed form solution”. Normally, models do not come in such a convenient form, but consist of a set of procedures which are applied in order to get a numerical value for the price of an option; these are the “numerical methods” described in Part 2 of this book. In the analysis of the previous chapters, a number of restrictive assumptions have been made. They are referred to collectively as the Black Scholes assumptions or a description of the Black Scholes world: (A) Volatility is constant. (B) Cash is borrowed or deposited at the same constant rate of interest. (C) There is no buy/sell spread or sales commission. (D) It is possible to short stock without charge. (E) Markets are continuous, so there is always a quote available. (F) Markets exist for any quantity of stock, including fractions of stock. (G) Markets are completely liquid, so we get instant execution, in any size, at the quoted price. 5.2 DERIVATION OF MODEL FROM EXPECTED VALUES (i) Risk neutrality tells us that the value at time t = 0 of a call option maturing at time T = 0is given by C 0 = e −rT E[C T ] risk neutral = e −rT E[max[(S T − X ), 0]] risk neutral For notional simplicity, the risk-neutral suffix will be dropped but it must always be remembered that we are dealing with pseudo-probabilities and pseudo-expectations. The value of the option is zero if it expires out-of-the-money (S T < X), so the expression for the value of the call option at t = 0 may be written C 0 = e −rT E [ S T − X : S T > X ] (ii) In order to obtain the expected value we need to multiply the payoff by a probability dis- tribution and integrate over S T . However, it is mathematically much simpler to transform 5 The Black Scholes Model variables: equation (3.7) states that S T = S 0 e mT+σ √ Tz T where m = µ − 1 2 σ 2 and z T is a stan- dard normal variate; in a risk-neutral world with dividends, m = (r − q) − 1 2 σ 2 . The mechan- ical details of how to evaluate the conditional expectations are given in Appendix A.1(v) The result is C 0 = e −rT  S 0 e (r−q)T N[σ √ T − Z X ] − X N[−Z X ]  where Z X = (ln(X/S 0 ) − mT)/σ √ T . This result is more usually written as C 0 = e −rT {F 0T N[d 1 ] − X N[d 2 ]} d 2 = d 1 − σ √ T d 1 =  ln(F 0T / X  + 1 2 σ 2 T  /σ √ T =  ln S 0 / X + (r − q)T + 1 2 σ 2 T  /σ √ T (5.1) where F 0T is the forward price. (iii) Note that for constant X,E[X : S T > X] = E[X | S T > X]E[S T > X] = X P[S T > X]. It is therefore sometimes stated that the factor N[d 2 ] is the probability that S T > X, i.e. that the option will be exercised. But remember that risk neutrality has led to the substitution µ → r. Therefore P[S T > X] is a pseudo-probability. The true probability that S T > X is N[d 2 ], but with r replaced by µ. (iv) General Black Scholes Formula for Put or Call: Recall the ... 9/34 The Expenditure- Output Model Using an Algebraic Approach to the Expenditure- Output Model In the expenditure- output or Keynesian cross model, the equilibrium occurs where the aggregate expenditure. . .The Expenditure- Output Model The Expenditure- Output Diagram The aggregate expenditure- output model shows aggregate expenditures on the vertical axis and real GDP on the horizontal... Expenditure- Output Model The Multiplier Effect in an Expenditure- Output Model The power of the multiplier effect is that an increase in expenditure has a larger increase on the equilibrium output The

Ngày đăng: 31/10/2017, 16:23