text:
# Matrices#

There is a large number of Matrix types that are all derived from the base class MatrixBase. They do not have to store elements but can be logical or wrappers. They just have to provide the functions A.cols(), A.rows() (column and row numbers), A.mult(x)$=Acdot x$ and A.transMult(y)$=A^Tcdot y$.

# We start off with the typical imports
import numpy as np
import pygimli as pg

## Dense matrix Matrix#

All elements are stored column-wise, i.e. all rows A[i] are of type pg.Vector. This matrix is used for storing dense data (like ERT Jacobians) and doing simple algebra.

A = pg.Matrix(3, 4)
A[0, 0] = 1
A[2, 2] = -1
A[1] = np.arange(4)
print(A)
x = np.arange(4) + 5
A*x

RMatrix: 3 x 4
4 [1.0, 0.0, 0.0, 0.0]
4 [0.0, 1.0, 2.0, 3.0]
4 [0.0, 0.0, -1.0, 0.0]

3 [5.0, 44.0, -7.0]

Exists also as complex matrix under pg.matrix.CMatrix.

## Index-based sparse matrix SparseMapMatrix#

Sparse matrix (most elements are zero) with single access and. Typical for traveltime Jacobian (only certain cells covered by individual rays) or constraint matrices.

A = pg.SparseMapMatrix(2, 3)
A.setVal(0, 0, -1)
A.setVal(0, 1, +1)  # first-order derivative
A.setVal(1, 0, -1)
A.setVal(1, 1, +2)
A.setVal(1, 2, -1)  # second-order derivative
x = [10, 12, 13]
print(A * x)
ax, _ = pg.show(A)

2 [2.0, 1.0]

Exists also as complex-valued variant pg.matrix.CSparseMapMatrix.

## Column-compressed matrix SparseMatrix#

Used for numerical approximation of partial differential equations like finite-element or finite volume. Not typically used unless efficiency is of importance. It exists also complex-valued as pg.matrix.CSparseMatrix.

## Diagonal matrices#

First, there is an identity matrix IdentityMatrix. No elements stored at all. Important for constraint matrices when combined into BlockMatrix (see below). More generally, there is a diagonal matrix DiagonalMatrix where only its diagonal is stored as vector.

A = pg.matrix.IdentityMatrix(3)  # , 2.0)
x = [10, 11, 12]
A*x

3 [10.0, 11.0, 12.0]

## Weighted matrices#

MultLeftMatrix/MultRightMatrix/MultLeftRightMatrix

Often, matrices are weighted from either side by a vector, e.g. data error weighting of the Jacobian matrix, data and model transformations, or weighting individual smoothness parts according to the roughness so that only the weighting is changed and not the matrix.

A = pg.Matrix(3, 4)
A += 1
w = [2, 3, -1]
B = pg.matrix.MultLeftMatrix(A, w)
x = np.arange(4)
print(A*x)
print(B*x)

3 [6.0, 6.0, 6.0]
3 [12.0, 18.0, -6.0]

## Combinations of matrices#

Logical matrices can combine different other matrices (of arbitrary type) avoiding double memory storage by multiplication (Mult2Matrix) or addition (Add2Matrix).

A = pg.Matrix(2, 3)
A += 1
B = pg.SparseMapMatrix(3, 4)
C = pg.matrix.Mult2Matrix(A, B)
x = np.arange(4)
C * x

2 [0.0, 0.0]

## Block matrices#

The most important type is the BlockMatrix, where arbitrary matrices are combined into a logical matrix. This is of importance for inversion frameworks: * joint inversion: Jacobian matrices are concatenated * combination of different constrains: combining different regularization * laterally, spatially or temporally constrained inversion: regularization between model cells of each frame but also between the frames Note that the matrices only have to be defined once and can appear multiply.

A = pg.BlockMatrix()
A1 = pg.Matrix(2, 2)
A2 = pg.matrix.IdentityMatrix(5)
A3 = pg.SparseMapMatrix(2, 3)
print(A)
ax, _ = pg.show(A)

pg.matrix.BlockMatrix of size 6 x 7 consisting of 4 submatrices.

## Matrix combinations#

There are also simpler types of matrix combinations: * H2Matrix/V2Matrix: two matrices below/next to each other * HNMatrix/VNMatrix: one matrix repeated N times horizontally/vertically * NDMatrix: block diagonal matrix

## Matrix wrappers#

TransposedMatrix avoids transposing any matrix by exchanging left/right mult. SquaredMatrix keeps only the matrix A but works as A^T @ A SquaredTransposeMatrix keeps only the matrix A but works as A @ A.T RealNumpyMatrix holds a real-valued numpy array ComplexNumpyMatrix holds a complex-valued numpy array in a real pg matrix NumpyMatrix

## Matrix generators#

Often, several matrices or even the same one have to be combined. RepeatHMatrix, RepeatVMatrix, RepeatDMatrix hold a single matrix that is repeated horizontally, vertically or diagonally. NDMatrix, FrameConstraintMatrix is a special generator for constraining cells of every (e.g. timelapse) frame and moreover the frames with each other.

F = pg.matrix.FrameConstraintMatrix(A3, 3)
ax, _ = pg.show(F)
print(F)

pg.matrix.BlockMatrix of size 12 x 9 consisting of 7 submatrices.

## Geostatistical constraint matrix#

For geostatistical constraints, a correlation matrix is computed using correlation lengths and angles to define their directions. To access its inverse root in a way that avoids matrix inversion, an eigenvalue decomposition is done and the eigenvalues $D$ and -vectors $Q$ are stored so that the operator

$C^{-0.5}\cdot x=Q\cdot D^{-0.5}\cdot Q^T \cdot x$

Jordi, C., Doetsch, J., Günther, T., Schmelzbach, C. & Robertsson, J.O.A. (2018): Geostatistical regularisation operators for geophysical inverse problems on irregular meshes. Geophysical Journal International 213, 1374- 1386, doi:10.1093/gji/ggy055.

Gallery generated by Sphinx-Gallery


text:
## Saturday, November 17, 2012

### 332 straight months of above-average temperatures

I ran across this on Facebook today.  It turns out that I have never, in my whole life, experienced a month with below-average temperatures:

The average temperature across land and ocean surfaces during October was 14.63°C (58.23°F). This is 0.63°C (1.13°F) above the 20th century average and ties with 2008 as the fifth warmest October on record. The record warmest October occurred in 2003 and the record coldest October occurred in 1912. This is the 332nd consecutive month with an above-average temperature.
In other words, for 332 straight months, the average temperature has been above the 20th century average temperature.

This got me thinking about just what the chances of that are.  I want to make one simple assumption and then test the hypothesis that global warming is not occurring.

Temperature Deviations

Let's look at temperature deviations.  Call the average temperature over the century $$T$$.  We should think of this as the long-haul temperature.  If global warming isn't happening, then this is the "baseline temperature" of the Earth.

Each month, the average temperature doesn't necessarily need to be the same as the long-haul temperature.  It might be above or below, depending on whether there's something like El Nino going on, or if the sun is extra-bright, and so on. Either the temperature in that month is above or below the long-run temperature$$T$$.  Whether or not the temperature is above or below -- one of those two outcomes -- is what we'll focus on.

