(休息几天)读曼昆之微观经济学——自由市场有看不见的手

1福利经济学

分析买者和卖者从参与市场中得到的利益(benefits)。然后分析社会如何使得这些利益最大。没有哪个生产者或消费者想实现市场均衡这一目标,但是市场价格指引着他们的联合行动向福利最大化的结果运动,就好像有一只看不见的手在牵着他们走一样。

本文都是假设市场是自由竞争的,不存在市场势力或者外部性原因使得市场失灵。

2支付意愿和消费者剩余

每个买者愿意支付的最高价格称为他的支付意愿。

以下是4个人关于某张专辑的拍卖价格的最高报价。

为了卖掉专辑,你从较低的底价比如10 元开始报价。由于这四个买者的支付意愿远高于10 元,价格迅速上升。当约翰报出80 元(或比80 元稍微高些)的价格时,竞价过程就结束了。此时,保罗、乔治和瑞格都退出了竞价,因为他们不愿意报出任何高于80 元的价格。约翰向你支付80 元后得到了专辑。

约翰从购买这张专辑中得到了多大的利益?在某种意义上,约翰赚了便宜:他愿意花100 元但实际上只花了80 元。我们说约翰得到了20 元的消费者剩余。

消费者剩余(consumer surplus)是买者对某商品意愿支付的钱数减去他实际支付的钱数。

现在考虑另外一个稍微有所不同的例子。假设你有两张相同的猫王专辑要卖。你再次使用拍卖方法,向四个可能的买者销售。为简单起见,假设这两张专辑的售价相同,而且没人愿意买两张。因此,价格一直上升,直到只剩下两个买者时才停止。所以, 现在市场的总消费者剩余是(100-70)+(80-70)=40元

用需求曲线衡量消费者剩余

如果价格高于100 元,市场中的需求量为0,因为没有人愿意出那么多钱。如果价格介于80 元和100 元之间,需求量为1,因为只有约翰愿意支付这么高的价格。如果价格驾驭70 元和80 元之间,需求量为2,因为约翰和保罗愿意支付这个价格。以此类推。按照这种方式,我们可从四个可能买者的支付意愿推导出需求表。

而消费者剩余有如下表示:(阴影部分的面积)

3销售意愿与生产者剩余

假设你有个房子想粉刷一下。有四个人可提供粉刷服务:玛丽、弗丽达、乔治娅和格兰德玛。如果价格合理,每个油漆工都愿意为你服务。你决定让他们报价将油漆工作拍卖给报价最低的人。

当这四个油漆工开始竞价时,价格一开始可能较高,但会迅速下降,因为油漆工彼此竞争。一旦格兰德玛报价600 元(或稍微低于600 元),市场上就只剩下唯一的竞价人,就是格兰德玛。他对该工作感到满意,因为他的成本只有500 元。若价格低于600 元,玛丽、弗丽达和乔治娅都不愿意做此工作。

格兰德玛从这份工作中得到多少利益?由于价格在500 元(等于他的成本)时他就愿意干,然而他却得到了600 元,我们说他得到了100 元的生产者剩余。生产者剩余(Producer surplus)是卖者得到的收入减去生产成本。

同样,如果要雇佣两个人,以此类推。

用供给曲线衡量生产者剩余

价格线以下供给曲线以上区域的面积衡量市场中的生产者剩余

4市场均衡时的消费者剩余和生产者剩余