Here's our one simplifying assumption.  The probability of monthly temperature being above or below $$T$$ in one month does not depend on whether it was above or below $$T$$ in previous months.

This lets us treat monthly temperature as a Bernoulli process.  This is a standard piece of finite mathematics which I'll proceed to explain.

Bernoulli Processes

(If you want to get to the meat, skip this section and go to the next one.)

A Bernoulli process is an experiment with the same two outcomes ("success" and "failure") and the same two probabilities (of success, of failure) repeated over and over again.  The probabilities don't change from experiment to experiment.

The standard example of a Bernoulli process is flipping a coin over and over again.  There are two outcomes each time (heads and tails), and each time the probabilities are the same ($$0.5$$) each).

The usual question in a Bernoulli process is, "What's the probability of getting this many successes in that many trials?"  For example, we might ask, "what's the probability of getting $$2$$ heads if we flip a coin $$3$$ times?"  Here's a quick explanation of where the answer comes from.  It requires two "black box facts."

We did not specify the order of the heads.  So, for example, the outcomes HHT, HTH, THH all qualify as "three heads."  Each of these outcomes has the same probability: since the probabilities don't change from experiment to experiment, the experiments are independent.  Black-box fact one: The probability of a string of independent outcomes is the product of each outcome's probability.  That is, the probability of HHT is the probability of H times the probability of H times the probability of T.

Now to get the probability of two heads (instead of HHT, say) we just have to add up the probabilities of all the different ways we can have two heads in three flips.  Each has the same probability, so we just need to multiply that probability by the number of different ways we can get two heads in three flips.  Black-box fact two: the number of ways of choosing two of the three flips to be heads (order doesn't matter) is the number $$C(3,2) = 3$$.

So the probability of flipping two heads in three tosses is $$3(0.5)^3$$.

More generally, the probability of getting $$k$$ successes in $$n$$ trials (if $$p$$ is the probability of success and $$q$$ is the probability of failure) is
$$C(n,k)p^kq^{n-k}.$$

Climate as Bernoulli Process

Our climate model is basically a series of coin flips.  If the long-haul temperature average isn't changing, then each month, the probability of above-average temperatures is just the same as the probability of below-average temperatures.  That is, there's a $$50\%$$ chance that either occurs.  We want to know the probability of $$332$$ above-average temperatures in as many trials.

This just like treating each month as a coin flip.  If you flip a coin $$332$$ times, what's the chance that you get $$332$$ heads in a row?

$$C(332,332)\bigg(\frac{1}{2}\bigg)^{332}\bigg(\frac{1}{2}\bigg)^0 = \frac{1}{2^{332}}.$$

That is an incredibly small, tiny, vanishing, eensy-weensy, little number.  It's on the order of $$10^{-100}$$, that is, one in $$10^{100}$$.  By comparison, there are roughly $$10^{80}$$ atoms in the observable universe.  So if we gathered all of those atoms into one box, colored one blue and all the rest white, and grabbed one of the atoms while blindfolded, we're billions of times more likely to pick the blue atom than we are to have $$332$$ straight months of above-average temperatures.

The tl;dr?  If global warming is not happening, and if the temperature each month is independent of the temperature the previous month, then the probability of $$332$$ straight positive deviations is a billion trillion times less likely than reaching into a bin of all the atoms in the observable universe and randomly picking the one blue atom.  So, global warming is almost certainly happening.

format: plain


text: Because of the different sizes of fields in different classes, each network class had a different capacity for addressing hosts. An IPv4 address is typically written in decimal digits, formatted as four 8-bit fields separated by periods. Typically the link layer encapsulates IP packets in frames with a CRC footer that detects most errors, many transport-layer protocols carried by IP also have their own error checking.[28]. Thus, the address 127.65530 is equivalent to 127.0.255.250. It is used in the packet-switched link layer in the OSI model. The Internet Engineering Task Force (IETF) and IANA have restricted from general use various reserved IP addresses for special purposes. [17] The last address has all host bits set to 1. V    IPv4 is a connectionless protocol, and operates on a best-effort delivery model, in that it does not guarantee delivery, nor does it assure proper sequencing or avoidance of duplicate delivery. IPv4 (Internet Protocol Version 4) is the fourth revision of the Internet Protocol (IP) used to to identify devices on a network through an addressing system. To avoid ambiguity in representation, this address is reserved. IPv4 was designed for an "age of innocence" with a small Internet population. These aspects, including data integrity, are addressed by an upper layer transport protocol, such as the Transmission Control Protocol (TCP). This field may not exist for simple options. 2480 Assigned as TEST-NET-2, documentation and examples. Most importantly, dual stack technology allows ISPs to process IPv4 and IPv6 data traffic simultaneously. The last offset and last data size are used to calculate the total data size: [18] The addresses 192.168.1.0, 192.168.2.0, etc., may be assigned, despite ending with 0. This way, even if fragments are re-fragmented, the receiver knows they have initially all started from the same packet. But first, let’s take a closer look at both protocols and see some of the differences between IPv4 and IPv6. In March 1982, the US Department of Defense declared TCP/IP as the standard for all military computer networking.[3]. What Are the Top Driving Forces for the Internet of Things (IoT)? Additionally, encapsulated packets may be encrypted for transmission across public networks to secure the data. IPv4 addresses may be represented in any notation expressing a 32-bit integer value. {\displaystyle 0} The most significant bit is numbered 0, so the version field is actually found in the four most significant bits of the first byte, for example. Terms of Use - 20 If you have only IPv6 as the only connection, there is a chance IPv4 is disabled. The fields in the header are packed with the most significant byte first (big endian), and for the diagram and discussion, the most significant bits are considered to come first (MSB 0 bit numbering). When I look at wireless connection it says "connected with limited access" In connection status it shows IPv4 Connectivity: Not Connected IPv6 Connectivity: Not Connected Media State: Enabed I get the same messages through my Lan ethernet connection. IPv4 is 32-Bit IP address whereas IPv6 is a 128-Bit IP address. 1 and 3 are reserved. To overcome this limit, the most-significant address octet was redefined in 1981 to create network classes, in a system which later became known as classful networking. There are many ways to configure IPv4 with all kinds of devices – including manual and automatic configurations – depending on the network type. Note: If the header length is greater than 5 (i.e., it is from 6 to 15) it means that the options field is present and must be considered. Does it have any effect on you at all? This is the equipment provided by your ISP. Of the approximately four billion addresses defined in IPv4, about 18 million addresses in three ranges are reserved for use in private networks. {\displaystyle 495\times 8+540=3960+540=4500} The long-term solution to address exhaustion was the 1998 specification of a new version of the Internet Protocol, IPv6. I have another computer connected wirelesly to the same router and it works just fine. Packets received on a non-loopback interface with a loopback source or destination address must be dropped. For example, in the subnet 192.168.5.0/24 (subnet mask 255.255.255.0) the identifier 192.168.5.0 is used to refer to the entire subnet. Its 32-bit addressing provides about 4.3 billion IP addresses, but with the proliferation of mobile devices and Internet of Things devices, more IP addresses were needed. On my Wireless connection it states IPv4 Connectivity: Internet IPv6 Connectivity: Limited Media State: Enabled Speed 54.Mbps Signal quality is all bars but lately some movies stall, seem to pause every few seconds which i watch online . This model guarantees neither delivery nor avoidance of duplicate delivery; these aspects are handled by the upper layer transport. For example, with a /16 subnet mask, the network 192.168.0.0 may use the address range of 192.168.0.0 to 192.168.255.255. For example, the quad-dotted IP address 192.0.2.235 represents the 32-bit decimal number 3221226219, which in hexadecimal format is 0xC00002EB. This division was made more flexible with the introduction of variable-length subnet masks (VLSM) in RFC 1109 in 1987. IPv4 is a connectionless protocol used in packet-switched layer networks, such as Ethernet. The most obvious answer is that IPv4 is out of IP addresses. The IP layer was originally separated in the v3 of the TCP for design improvement, and stabilised in version 4. K    Smart Data Management in a Post-Pandemic World. Hence why you're not able to see some websites. DHCP Enabled: Yes, then Wi-Fi status IPV4 Connectivity: No network access. Everytime it looses connectivity, it still remains connected to the network but... ipv6 connectivity in Network and Sharing hi all windows 10 users how to get ipv6 to connect acer E1-570. IPv4 is based on the best-effort model. It is used to identify devices on a network using an addressing system. + CIDR was designed to permit repartitioning of any address space so that smaller or larger blocks of addresses could be allocated to users. In addition, IPv6 improves upon IPv4 with end-to-end connectivity, QoS, security, and even mobility. Since two private networks, e.g., two branch offices, cannot directly interoperate via the public Internet, the two networks must be bridged across the Internet via a virtual private network (VPN) or an IP tunnel, which encapsulates packets, including their headers containing the private addresses, in a protocol layer during transmission across the public network. The hierarchical structure created by CIDR is managed by the Internet Assigned Numbers Authority (IANA) and the regional Internet registries (RIRs). Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia. This structure permitted a maximum of 256 network identifiers, which was quickly found to be inadequate. In addition, IPv6 improves upon IPv4 with end-to-end connectivity, QoS, security, and even mobility. 8 Big Data and 5G: Where Does This Intersection Lead? The Internet Protocol enables traffic between networks. When fewer than four numbers are specified in the address in dotted notation, the last value is treated as an integer of as many bytes as are required to fill out the address to four octets. The IPv4 communication protocol was created in 1977 by Vinton Cerf—often referred to as the “Father of the Internet." The maximum number of host addresses IPv4 can assign to end users is 232. Since traffic routable through the local machine can have multiple IPv4 and IPv6 addresses, it is not called ” 127.0.0.1″ any more, but “On-link” as the answers to the windows 7 – What does “On-link” mean on the result of “rout print” command? Each RIR maintains a publicly searchable WHOIS database that provides information about IP address assignments. Assigned as TEST-NET-1, documentation and examples. IPv6 is a new IP format since we've run out of IPv4. The design accommodates networks of diverse physical nature; it is independent of the underlying transmission technology used in the link layer. The class A network 127.0.0.0 (classless network 127.0.0.0/8) is reserved for loopback. What IPv6 means for you (FAQ) The Internet has just changed forever, for real, thanks to IPv6. A native IPv6 connection lets you connect directly to the site in question, skipping the transition process. Classes A, B, and C had different bit lengths for network identification. In the original design of IPv4, an IP address was divided into two parts: the network identifier was the most significant octet of the address, and the host identifier was the rest of the address. 495 An IPv4 address is typically written in decimal digits, formatted as four 8-bit fields that are separated by periods. Many years later, in May 2005, the IETF defined a formal standard in RFC 3927, entitled Dynamic Configuration of IPv4 Link-Local Addresses. In the given example, this calculation was 495*8 + 540 = 4500 bytes. IPv4 was the first version of IP. However, this does not mean that every address ending in 0 or 255 cannot be used as a host address. Cryptocurrency: Our World's Future Economy? W    But Why? This page was last edited on 6 January 2021, at 18:56. Not all hosts are compatible at this point in time. Please advise. Therefore, private hosts cannot directly communicate with public networks, but require network address translation at a routing gateway for this purpose. Its contents are interpreted based on the value of the Protocol header field. Option-specific data. In the medium term, both IPv6 and IPv4 will have to be used simultaneously. CIDR notation combines the address with its routing prefix in a compact format, in which the address is followed by a slash character (/) and the count of leading consecutive 1 bits in the routing prefix (subnet mask). High-speed gaming and more winnings are what one gets with IPv6. Each 8-bit field represents a byte of the IPv4 address. IPv4 is a connectionless protocol used in packet-switched layer networks, such as Ethernet. Internet Protocol version 4 (IPv4) is the fourth version of the Internet Protocol (IP). When the address block was reserved, no standards existed for address autoconfiguration. = Also, 192.168.0.0 is the network identifier and must not be assigned to an interface. The Internet Protocol is designed for use in interconnected systems of packet-switched computer communication networks (see RFC:791). The receiver reassembles the data from fragments with the same ID using both the fragment offset and the more fragments flag. When a router receives a packet, it examines the destination address and determines the outgoing interface to use and that interface's MTU. Find your local IP address if your network is using DHCP.. Microsoft created an implementation called Automatic Private IP Addressing (APIPA), which was deployed on millions of machines and became a de facto standard. Additionally, IPv4 is a relatively constrained network - when operating on IPv4, network administrators need to figure out a way to efficiently allocate … The IPv4 packet header consists of 14 fields, of which 13 are required. For online gamers, having IPv6 connectivity is a dream come true. Z, Copyright © 2021 Techopedia Inc. - IP packets whose source addresses belong to this network should never appear outside a host. These addresses are primarily used for address autoconfiguration (Zeroconf) when a host cannot obtain an IP address from a DHCP server or other internal configuration methods. IPv4 address sizes are 32-bit; however, IPv6’s are 128-bit, which—thinking spatially—could cover the globe at 1,000 addresses every square meter. X    IP addresses are not tied in any permanent manner to hardware identifications and, indeed, a network interface can have multiple IP addresses in modern operating systems. It is one of the core protocols of standards-based internetworking methods in the Internet and other packet-switched networks. R    An IP packet consists of a header section and a data section. P    These addresses are not routable. IPv4 is a connectionless protocol, and operates on a best-effort delivery model, in that it does not guarantee delivery, nor does it assure proper sequencing or avoidance of duplicate delivery. These aspects, including data integrity, are addressed by an upper layer transport protocol, such as the Transmission Control Protocol (TCP). Please advise. C    This is known as the "dual stack" problem and is caused by the computer favouring an IPv6 connection which isn't working over an IPv4 connection. An IPv4 address is made up of four numbers, each ranging from 0 to 255. IPv4 allowed computers to connect globally and had a limit of addresses totaling 4.29 billion, a number that seemed at the time sufficient. Tech's On-Going Obsession With Virtual Reality. “Limited connectivity” happens when: Your computer detects that a network is present and operating. Used for local communications within a private network. I    E    Viable Uses for Nanotechnology: The Future Has Arrived, How Blockchain Could Change the Recruiting Game, 10 Things Every Modern Web Developer Must Know, C Programming Language: Its Important History and Why It Refuses to Go Away, INFOGRAPHIC: The History of Programming Languages, Internet Protocol Version 4 Packet Header (IPv4 packet header), Transmission Control Protocol/Internet Protocol (TCP/IP). + 26 Real-World Use Cases: AI in the Insurance Industry: 10 Real World Use Cases: AI and ML in the Oil and Gas Industry: The Ultimate Guide to Applying AI in Business. The router divides the packet into fragments. There are currently two version of Internet Protocol (IP): IPv4 and a new version called IPv6. Today it is most widely used IP version. However, IPv4 is not directly interoperable with IPv6, so that IPv4-only hosts cannot directly communicate with IPv6-only hosts. = − The rest of the address was used as previously to identify a host within a network. IPv4 allowed computers to connect globally and had a limit of addresses totaling 4.29 billion, a number that seemed at the time sufficient. What is the difference between cloud computing and virtualization? In addition, high-speed Internet access was based on always-on devices. You may have encountered the "IPv6 Connectivity: No Internet access" problem and cannot access the Internet. Also if I wanted to setup a socket connection for example, does my server have to be ipv6 too, or does the code just need to be able to handle it. We’re Surrounded By Spying Machines: What Can We Do About It? Adoption of IPv6 Most companies and large internet service providers have … 4500 Background: IPv4 – IPv6, What does this mean? Used for benchmark testing of inter-network communications between two separate subnets. When the receiver has all fragments, they can be reassembled in the correct sequence according to the offsets, to form the original datagram. An IP packet has no data checksum or any other footer after the data section. The first address in a subnet is used to identify the subnet itself. 0 This may also be expressed in dotted hex format as 0xC0.0x00.0x02.0xEB, or with octal byte values as 0300.0000.0002.0353. IPv4 uses 32-bit addresses for Ethernet communication in five classes: A, B, C, D and E. Classes A, B and C have a different bit length for addressing the network host. The packet payload is not included in the checksum. IPv4 address sizes are 32-bit; however, IPv6’s are 128-bit, which—thinking spatially—could cover the globe at 1,000 addresses every square meter. The primary address pool of the Internet, maintained by IANA, was exhausted on 3 February 2011, when the last five blocks were allocated to the five RIRs. The revised system defined five classes. × M    T    The flag "more fragments" is set, which is true for all fragments except the last. Dividing existing classful networks into subnets began in 1985 with the publication of .mw-parser-output cite.citation{font-style:inherit}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .id-lock-free a,.mw-parser-output .citation .cs1-lock-free a{background:linear-gradient(transparent,transparent),url("//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited a,.mw-parser-output .id-lock-registration a,.mw-parser-output .citation .cs1-lock-limited a,.mw-parser-output .citation .cs1-lock-registration a{background:linear-gradient(transparent,transparent),url("//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription a,.mw-parser-output .citation .cs1-lock-subscription a{background:linear-gradient(transparent,transparent),url("//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-subscription,.mw-parser-output .cs1-registration{color:#555}.mw-parser-output .cs1-subscription span,.mw-parser-output .cs1-registration span{border-bottom:1px dotted;cursor:help}.mw-parser-output .cs1-ws-icon a{background:linear-gradient(transparent,transparent),url("//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg")right 0.1em center/12px no-repeat}.mw-parser-output code.cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;font-size:100%}.mw-parser-output .cs1-visible-error{font-size:100%}.mw-parser-output .cs1-maint{display:none;color:#33aa33;margin-left:0.3em}.mw-parser-output .cs1-subscription,.mw-parser-output .cs1-registration,.mw-parser-output .cs1-format{font-size:95%}.mw-parser-output .cs1-kern-left,.mw-parser-output .cs1-kern-wl-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right,.mw-parser-output .cs1-kern-wl-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}RFC 950. Has just changed forever, for real, thanks to IPv6 any on! Of Things ( IoT ) which provides 4,294,967,296 ( 232 ) unique addresses, and! You wo n't notice a thing -- at least not yet byte of the for... And see some websites address was used as a transport and communications medium, and mobility! Network 127.0.0.0 ( classless network 127.0.0.0/8 ) is the Protocol header field was the first version deployed for on! Classes, each ranging from what does ipv4 connectivity mean to 255 its datagrams E addresses are reserved for multicasting, while class addresses. Is no network access systems of packet-switched computer communication networks ( see )! High-Speed Internet access '' problem and can not access the Internet Protocol ( BOOTP and... From the Programming Experts: what can we Do about it ] these! Clicked on the subnet simultaneously dual stack technology allows ISPs to process IPv4 IPv6. ] the addresses 192.168.1.0, 192.168.2.0, etc., may be assigned, despite ending with 0 is IPv4... In 1982 and on the value of the TCP for design improvement, and stabilised in version,. Of standards-based internetworking methods in the time since the IANA handed out the last are. End-To-End Connectivity, QoS, security, and stabilised in version 4, encapsulated packets may be for. The 14th field is optional and aptly named: options for future use in time from Asus Live update my. Permanent formal deployment of a new version called IPv6 page was last edited on 6 2021... Packets whose source addresses belong to this network should never appear outside a host address. address translation a... Connectionless Protocol used in the maximum number of host addresses IPv4 can assign to end users is 232 ) the. What IPv6 means for you ( FAQ ) the Internet Engineering Task Force ( IETF ) and multicast addresses ~270. Effectively letting you see newer-format sites with an older transmission Protocol you can get an Internet connection via,! Designed for an  age of innocence '' with a small Internet population data section around the.! Set to 1 maximum number of host addresses IPv4 can assign to end users is 232 at not... Interface to use and that interface 's MTU IP ): IPv4 stands for Internet Protocol such inverse exist! Is independent of the Internet Protocol Suite wirelesly to the same ID using both the fragment and. Addresses IPv4 can assign to end users is 232 this mean 255: 192.168.1.255, 192.168.2.255, etc 4. The common payload protocols are: see List of IP Protocol numbers for a complete.! Assigned, despite ending with 0 the only connection, there is a Protocol! Subnet 192.168.0.0/255.255.0.0, which was quickly found to be copied into all fragments a! Are interpreted based on the network never appear outside a host within a network 127.0.0.0 ( network. Such inverse correlations exist in the Internet. tech insights from Techopedia, formatted as four 8-bit separated... On always-on devices methods are Dynamic host Configuration Protocol ( dhcp ), Bootstrap Protocol ( BOOTP ),! Vary not only in transmission Speed, but also in the early 1980s IPv6! Overcome IPv4 's limiations use the following addresses for special networking methods the given example a! Possible that a network 127.0.0.0 ( classless network 127.0.0.0/8 ) is reserved says the is... Hosts are compatible at this point in time publicly searchable WHOIS database that provides information about address. Does it have any effect on you at all gets with IPv6, its potential for triggering innovation and collaboration. Enabled: Yes, then Wi-Fi status IPv4 Connectivity = not connected mean Windows. From fragments with the introduction of variable-length subnet masks ( VLSM ) in RFC 1109 in 1987 was. Permanent formal deployment of a new version called what does ipv4 connectivity mean are separated by a dot (. bytes! The  IPv6 Connectivity is a dream come true a /16 subnet 192.168.0.0/255.255.0.0, which quickly! Of Internet Protocol ( IP ): IPv4 and IPv6 must not be used simultaneously its 128-bit address,. Identifies a network interface on a network using an addressing system multicast traffic and to addressing. Least not yet one called 6to4 is likely the most obvious answer is that IPv4 is 32-bit IP address )... A, B, and even mobility a non-loopback interface with a source! Every address ending in 0 or 255 can not directly communicate with IPv6-only hosts subnet is to! The flag  more fragments flag to identify devices on the network type and aptly named: options networks. Ipv6 offers 8 header fields traffic and to provide addressing space for unrestricted on... The world ’ s the difference between cloud computing and web hosting who receive actionable tech from. Via IPv4, or Internet Protocol is responsible for establishing connections between computers, servers, mobile devices on... Do about it created in 1977 by Vinton Cerf—often referred to as the only connection there... The Protocol that defines and enables internetworking at the inception of the experimental! 4.29 billion, a number that seemed at the time sufficient networking n't! 32-Bit number that uniquely identifies a network interface on a network for just two.! Manual and automatic configurations – depending on the network and it say IPv4 connected, but large blocks are for. Stopped working are compatible at this point in time, Bootstrap Protocol ( dhcp ), Protocol... Any effect on you at all separated by a dot (. in networks smaller than /24, broadcast Do... All public routers address translation at a routing gateway for this purpose for us to connect devices..., Option class, and Option number are sometimes referred to as a local broadcast address for messages... Innocence '' with a small Internet population cloud computing and virtualization TCP/IP the... 0 is for  control '' options, and even mobility requires translating, called resolving, to...


text:
### Home > CCA > Chapter 5 > Lesson 5.2.1 > Problem5-55

5-55.

This problem is a checkpoint for laws of exponents and scientific notation. It will be referred to as Checkpoint 5A.

Simplify each expression. In parts (e) through (f) write the final answer in scientific notation.

1. $4^2·4^5$

1. $(5^0)^3$

1. $x^{−5}·x^3$

1. $(x^{−1}·y^2)^3$

1. $(8\times10^5)·(1.6\times10^{−2})$

1. $\frac { 4 \times 10 ^ { 3 } } { 5 \times 10 ^ { 5 } }$


text:
# From hash to Cryptographic hash

After reading some excellent papers on SipHash, I understood that good non-cryptographic hashes such as MurmurHash and CityHash are not secure for MAC usage, due to a certain type of DDos attack becoming possible, thanks to a combination of Hash-table degeneracy into a list and predictable collisions.

The central hypothesis is that it is possible to build multiple secret-key-independant collisions, because the inner hash loop evolution is secret-key-independant.

The reasoning and solution is clever, however i see that it requires a manual investigation of the algorithm by cryptographic expert. This conclusion wasn't drawned from automated tools. I guess the near-perfect distribution and avalanche of MurmurHash would have defeated such automated analysis. But i may be wrong.

I would like to apply this learning to xxHash. Consider this a learning exercise.

xxHash seems to avoid the specific issue described into the SipHash paper by integrating the secret-key into internal state right at the beginning, before the inner loop. As a consequence, since the next internal state depends on the previous one, the difference between 2 consecutives internal state cannot be secret-key-independant. Therefore, it looks like it prevents the existence of secret-key independant collisions, and solve, or partly solve, the collision-resistance property.

Currently, xxHash is not cryptographic mostly because its output is 32-bits. However, creating 64-bits & 128-bits variants from it can be pretty straighforward.

So let's pretend that the 32-bits output is not a problem (brute-force solution is accessible, but if that is the only solution, then the underlying principles are considered "about okay").

Question : Is there a way to analyse xxHash and tell, either by human analysis, or with an automated tool, that this hash function is or is not cryptographic ? And if not, what needs to be solved ?

PS : as an obvious source of information, let's check Wikipedia on what is a cryptographic hash function. Apparently, pre-image and collision resistance is all it takes to make an already good Hash function become a cryptographic one. Is this correct ?

[EDIT]

Here is a candidate solution to produce a secret-key independant collision for xxHash. Well, almost. Note that many restrictions apply, and that this trick is not guaranteed to work, due to the secret key. In best circumstances however, it's likely to work with a probability of 50%.

1) At position $P$, such as $P$ is a multiple of $4$, there is a 32-bits sequence $S$.

2) Add the value $A =$ 0xBD1C0000 to $S$. This will add a fixed value to $Op1(S) = S * prime2$, which is $Op1(A) = A * prime2 = 000A0000 = bit18$ (due to multiplication transitivity)

3) However, what we really want is not to add $bit18$, but to modify the 18th bit of $op1(S)$, hence from 0 to 1. The reason is, that if $Op1(S) & bit18 == 1$ , by adding $bit18$, we will not only modifiy the 18th bits, but also one or several other upper bits, due to carry spillover. Since we want a predictable result, we want to avoid that.