市场结果使得消费者剩余和生产者剩余之和最大。换句话说,均衡结果是有效率的资源配置。

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,那我开始编写代码。以下是完整的代码注释和功能实现。 ```C++ #include <iostream> #include <fstream> #include <vector> #include <algorithm> using namespace std; // 建立书籍类 class Book { public: Book() {} Book(int id, string name, string author, string type, string press, double price, int total, int rest) { this->id = id; this->name = name; this->author = author; this->type = type; this->press = press; this->price = price; this->total = total; this->rest = rest; } int getId() const { return id; } string getName() const { return name; } string getAuthor() const { return author; } string getType() const { return type; } string getPress() const { return press; } double getPrice() const { return price; } int getTotal() const { return total; } int getRest() const { return rest; } void setName(string name) { this->name = name; } void setAuthor(string author) { this->author = author; } void setType(string type) { this->type = type; } void setPress(string press) { this->press = press; } void setPrice(double price) { this->price = price; } void setTotal(int total) { this->total = total; } void setRest(int rest) { this->rest = rest; } private: int id; // 书籍编号 string name; // 书籍名称 string author; // 作者 string type; // 类型 string press; // 出版社 double price; // 价格 int total; // 总数 int rest; // 剩余数量 }; // 建立图书类型类 class BookType { public: BookType() {} BookType(int id, string type) { this->id = id; this->type = type; } int getId() const { return id; } string getType() const { return type; } void setType(string type) { this->type = type; } private: int id; // 图书类型编号 string type; // 图书类型名称 }; // 建立图书类 class Library { public: Library() {} // 初始化 void init(); // 添加书籍 void addBook(); // 修改书籍 void modifyBook(); // 删除书籍 void deleteBook(); // 查找书籍 void searchBook(); // 输出所有书籍信息 void printBooks(); // 按编号排序 void sortById(); // 按书名排序 void sortByName(); // 保存到文件 void saveToFile(); // 从文件中取 void readFromFile(); private: vector<Book> books; // 书籍信息 vector<BookType> bookTypes; // 图书类型信息 }; void Library::init() { // 初始化图书类型信息 bookTypes.push_back(BookType(1, "计算机")); bookTypes.push_back(BookType(2, "文学")); bookTypes.push_back(BookType(3, "历史")); bookTypes.push_back(BookType(4, "经济")); bookTypes.push_back(BookType(5, "哲学")); bookTypes.push_back(BookType(6, "心理学")); bookTypes.push_back(BookType(7, "教育")); bookTypes.push_back(BookType(8, "体育")); bookTypes.push_back(BookType(9, "医学")); bookTypes.push_back(BookType(10, "法律")); // 初始化书籍信息 books.push_back(Book(1, "C++程序设计基础", "谭浩强", "计算机", "清华大学出版社", 69.0, 10, 10)); books.push_back(Book(2, "三体", "刘慈欣", "文学", "重庆出版社", 29.0, 20, 20)); books.push_back(Book(3, "明朝那些事儿", "当年明月", "历史", "湖南文艺出版社", 49.0, 15, 15)); books.push_back(Book(4, "经济学原理", "", "经济", "机械工业出版社", 99.0, 8, 8)); books.push_back(Book(5, "论语", "孔子", "哲学", "中华书局", 9.9, 30, 30)); books.push_back(Book(6, "心理学与生活", "吉列", "心理学", "人民邮电出版社", 39.0, 12, 12)); books.push_back(Book(7, "小学数学竞赛", "王德忠", "教育", "人民教育出版社", 25.0, 18, 18)); books.push_back(Book(8, "篮球技术与战术", "何勇", "体育", "北京体育大学出版社", 59.0, 5, 5)); books.push_back(Book(9, "内科学", "王振英", "医学", "人民卫生出版社", 129.0, 3, 3)); books.push_back(Book(10, "宪法", "钱穆", "法律", "北京大学出版社", 19.9, 25, 25)); } void Library::addBook() { int id, total, rest, typeId; string name, author, type, press; double price; cout << "请输入书籍编号:"; cin >> id; cout << "请输入书籍名称:"; cin >> name; cout << "请输入作者:"; cin >> author; cout << "请输入书籍类型(如:计算机):"; cin >> type; cout << "请输入出版社:"; cin >> press; cout << "请输入价格:"; cin >> price; cout << "请输入总数:"; cin >> total; cout << "请输入剩余数量:"; cin >> rest; // 查找图书类型 bool found = false; for (int i = 0; i < bookTypes.size(); i++) { if (bookTypes[i].getType() == type) { typeId = bookTypes[i].getId(); found = true; break; } } if (!found) { typeId = bookTypes.size() + 1; bookTypes.push_back(BookType(typeId, type)); } books.push_back(Book(id, name, author, type, press, price, total, rest)); cout << "添加成功!" << endl; } void Library::modifyBook() { int id; cout << "请输入需要修改的书籍编号:"; cin >> id; for (int i = 0; i < books.size(); i++) { if (books[i].getId() == id) { string name, author, type, press; double price; int total, rest, typeId; cout << "请输入书籍名称:"; cin >> name; cout << "请输入作者:"; cin >> author; cout << "请输入书籍类型(如:计算机):"; cin >> type; cout << "请输入出版社:"; cin >> press; cout << "请输入价格:"; cin >> price; cout << "请输入总数:"; cin >> total; cout << "请输入剩余数量:"; cin >> rest; // 查找图书类型 bool found = false; for (int j = 0; j < bookTypes.size(); j++) { if (bookTypes[j].getType() == type) { typeId = bookTypes[j].getId(); found = true; break; } } if (!found) { typeId = bookTypes.size() + 1; bookTypes.push_back(BookType(typeId, type)); } books[i] = Book(id, name, author, type, press, price, total, rest); cout << "修改成功!" << endl; return; } } cout << "未找到该书籍!" << endl; } void Library::deleteBook() { int id; cout << "请输入需要删除的书籍编号:"; cin >> id; for (int i = 0; i < books.size(); i++) { if (books[i].getId() == id) { books.erase(books.begin() + i); cout << "删除成功!" << endl; return; } } cout << "未找到该书籍!" << endl; } void Library::searchBook() { int id; cout << "请输入需要查找的书籍编号:"; cin >> id; for (int i = 0; i < books.size(); i++) { if (books[i].getId() == id) { cout << "编号\t书名\t作者\t类型\t出版社\t价格\t总数\t剩余数量" << endl; cout << books[i].getId() << "\t" << books[i].getName() << "\t" << books[i].getAuthor() << "\t" << books[i].getType() << "\t" << books[i].getPress() << "\t" << books[i].getPrice() << "\t" << books[i].getTotal() << "\t" << books[i].getRest() << endl; return; } } cout << "未找到该书籍!" << endl; } void Library::printBooks() { cout << "编号\t书名\t作者\t类型\t出版社\t价格\t总数\t剩余数量" << endl; for (int i = 0; i < books.size(); i++) { cout << books[i].getId() << "\t" << books[i].getName() << "\t" << books[i].getAuthor() << "\t" << books[i].getType() << "\t" << books[i].getPress() << "\t" << books[i].getPrice() << "\t" << books[i].getTotal() << "\t" << books[i].getRest() << endl; } } void Library::sortById() { sort(books.begin(), books.end(), [](Book a, Book b) { return a.getId() < b.getId(); }); } void Library::sortByName() { sort(books.begin(), books.end(), [](Book a, Book b) { return a.getName() < b.getName(); }); } void Library::saveToFile() { ofstream outfile("books.txt"); for (int i = 0; i < books.size(); i++) { outfile << books[i].getId() << " " << books[i].getName() << " " << books[i].getAuthor() << " " << books[i].getType() << " " << books[i].getPress() << " " << books[i].getPrice() << " " << books[i].getTotal() << " " << books[i].getRest() << endl; } outfile.close(); outfile.open("booktypes.txt"); for (int i = 0; i < bookTypes.size(); i++) { outfile << bookTypes[i].getId() << " " << bookTypes[i].getType() << endl; } outfile.close(); cout << "保存成功!" << endl; } void Library::readFromFile() { ifstream infile("books.txt"); int id, total, rest; string name, author, type, press; double price; while (infile >> id >> name >> author >> type >> press >> price >> total >> rest) { // 查找图书类型 int typeId; bool found = false; for (int i = 0; i < bookTypes.size(); i++) { if (bookTypes[i].getType() == type) { typeId = bookTypes[i].getId(); found = true; break; } } if (!found) { typeId = bookTypes.size() + 1; bookTypes.push_back(BookType(typeId, type)); } books.push_back(Book(id, name, author, type, press, price, total, rest)); } infile.close(); infile.open("booktypes.txt"); int typeId; while (infile >> typeId >> type) { bookTypes.push_back(BookType(typeId, type)); } infile.close(); cout << "取成功!" << endl; } int main() { Library library; library.init(); int choice; while (true) { cout << "请选择操作:" << endl; cout << "1.添加书籍" << endl; cout << "2.修改书籍" << endl; cout << "3.删除书籍" << endl; cout << "4.查找书籍" << endl; cout << "5.输出所有书籍信息" << endl; cout << "6.按编号排序" << endl; cout << "7.按书名排序" << endl; cout << "8.保存到文件" << endl; cout << "9.从文件中取" << endl; cout << "0.退出" << endl; cin >> choice; switch (choice) { case 1: { library.addBook(); break; } case 2: { library.modifyBook(); break; } case 3: { library.deleteBook(); break; } case 4: { library.searchBook(); break; } case 5: { library.printBooks(); break; } case 6: { library.sortById(); break; } case 7: { library.sortByName(); break; } case 8: { library.saveToFile(); break; } case 9: { library.readFromFile(); break; } case 0: { cout << "谢谢使用!" << endl; return 0; } default: { cout << "输入有误,请重新输入!" << endl; break; } } } return 0; } ``` 以上就是完整的代码实现了。这个图书管管理系统包含了建立书籍类、图书类型类、图书类,书籍、图书类型、图书信息的初始化、添加、修改、删除、查找,图书信息的输出,对图书信息按编号、书名排序,文件的保存和文件的取。您可以根据需要进行修改和扩展。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值