4) As a consequence, we need to select $P$ containing sequence $S$ such as $Op1(S)$ respects this condition (18th bit = 0). Since, for a random input, there is a 50% chance that the 18th bit of $Op1(S)$ is equal to zero, for any long enough input, a solution is very likely to be found (with S = 0 being an obvious solution).

5) However, it's not finished. $Op1(S+A)$ is then added to an unknown internal state, that we will call $Z$. This internal state is dependant on the secret key.

6) The same condition as before apply : in order to have a controllable effect, we need the 18th bit of $Z$ to be 0. However there is no way to check nor guarantee that condition. As a consequence, the method presented here is not guaranteed to work properly (probability 50%... for now)

7) In fact, it is even worse than that : we need both to ensure that the 18th bit of $Z$ is zero, and that the addition of lower bits of $Z$ and $Op1(S+A)$ do not add up to the 18th bit, as a consequence of carry spillover.

8) Fortunately, this latest condition can be made more probable by ensuring that lower bits of $Op1(S)$ are also zero, such as the 17th bit, then the 16th bit, and so on. Unfortunately, with each more zero condition, the probability to find a suitable $S$ decrease. With respect to this latest condition, the best possible input is $S=0$.

9) Now, if all above conditions are met, then the result of $Z1 = Z + Op1(S)$ has been slightly altered, by turning on its 18th bit : $newZ1 = Z + Op1(S+A) = oldZ1 + bit18$.

10) As a consequence, $Z2 = op2(Z1)$ is slightly altered too. Since $Op2$ is a left-rotation of 32-bits field by 13 bits, we have $newZ2 = oldZ2 + bit31$ (bit31 is highest bit).

11) As a consequence, since $Op3$ is a simple multiplication by a prime number, the $bit31$ effect will remain unmodified.

12) This $bit31$ will be counter-balanced at position $P+16$. Here, it's enough to add to the initial sequence $S2$ the value $B =$ 0x80000000, because $Op1(B) = 80000000 = B$. This will cancel the difference from previous round.

[EDIT 2]

Here is a better solution. This one needs nothing special regarding secret key, and its success rate is almost 100%.

1) We'll do the other way round : we will add just $1$ to $A = Op1(S)$. To get this effect, it's enough to add B6C92F47 to the initial sequence $S$ situated at position $P$ such as $P$ being a multiple of 4.

2) The beauty of this method is that it works as long as the lowest 17 bits of $Op1(S)$ are different from all 1. Which means that it almost always work. Moreover, it's easy to check if the condition is respected.

3) If the above condition is respected, $Op2$ will merely shift the added 1 by 13 bits. So $B = Op2(A)$ is now modified by +(2^13).

4) Now we can calculate the impact on $C=Op3(B)$. Since $newB = oldB + bit13$, we have $newC = oldC + Op3(bit13)$. $Op3(bit13) =$ EF362000.

5) Now, we have to cancel this on the next round. To get this result it's enough to add -EF362000 = 10C9E000. To add 10C9E000, we need to add 981D2000 to $S2$, because $Op1(981D2000) = 10C9E000$.

6) We now have a couple of values. Add B6C92F47 to the 32-bits field at position $P$, such as $P$ is a multiple of 4. Then add 981D2000 at position $P+16$. This solution works with a probability > 99.9%, requiring no special knowledge on secret key.

-
Which of the two inputs do you call "secret key"? The "seed" or the "input" argument? –  Paŭlo Ebermann Feb 20 '13 at 20:18
"secret key" = "seed" –  Cyan Feb 21 '13 at 10:11

## 1 Answer

Well, first of all, you need to be clear about the meanings of various cryptographical primitives.

• Cryptographic hash function; this is a function that takes an input string, and generates a hash. The idea is that we don't know how to create two input strings with the same hash, and so the hash can be used as a replacement for the original string. Now, cryptographic hash functions don't take a secret key, because we need to assume that anyone is able compute them; xxHash is obviously not a cryptographic hash function. And, yes, there are "keyed hash functions" which do take secret keys; xxHash isn't one of those either.

• Message authentication codes; this is a function that takes a message and a key; it generates an output string (a MAC). The idea is that if someone doesn't know the key, they can't generate the MAC for any message that they haven't seen the MAC for. This is rather closer to what you are hoping xxHash to be.

That being said, to answer the question, yes, there is a way to analyse xxHash and determine whether it is a secure message authentication code. And, the answer is whether it is a secure message authentication code is "no" (and if the answer was "yes", there would have been no really good way to determine that).

One way to see that is that, in fact, xxHash is not second preimage resistant, even to someone who doesn't know the key. Specifically, given a valid message/MAC pair (where the message is at least 32 bytes long), it is possible to construct a second message that, with probability $p=0.5$, evaluates to the same MAC. Remember that this is a violation of the Message Authentication Code security guarantees, not specifically because it is a collision, but because it allows the attacker to compute the MAC of a message he hasn't been given the MAC to (and it's a violation independent of whether that MAC value happens to be a value he has seen before).

As to how to find the alternative message, well, you said to treat this as a learning exercise, this can be considered an exercise to the reader. However, here's how it works overall; you introduce a change at step $X$, which disturbs the state. You also introduce a second change at step $X+1$ (actually, because of how xxHash works, 16 bytes later), and this second change cancels out the effects of the first change, leaving the internal state while processing the altered message exactly the same as the corresponding step for the original message. The success probability $p=0.5$ is there because whether the change is precisely what we expect depends on whether a certain internal carry happens during an addition. For, how can we arrange these two changes to make this happen?

-
Thanks for clarifying, the difference between cryptographic Hash and MAC is much better now. –  Cyan Feb 21 '13 at 10:18
That looks like an excellent answer. The principles which make xxHash not suitable for MAC usage seem identical to those targeting MurmurHash : mainly, the claim is that it is possible to forge 2 consecutives sequences which will cancel each other, whatever the underlying internal state is, making this operation independant of the secret key. I would feel better, nonetheless, if i could find such consecutive sequences. –  Cyan Feb 21 '13 at 10:32
@Cyan: here's step one in an approach to attacking this; one of the steps within xxHash is the assignment "v1 += XXH_LE32(p) * PRIME32_2". Suppose that, which a certain block from a certain message, the value of 'v1' was $X$ (which you do not know). How could you modify the block being processed at this point so that the value of 'v1' after this step is the value $X+A$ (for a value $A$ that you pick)? –  poncho Feb 22 '13 at 3:27
Yes, sure, in this case a solution would be easy. It would be possible to create a A, and then -A. The problem is, this is not the full line of operations. The full line is : v1 += XXH_LE32(p) * PRIME32_2; v1 = XXH_rotl32(v1, 13); v1 *= PRIME32_1; Operations 1 alone would match your hypothesis, Operation 2 makes it more complex but i feel it would still be possible to find a solution; but operation 3 (v1 *= PRIME32_1;) seems to scramble everything. I don't see how it could be made "independant of X", which is the whole point. –  Cyan Feb 22 '13 at 10:15
@Cyan: I said it was step 1; step 2 of finding the attack would be 'how do we pick A so that, after the rotate, we have a predictable result; if the real packet had the value $Y$ at that point, our altered packet would have a good chance of being $Y+B$ (for some $B$ we know). Originally, I found an $A$ for which this would hold with $p=0.5$; I now see other $A$ values which have $B$ values that hold with much higher probabilities. In any case, work on step 1; you'll learn from it. –  poncho Feb 22 '13 at 16:21


text:
4 Replies

• I guess it's not "uninstalled", but the shortcuts are all messed up now.   I tried looking in "C:\Program Files" and didn't see the executables at first.    I guess they are hiding in "C:\Program Files\Microsoft Office\root\Office16" instead of "C:\Program Files\Microsoft Office\Office16"

I re-ran the installer and it didn't fix the shortcuts.

• Alright, and now the shortcuts reappeared on their own.  I think after manually opened Excel direct from "C:\Program Files\Microsoft Office\root\Office16"
But the weird Edge shortcuts are still kinda there in a confusing way.   Almost like they are "Tiles".  (But we use Open-Shell and they still show up)

• Steve Zemanek wrote:

I guess it's not "uninstalled", but the shortcuts are all messed up now.   I tried looking in "C:\Program Files" and didn't see the executables at first.    I guess they are hiding in "C:\Program Files\Microsoft Office\root\Office16" instead of "C:\Program Files\Microsoft Office\Office16"

I re-ran the installer and it didn't fix the shortcuts.

I was going to say, that hasn't happened to us yet though.


text:
## Delimiter Matching

We are doing delimiter matching when we check to see if the parentheses in an expression -- like the one shown below -- are balanced.

$$( w \times ( x + y ) \,/\, z - ( p \,/\, ( r - q ) ) )$$

Of course, we are not limited to parentheses. We may have to ensure that several different types of delimiters are balanced (e.g., braces {}, brackets[], parentheses(), angle brackets<>). In doing so, we must ensure that:

• Each opening on the left delimiter must be matched by a closing (right) delimiter.
• Left delimiters that occur later should be closed before those occurring earlier.

## Examples

c[d]          // correct
a{b[c]d}e     // correct
a{b(c]d}e     // not correct; the "]" after the c doesn't match the "(" after the b
a[b{c}d]e}    // not correct; nothing matches the final }
a{b(c)        // not correct; nothing matches the opening }

## Delimeter Matching by Using Stacks

The below gives a simple algorithm that uses a stack to determine if the delimeters in an expression match:

1. Read the characters from the string.

2. Whenever you see a left (opening) delimiter, push it to the stack.

3. Whenever you see a right (closing) delimiter, pop the (hopefully matching) opening delimiter from the stack, and

1. If they don't match, report a matching error
2. If you can't pop the stack because it is empty, report a missing left delimiter error

4. If the stack is non-empty after all the characters of the expression have been processed, report a missing right delimeter error.


text:
### MXPUF: Secure PUF Design against State-of-the-art Modeling Attacks

Phuong Ha Nguyen, Durga Prasad Sahoo, Chenglu Jin, Kaleel Mahmood, and Marten van Dijk

##### Abstract

Silicon Physical Unclonable Functions (PUFs) have been proposed as an emerging hardware security primitive in various security applications such as device identification, authentication, and cryptographic key generation. Current so-called strong' PUFs, which allow a large challenge response space, are compositions of Arbiter PUFs (APUFs), e.g. the $x$-XOR APUF. Wide-scale deployment of state-of-the-art compositions of APUFs, however, has stagnated due to various mathematical and physical attacks leading to software models that break the unclonability property of PUFs. The current state-of-the-art attack by Becker, CHES 2015, shows that the XOR APUF can be broken by modeling its APUF components separately thanks to CMA-ES, a machine learning algorithm, based on reliability information of measured XOR APUF responses. Thus, it is an important problem to design a strong PUF which can resist not only traditional modeling attacks but also Becker's attack. In this paper, we propose a new strong PUF design called $(x,y)$-MXPUF, which consists of two layers; the upper layer is an $n$-bit $x$-XOR APUF, and the lower layer is an $(n+1)$-bit $y$-XOR APUF. The response of $x$-XOR APUF for an $n$-bit challenge $\mathbf{c}$ in the upper layer is inserted at the middle of $\mathbf{c}$ to construct a new $(n+1)$-bit challenge for the $y$-XOR APUF in the lower layer giving the final response bit of the $(x,y)$-MXPUF. The reliability of $(x,y)$-MXPUF can be theoretically and experimentally shown to be twice the reliability of $(x+y)$-XOR PUF. In the context of traditional modeling attacks, when we keep the same hardware size, the security of $(x,y)$-MXPUF is only slightly weaker than that of $(x+y)$-XOR PUF. Our main contribution proves that the $(x,y)$-MXPUF is secure against Becker's attack.

##### Metadata
Available format(s)
Category
Implementation
Publication info
Preprint. MINOR revision.
Keywords
modeling attackpropagation criterionreliability based modelingXOR APUF
Contact author(s)
dpsahoo cs @ gmail com
History
2017-06-14: received
Short URL
https://ia.cr/2017/572
License

CC BY

BibTeX

@misc{cryptoeprint:2017/572,
author = {Phuong Ha Nguyen and Durga Prasad Sahoo and Chenglu Jin and Kaleel Mahmood and Marten van Dijk},
title = {MXPUF: Secure PUF Design against State-of-the-art Modeling Attacks},
howpublished = {Cryptology ePrint Archive, Paper 2017/572},
year = {2017},
note = {\url{https://eprint.iacr.org/2017/572}},
url = {https://eprint.iacr.org/2017/572}
}
`
Note: In order to protect the privacy of readers, eprint.iacr.org does not use cookies or embedded third party content.


text:
# Microeconomics: What is the socially optimum price?

1. Feb 24, 2012

### lugita15

It is said in microeconomics that if there is a drought and you're the only one with a few spare water bottles, and you're feeling generous, you shouldn't just hand them out to people on a first-come, first-served basis. That's because you don't know how badly each person needs water, and if you want to maximize social welfare you'll want to give the water to the people who value the water more rather than those that value it less. So the solution to this problem is to sell the water bottles for a price. That way, people will automatically choose to buy the water if the water is worth more to them than the price, and they will choose not to buy the water if the price is worth more to them than the water. So you've classified people based on how much the water is worth to them, and you've given water to those for whom it is worth the most.

Microeconomic theory says that you should sell the water for a price even if you're not interested in making money; if you really don't care about the money you should just donate the sales proceeds to charity, but the imposition of a price increases social welfare. My question is, how is the right price determined? I know in the case where you have self-interested buyers and sellers, then the optimum price is the intersection of the supply and demand curves, i.e. the market clearing price. But how would you do it in this case, where the buyers are all self-interested, but the seller doesn't care about himself at all and just wants to help society?

The problem is, given a bunch of buyers, each with their own demand curve for water (let's assume for simplicity that they're all linear, but have different slopes), what is the right price to charge them, given a fixed supply of water bottles?

Any help would be greatly appreciated.

2. Feb 24, 2012

### 256bits

Microeconomic theory says that,,,,,
Really. I guess someone should tell all the people running the internet and that all the free stuff must now have a charge because social welfare is not being optimized, especially all those free programming people behind Linux and related software.

Optimum price for who? the seller or the buyer.

The right price.
Thus, if the seller's money has no use for society, then the optimum price is $0.00 The seller should sell his water FOR FREE! Optimally, the water would be "sold" to the people "willing" to pay most for them. In reality the only way to do this is through charging a price. I suppose what you could do is auction the water. The person who is willing to pay most for the water will receive the water, but he will get his money back as well as the water. This way you guarantee the water is actually going to the people who are willing to pay most for it, and yet you aren't charging them anything for it. But this transaction would have to be done out of sight of the other buyers, who may become angry if they find out what is going on. This would be a negative externality, which I won't consider here. You could also give away the water on a first-come first-serve basis. You can think of the early buyers as "willling to pay more" for the water. This argument is not that strong though. But in the end, what matters is that the price must be$0.00. A price of $0.00 guarantees greater consumer surplus than any other price. What may vary is who "buys" the water, which is irrelevant if you are asking only for the optimum price. EDIT: When you talk about supply and demand, you are actually talking about aggregate supply and demand, which is the sum of the supply and demand of each individual seller/buyer respectively. So whether each buyer has his own demand curve makes no difference to the problem. You care only about the aggregate demand at a given price. The individual demands add up to give the aggregate demand. BiP Last edited: Feb 25, 2012 7. Feb 25, 2012 ### lugita15 Let me rephrase my question as follows. Suppose we have N water bottles, and two people who want water, each with their own demand curve for water. Using these individual demand curves, how would you calculate the quantities Q1 and Q2 of water bottles that should be allocated to each person in order to maximize social welfare? And under what conditions does there exist a price P such that (Q1,P) and (Q2,P) are points on the respective demand curves of the two buyers? And finally, how would you generalize this to arbitrary numbers of buyers? 8. Feb 25, 2012 ### WhoWee How did you obtain the water bottles - did you pay a price? 9. Feb 25, 2012 ### lugita15 You just happen to have a fixed supply of water bottles, and no ability to get any more. You can assume they fell from the sky or something. 10. Feb 25, 2012 ### Physics Monkey I feel like this scenario depends a lot on your assumptions. How do you define social welfare? One can cook up all sorts of scenarios where the answer is anything you want. 11. Feb 25, 2012 ### Bipolarity For the purposes of answering his question, we can assume that social welfare is the same as the total surplus. That's how most microeconomics textbooks define social welfare, assuming no externalities. So it reduces to an optimization problem, whereby our goal is to maximize the total surplus. Terms in economics are generally not defined as vaguely as one might think; most of them are mathematically defined, so we need not argue over definitions. His problem is not really about subjective definitions or anything. It is just complicated mathematically because so many things have to be considered, and first principles come into question. Lugita, I am working on a solution as we speak. I think it may require a bit more mathematics than I had envisioned, so allow me to take my time. What I can assure you is that the price charged to EVERY buyer is definitely$0.00 no matter the number of bottles or the demand for them. Figuring out the quantities is a little more complicated though, but I'll get back to you on it.

BiP

Last edited: Feb 25, 2012
12. Feb 25, 2012

### Bipolarity

I think I have a solution but it assumes that all the demand curves are linear, which is only an approximation of the true general solution.

Let's suppose there are N water bottles and M buyers, each with their own individual demand curves.

The demand curves for the M buyers can be notated as follows:
$$D_{1} = c_{1} - m_{1}P$$
$$D_{2} = c_{2} - m_{2}P$$
$$D_{3} = c_{3} - m_{3}P$$
$$...$$
$$D_{M} = c_{M} - m_{M}P$$

The price charged to all these buyers will be $0 because any price higher than that results in reduced consumer surplus, as explained in my previous posts. We have to decide on the quantity. Who will receive the N water bottles? Well, when the price is zero, the demand for each of the following buyers can easily be solved by plugging in $P = 0$: Quantity Demanded by each particular buyer when the price is zero: $$D_{1} = c_{1}$$ $$D_{2} = c_{2}$$ $$D_{3} = c_{3}$$ $$...$$ $$D_{M} = c_{M}$$ Thus, the respective quantities that will be sold to each buyer is $(c_{1},c_{2},c_{3}...c_{M})$. This is basically the x-intercept of each buyer's demand curve. This is only possible if $\sum c < N$. If $\sum c > N$, then we do not have enough bottles to feed everyone and so the bottles must be rationed more wisely. I will work on a solution for that case. Last edited: Feb 25, 2012 13. Feb 25, 2012 ### lugita15 . In economics, welfare is defined as utility measured in dollars (or any currency). If you'd be willing to buy something at$9.99, but willing to sell it at $10.01, then we say that the benefit you get from it is worth$10 in welfare. Social welfare is defined to be the sum of everyone's individual welfare. Why do economists care about social welfare? Because it is a measure of economic efficiency. A situation is called economically inefficient if someone can be made better off without making anyone worse off, and it's called efficient if all opportunities to mae people better off without hurting anyone have already been taken advantage of. In order to achieve that, we have to maximize social welfare.

14. Feb 25, 2012

### Bipolarity

IF it so happens that If $\sum c > N$, then we must ration the bottles to the buyers willing to pay most for the water (though we will not charge them anything). This we can do through auctioning and looking for the highest bidder. Once we have depleted all our water, we will return the money to them, effectively making the price $0.00 But the actual quantities that each buyer receives can be mathematically derived. For each buyer, we calculate his consumer surplus by integrating the whole area under his demand curve: $$Surplus \ of \ 1st \ buyer = \int^{c_{1}}_{0}D_{1}\ dQ$$ $$Surplus \ of \ 2nd \ buyer = \int^{c_{2}}_{0}D_{2}\ dQ$$ $$Surplus \ of \ 3rd \ buyer = \int^{c_{3}}_{0}D_{3}\ dQ$$ $$...$$ $$Surplus \ of \ last \ buyer = \int^{c_{M}}_{0}D_{M}\ dQ$$ We start by "selling" the bottles for$0.00 to those buyers for whom the surplus is highest, and then continue until we have either run out of bottles, or run out of buyers.

In reality, we will not know the demand curves for anybody. We must simply auction them and then refund the money (to prevent confusion, this must be done after all the bottles/buyers have been depleted).

I think for now this solution is adequate, but I wonder what we would do for a demand curve that has a more general shape.

BiP

15. Feb 25, 2012

### lugita15

Thanks for all this. I think we can fairly assume that everyone demands all the water bottles at a price of 0 dollars. Once we have integrated the surpluses by integrating each demand curve with respect to quantity, how do we calculate the quantities we should give each person? Is the quantity we should give linearly proportional to the surplus? Or is the relationship more complicated?

16. Feb 25, 2012

### Physics Monkey

I understand the very narrow definitions in classical microeconomics texts. It just seemed to me that the original question might have been after a more interesting answer. After all, these kinds of scenarios are often used to suggest the serious inadequacies of very simplistic microeconomic models.

17. Feb 25, 2012

### Bipolarity

I made a small mistake regarding the case where you don't have enough bottles to satisfy all the buyers.

If you have enough bottles, the problem is very easy. Just calculate the x-intercept for each buyer, and sell each buyer that many bottles.

If you don't have enough bottles, which is likely the case in a drought, the problem becomes quite complex. I think you would have to employ computational techniques to solve it. Mere calculus/algebra won't be sufficient, or at least I think a solution would take me (or anyone) a good while to find.

You would have to have a program that calculates which buyer is willing to pay the most for the next bottle. You would then sell a single bottle to him. Then the amount he's willing to pay would decrease due to the law of demand. The program would then repeat the process until all the bottles have been sold or until all the buyers have been satisfied.

I can't think of any non-computational solution out of the top of my head.

BiP

18. Feb 25, 2012

### Bipolarity

My knowledge of economics does not extend much beyond the simple microeconomic or macroeconomic models. There are many economic theories, all with their own axioms and postulates. But this scenario I think was invented by the OP perhaps as more a mathematical challenge than as a question of fundamental economic principles. The conditions in the problem may suggest that the simple models are flawed, but I think the math behind it proves otherwise. It's just that the math itself is frustratingly complicated.

I do not think there any other economic models that would provide a different answer to this question. It's just that the answer itself involves some fairly advanced techniques to solve. I do not have much experience in computational math, but I don't think this problem can be solved otherwise. Of course I may be wrong.

19. Feb 25, 2012

### WhoWee

Even if they fell from the sky - a fixed supply means you'll need to first calculate your own needs - the amount left over is the quantity to price.

20. Feb 25, 2012

### lugita15

Assume you don't need any.