text:
# Observation on digit in base $2$ for $3^n$

Below table shows, representation in base $$2$$ for $$3^n$$

$$3^{00}=000000000000000000001\\3^{01}=000000000000000000011\\3^{02}=000000000000000001001\\3^{03}=000000000000000011011\\3^{04}=000000000000001010001\\3^{05}=000000000000011110011\\3^{06}=000000000001011011001\\3^{07}=000000000100010001011\\3^{08}=000000001100110100001\\3^{09}=000000100110011100011\\3^{10}=000001110011010101001\\3^{11}=000101011001111111011\\3^{12}=010000001101111110001\\3^{13}=110000101001111010011$$

Observation on column from right side

First column shows only $$\{1\}$$ in repeated pattern, May we call 'prefect symmetry'

Second column shows $$\{0,1\}$$ in repeated pattern

Third column shows $$\{0\}$$ in repeated pattern

Fourth column shows $$\{0,0,1,1\}$$ in repeated pattern

But from fifth column don't show repeated pattern

Question

How to show, 5th column and greater than 5th column don't have repeated pattern?

• For $n$th column there will be a pattern of length $2^{n-2}$. This is because the order of $3$ in the multiplicative group of residue classes modulo $2^n$ is $2^{n-2}$ (assuming $n\ge3$). May be you simply haven't run the sequence for long enough to see it? – Jyrki Lahtonen Feb 10 '20 at 16:09
• Actually, the sequence of fifth digits should be periodic since it depends only on $3^n\pmod {2^5}$. – richrow Feb 10 '20 at 16:09
• Your data suggests (didn't check) that in the fifth column you will see the pattern $0,0,0,1,1,1,1,0$ repeating. – Jyrki Lahtonen Feb 10 '20 at 16:11
• @JyrkiLahtonen thanks, i get it, i need to study on residue classes – Pruthviraj Feb 10 '20 at 16:16
• $3^2$ has one leading $1$, $3^3$ had two leading $1$, $3^4$ has one leading $1$, $3^5$ has $4$ leading $1$, and so on. But after that, $3^n$ has seemingly always less than $n-1$ consecutive leading $1$ and it seems, as if there occur true randomness in the occurence of the position of the first zero in the bitstring. The underlying question is here, how good $3^n$ and $2^{n+a}$ can be approximated like: exists one $3^n$ which is $(2^n-1)\cdot 2^a +r$ with $r<2^a$. Reformulated there is an open problem behind this but I tried to find a pattern or some argument by the empirical observations. – Gottfried Helms Feb 11 '20 at 18:36

All the columns have a repeated pattern.

• For the fifth column from the right, the repeating pattern is "$$0,0,0,1,1,1,1,0$$".
• For the sixth column from the right, the repeating pattern is "$$0,0,0,0,0,1,0,0,1,1,1,1,1,0,1,1$$".
• For the seventh column from the right, the repeating pattern is "$$0,0,0,0,1,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,0,0,0,1,1,0,1,0,0,0,0,0$$".

We can prove that every column is periodic. We do this by showing that the last $$m$$ columns are jointly periodic for every $$m \geq 1$$. It should be clear that if each of the last $$m$$ columns is periodic with periods $$p_1, p_2, \dots, p_m$$, that they are jointly periodic with period $$\mathrm{lcm}(p_1,p_2, \dots,p_m)$$, where $$\mathrm{lcm}$$ is the least common multiple. Also, if the last $$m$$ columns are jointly periodic, each column is periodic (with period dividing the joint period).

The last $$m$$ columns are the least nonnegative member of the congruence class $$3^n$$ modulo $$2^m$$. There are only $$2^m$$ such congruence classes. Consequently, there are only $$2^m$$ possible different values in the last $$m$$ columns and so after $$2^m+1$$ powers of $$3$$ there is at least one repetition in the last $$m$$ columns. If a value in the last $$m$$ columns is ever repeated, say $$3^a$$ and $$3^b$$ have the same last $$m$$ columns, then the sequence of values between $$3^a$$ and $$3^b$$ repeats forever because $$3^a\cdot 3$$ has the same last $$m$$ columns as $$3^b \cdot 3$$, and so on.

This argument allows an initial portion of the powers of $$3$$ to not be repeated, followed by a forever repeating part. We now show that the initial, not repeated portion is empty. Note that $$3$$ and $$2^m$$ share no prime factors. This means $$\gcd(3,2^m) = 1$$. By the extended Euclidean algorithm, we can find integers $$u$$ and $$v$$ such that $$3 u + 2^m v = 1$$. This also says $$3u$$ is congruent to $$1 = 3^0$$ modulo $$2^m$$. Suppose $$3^a$$ and $$3^b$$, $$0 < a < b$$ are the first pair of powers of $$3$$ that repeat modulo $$2^m$$. Then $$3^{a-1} = 3^a \cdot u$$ modulo $$2^m$$ is congruent to $$3^{b-1} = 3^b \cdot u$$ modulo $$2^m$$ (by contradiction, we're done, but the constructive version is nearly done also...) and we can walk both of these back to $$3^0$$ congruent to $$3^{b-a}$$. Thus, $$3^0$$ is the first member of the first period.

It shouldn't be too difficult to realize that $$a^k \pmod n$$ will eventually always have a repeating pattern as there are only $$n$$ values of $$\pmod n$$ there must be a $$a^k\equiv a^r\pmod n$$ with $$r > k$$. And when that occurs $$a^{k+i} \equiv a^{r+i}$$ for all terms there after.

It's not so obvious (but still true nonetheless) that if $$\gcd(a, n) =1$$ then if $$a^k \equiv a^r$$ then $$a^{k-1} \equiv a^{r-1}$$ so that pattern begins "at the beginning with" $$a^0 \equiv a^m \equiv 1$$.

So the 5th column has pattern but you just don't have enough samples. We are looking at $$a^k \equiv \pmod 2^5$$ so the pattern is at most $$32$$

Eulers theorem says that $$\phi(2^k) = 2^{k-1}$$ and $$3^{2^{k-1}}\equiv 1$$ so the last $$5$$ digits have a repeating pattern of at most $$16$$. and if you look the last five digits of $$3^{0}$$ are $$00001$$ and the last five digits of $$3^{16}$$ are ... well you didn't go far enough.

$$3^{16} = 101001000011010111010\color{blue}{00001}$$.

But the pattern doesn't have to be $$16$$ long. It could be something that divides $$16$$. ANd in this case $$3^{8} = 0000000011001101\color{blue}{00001}$$ and the pattern is eight long.

And the pattern is $$0,0,0,1,1,1,1,0$$

Contrary to your belief, all columns have a repeated pattern. The period can be longer, this is why you don't see it.

For any $$a,b,n$$ integer,

$$a^{n+1}\bmod b=(a\,a^n)\bmod b=a(a^n\bmod b)\bmod b,$$ which is a simple recurrence between $$a^{n+1}\bmod b$$ and $$a^n\bmod b$$. Thus $$a^n\bmod b$$ must be a periodic sequence of period at most $$b$$.

In your case, $$b=2^m$$ and you only look at the first bit.

If we consider the fifth column, $$2^m=32$$, the period is $$1,3,9,27,17,19,25,11$$, with length $$8$$ (check that $$3\cdot11\bmod32=1$$), with the leading bits $$0,0,0,1,1,1,1,0$$.

For the sixth column, modulo $$64$$: $$1, 3, 9, 27, 17, 51, 25, 11, 33, 35, 41, 59, 49, 19, 57, 43$$, length $$16$$ (and $$3\cdot43\bmod64=1$$).


text:
+0

0
147
3

(square root of 2+square root of 8)^2

Guest Sep 27, 2017

#1
+725
0

$$(\sqrt{2}+\sqrt{8})^2$$

You can distribute the square.

$$\sqrt{2}^2+\sqrt{8}^2$$

The square root and the square cancel.

$$2+8=10$$

Sort:

#1
+725
0

$$(\sqrt{2}+\sqrt{8})^2$$

You can distribute the square.

$$\sqrt{2}^2+\sqrt{8}^2$$

The square root and the square cancel.

$$2+8=10$$

#2
+1704
+3

Uh oh! Squaring a binomial does not work that way!

The error was made at the step

$$\left(\sqrt{2}+\sqrt{8}\right)^2\Rightarrow\sqrt{2}^2+\sqrt{8}^2$$

This is incorrect.

$$(a+b)^2\neq a^2+b^2$$

How do I know that? Well, if you are ever unsure, try doing it yourself.

$$(a+b)^2=(a+b)(a+b)=a(a+b)+b(a+b)=a^2+ab+ab+b^2=a^2+2ab+b^2\neq a^2+b^2$$

Therefore, when you square a binomial, $$(a+b)^2=a^2+2ab+b^2$$.

Therefore, you can do the following:

 $$\left(\textcolor{red}{\sqrt{2}}+\textcolor{blue}{\sqrt{8}}\right)^2$$ Use the rule that $$(\textcolor{red}{a}+\textcolor{blue}{b})^2=\textcolor{red}{a}^2+2\textcolor{red}{a}\textcolor{blue}{b}+\textcolor{blue}{b}^2$$ $$\textcolor{red}{\sqrt{2}}^2+2\textcolor{red}{\sqrt{2}}\textcolor{blue}{\sqrt{8}}+\textcolor{blue}{\sqrt{8}}^2$$ Simplify the radicals. $$2+2\sqrt{8*2}+8$$ Here, I used another algabraic rule that $$\sqrt{a}*\sqrt{b}=\sqrt{ab}\hspace{1mm}\text{if}\hspace{1mm}a,b<0$$ $$2+2\sqrt{16}+8$$ Continue simplifying to the answer. $$2+2*4+8$$ $$2+8+8$$ $$18$$
TheXSquaredFactor  Sep 27, 2017
#3
+725
+1

Oh! Thank you! Well, I see where I went wrong, so thank you! Good job answering their question properly.

format: plain


text:
Math Calculators, Lessons and Formulas

It is time to solve your math problem

• Math Tests
• ::
• Complex Numbers
• ::
• Tests in Complex Numbers
Test Title:

# Tests in Complex Numbers

There are 6 tests inside this topic. Click the button below to change currently active quiz.

Current: Test in Dividing Complex Numbers
•  Q1: 1 pts Divide. Write in the form $a + bi$. $$\frac{1}{i}=$$
 1 -1 i -i
•  Q2: 2 pts Write quotient in the form $a + bi$. $$\frac{10 + 5i}{5}$$
 2+i 2-i 2i -2i
•  Q3: 2 pts Write quotient in the form $a + bi$. $$\frac{5}{2+i}$$
 2+i 2-i 2i -2i
•  Q4: 2 pts Divide. Write in the form $a + bi$. $$\frac{13}{2+3i}$$
 2-3i 2+3i 3-2i 3+2i
•  Q5: 2 pts Divide. Write in the form $a + bi$. $$\frac{2+2i}{1-i}$$
 2 -2 2i -2i
•  Q6: 3 pts Divide. Write in the form $a + bi$. $$\frac{2+i}{1-i}$$
 $\frac{3}{2} - \frac{1}{2}i$ $\frac{1}{2} + \frac{3}{2}i$
•  Q7: 3 pts Divide. Write in the form $a + bi$. $$\frac{6\sqrt{2}+6i}{\sqrt{2}-i}$$
 $2 - 4\sqrt{2}i$ $2 + 4\sqrt{2}i$ $-2 - 4\sqrt{2}i$


text:
# Availability, prices and affordability of the World Health Organization’s essential medicines for children in Guatemala

Angela Anson1*, Brooke Ramay2, Antonio Ruiz de Esparza3 and Lisa Bero4

Author Affiliations

1 Department of Clinical Pharmacy, University of California, San Francisco, CA 94143-0622, USA

2 La Universidad del Valle de Guatemala, Vista Hermosa III, Guatemala City, Guatemala 01015

3 Cedar Associates, Menlo Park, CA 94025, USA

4 Department of Clinical Pharmacy, Institute for Health Policy Studies, University of California, San Francisco, CA 94118, USA

For all author emails, please log on.

Globalization and Health 2012, 8:22  doi:10.1186/1744-8603-8-22

 Received: 6 March 2012 Accepted: 13 June 2012 Published: 2 July 2012

This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

### Abstract

#### Background

Several World Health Organization (WHO) initiatives aim to improve the accessibility of safe and effective medicines for children. A first step in achieving this goal is to obtain a baseline measure of access to essential medicines. The objective of this project was to measure the availability, prices, and affordability of children’s medicines in Guatemala.

#### Methods

An adaption of the standardized methodology developed by the World Health Organization and Health Action International (HAI) was used to conduct a cross sectional survey to collect data on availability and final patient prices of medicines in public and private sector medicine outlets during April and May of 2010.

#### Results

A subset of the public sector, Programa de Accesibilidad a los Medicamentos (PROAM), had the lowest average availability (25%) compared to the private sector (35%). In the private sector, highest and lowest priced medicines were 22.7 and 10.7 times more expensive than their international reference price comparison. Treatments were generally unaffordable, costing as much as 15 days wages for a course of ceftriaxone.

#### Conclusions

Analysis of the procurement, supply and distribution of specific medicines is needed to determine reasons for lack of availability. Improvements to accessibility could be made by developing an essential medicines list for children and including these medicines in national purchasing lists.

##### Keywords:
Guatemala; Essential medicines for children; National formulary; Availability; World Health Organization

### Background

Children in poorer countries are more likely to die from treatable conditions than those in higher resource settings because they do not receive appropriate or timely medications [1]. This is also true in Guatemala, where poverty contributes to the country’s high mortality rate for children under the age of five [2]. Millennium Development Goal 4 (MDG4) states that a two-thirds reduction in mortality from 1990 to 2015 in children younger than five years is essential for global development [3]. Compared to the rate of mortality in 1990, Guatemala will need to increase the rate of decline in childhood deaths from 75.8 to 25.3 deaths per 1000 to achieve the MDG goal by 2015 [4]. To assist member countries with achieving MDG4, the WHO constructed the first Essential Medicines List for Children (EMLc) and launched the “Make Medicines Child Size” effort in December of 2007. This initiative aims to improve the accessibility of safe, effective and quality medicines for children by promoting awareness and action through research, regulatory measures and changes in government policy.

A vital first step to improving medicine access for children is measuring the availability and prices of essential medicines present on pharmacy shelves and in national medicines lists. Data on medicine stock deficits and unaffordable prices creates an evidence base to inform the development of national and regional policies. A recent survey of essential medicines for children in Africa exposed the severe lack of medicines for children in central medicine stores, hospitals, pharmacies and national medicine lists in 14 different countries [5]. The objective of this study is to measure access to children’s medicines in Guatemala using validated methods, similar to those used in Africa [6,7].

#### Sources of medicines in Guatemala

The Ministry of Health network is a publically funded group of primary, secondary and tertiary healthcare centers that render services to approximately 70% of the population in Guatemala [8]. Tertiary care hospitals provide a variety of medical specialty and outpatient services and offer medicines on an inpatient basis only, free of charge. The proportion of families who utilize these services or seek treatment elsewhere to care for their sick children is unknown.

The Ministry of Health also operates PROAM, which are pharmacies that offer medicines from Lista Basica, a formulary of medicines for common diseases afflicting the population. PROAM was created in 1998 by the Guatemalan Ministry of Health to ensure equal access to quality medications at reasonable prices [9]. The Ministry of Health establishes “contrato abierto, a system for setting suppliers and prices in which the government negotiates contracts with pharmaceutical companies to purchase medications [10,11]. The government then distributes medicines from Lista Basica needed to stock PROAM pharmacies which are subsequently sold to consumers. PROAM consists of approximately 514 outpatient medicine outlets throughout the country [12]. The law requires that all medications sold must comply with the United States pharmacopeia XXIV quality standards.

The most numerous medicine outlets in Guatemala are privately owned pharmacies, which number close to 4043 establishments throughout the country [12]. This makes the private sector an important source of medicines in Guatemala. There are various laws governing the structure and sanitation of all pharmacies, but no laws regulate the acquisition or prices of medications in the private sector [13-15]. Other sources of medication in Guatemala include Social Security hospitals, private hospitals, dispensing doctors, non-governmental organizations (NGOs) and unregistered dispensaries.

### Methods

We conducted a survey of the availability, prices and affordability of children’s medicines in Guatemala using an adaption of the standardized methodology developed by the World Health Organization (WHO) and Health Action International (HAI) [7]. A validation study of the WHO/HAI survey methodology conducted in Peru in 2005 found that focusing on commonly used medicines yields sufficient and valid results [16]. We collected data on the availability and final patient prices of medicines in a subsector of public and private sector medicine outlets during April and May of 2010.

#### Selection of medicine outlets

We selected six regions as survey areas for data collection: Guatemala City, Escuintla, Jalapa, Quetzaltenango, Retalhuleu, and Alta Verapaz. The major urban center of Guatemala City was selected and an additional five “departamentos” or states were chosen at random from those which could be reached within a day’s travel from Guatemala City. These departamentos are all comprised of a collection of urban and rural areas, however, the actual survey areas within each departamento varied demographically.

In each survey area, four to seven private and PROAM sector medicine outlets were randomly selected from a list of pharmacies registered by the Ministry of Health. The actual number surveyed was limited by accuracy of the Ministry of Health registry list and available manpower to carry out the surveys. The private sector sample included 29 outlets and the PROAM sector included 21 outlets. A tertiary public hospital located in each survey area was also included when permission was granted, yielding a sample of four hospitals. Pharmaceutical stores held by private dispensing doctors and non-governmental organizations were not surveyed due to lack of time and resources.

#### Selection of medicines

The “Better Medicines for Children Project” specifies a core list of the EMLc to be surveyed, representing medicines commonly used in the treatment of a range of conditions associated with childhood illness prevalent in low income countries [6]. The list specifies the child-specific dosage form and strength for 23 medicines, as well as one device.

We included 22 medicines and one device from the core list in the Guatemala survey. Artemether + lumefantrine was excluded, as it is used for P. falciparum species of malaria, which is not common in the Americas. Primaquine was selected as an alternate malarial medication, as it is effective against P. vivax, the prevalent species of malaria in Guatemala. When alternate formulations were registered in Guatemala, these were added into the list of index medicines and surveyed. In total, 27 medicines and one device were surveyed in Guatemala (Table 1).

Table 1. List of medicines surveyed in Guatemala

For each medicine surveyed, we recorded the highest and lowest price medicine available. In the PROAM sector, manufacturer was also recorded to determine if the product was brand or generic. Medicines in the public hospitals were free of charge to hospitalized patients so only availability was measured.

#### Data collection and analysis

Data collection took place during April and May of 2010. Six data collectors were trained according to the WHO/HAI methodology and pilot data collection was conducted. The data collectors visited medicine outlets and collected information on medicine availability and price using a standard data collection form specific to the medicines being surveyed in Guatemala. The data collectors entered survey data into the pre-programmed MS Excel Workbook provided as part of the WHO/HAI methodology. Data collection was verified in roughly 10% of pharmacies, data were double-entered and the data checker function on the spreadsheet was used to identify data entry errors.

Three medicines were excluded from the analysis leaving a total of 24 medicines and 1 device for analysis. Phenytoin and phenobarbital suspensions were excluded as the incorrect strengths of the medications were printed on the data collection sheets. Beclomethasone inhaler was omitted from the analysis because although it was included on the core list of children’s medicines for the survey, it was deleted from the EMLc in 2009 [17]. Of note, it was not found in any of the pharmacies surveyed in Guatemala. We calculated the availability of individual medicines as the percentage of sampled medicine outlets where the medicine was found. Data are reported in aggregate and by private vs. public sector pharmacies. We also report mean (average) availability for the list of medicines surveyed.

#### Cross-country comparisons

To facilitate cross-country comparisons, medicine prices obtained during the survey were expressed as ratios relative to a standard set of international reference prices:

Medicine price ratios were calculated only for medicines with price data from at least 4 medicine outlets. The exchange rate used to calculate MPRs was 1 US$= 8.1513 Quetzales; this was the commercial “buy” rate taken from OANDA.com on the first day of data collection [18]. We used the 2009 Management Sciences for Health (MSH) reference prices, taken from the International Drug Price Indicator Guide [19]. These reference prices are the medians of recent procurement prices offered for generic products by for-profit and not-for-profit suppliers to international not-for-profit agencies. #### Affordability We assessed the affordability of treating eight of common conditions causing high rates of morbidity and mortality of children in Guatemala by comparing the total cost of medicines prescribed at a standard dose to the daily wage of the lowest paid unskilled government worker at 56 quetzales ($6.87 USD per day) at the time of the survey. For acute conditions, treatment duration was defined as a full course of therapy, while for chronic diseases, the affordability of a 30-days' supply of medicines was determined. Though it is difficult to assess true affordability, treatments costing one days' wage or less were considered affordable [7].

This study was approved by the University of California, San Francisco Committee on Human Research, approval number H2758-35862.

### Results

#### Availability of medicines on the day of data collection

As shown in Table 2, the availability of individual medicines varied by type of medicine and sector. Average availability of all surveyed medications was very low. Public tertiary hospitals had the highest availability of medicines found with an average of 46% (range 28-56%) of medicines found in each outlet. Average availability in the private sector was 35% (range 10-52%) for lowest priced medicines. Average availability for a second, higher priced medicine when a lower price medicine was found, was 12% in the private sector.

Table 2. Availability of lowest price medications by sector

The PROAM sector had the lowest availability at 25% (range 5-43%). In the PROAM sector, generics were the predominant product type available, with 98% (142/145) of medicines found as generics. Although we expected that only medicines found on the Lista Basica would be stocked, some of these medicines had low availability including ferrous salt suspension (24%), gentamicin injection (33%) and procaine penicillin G (29%). When we limited the analysis to the 11 survey medicines found only on the Lista Basica (Table 1), availability increased to 57% (range 9-82%) in the PROAM sector. The availabilities of individual medicines in the PROAM, public tertiary hospitals and private sectors are shown in Table 3.

Table 3. Availability of individual medicines in the public, PROAM and private sector

#### PROAM and private sector patient prices

As shown in Table 4, lowest price medicines are generally sold at 1.73 times their international reference price in the PROAM sector. Half of the lowest priced generic medicines were priced at 1.24 (25th percentile) to 2.32 (75th percentile) times their international reference price, showing moderate variation in medicine price ratios across individual generic medicines in the PROAM sector.

Table 4. Median price ratios of lowest priced medicines, private and PROAM sector patient prices

In contrast, substantial variation exists in median price ratios in the private sector. We compared prices between lowest and highest priced products for six medicines for which more than one price option was found. In the private sector, higher price medications cost twice as much, on average, as their lowest priced equivalents. Higher priced medicines were 22.67 times more expensive than their international reference price. The cost of half of these medicines ranged from 11.21 (25th percentile) to 35.51 (75th percentile) times their international reference price. Lowest price medicines were 10.46 times their international reference price with half of these medicines priced at 5.57 (25th percentile) to 16.99 (75th percentile) times their international reference.

#### Comparison of patient prices in the PROAM and private sectors

Median price ratios were substantially higher in the private sector compared to the PROAM sector. Nine medicines that were found in both PROAM and private sectors had data available for price comparisons. As the median MPR was 1.61 and 10.32 for PROAM and private sectors, respectively, final patient prices were 6.41 times higher in the private sector than in the PROAM sector.

#### Affordability of standard treatment regimens

As shown in Table 5, lowest price medicines in the private sector were less affordable than in the PROAM sector for most conditions, with standard treatment costing a days' wage or more. Medicines costing over a days’ wage include ceftriaxone injection for susceptible infection costing 15 days wages and carbamazepine suspension for seizure disorders costing 6.6 days wages.

Table 5. Affordability: Number of days' wages of worker making lowest paid government wages needed to purchase standard treatments

### Discussion

The availability of essential children’s medicines is low in both the public and private sectors in Guatemala. Availability is lowest in the public sector, but there is inconsistent pricing and poor affordability of medicines in the private sector. Furthermore, formulations of medications that are preferable for use in children were often hard to find. Of the 30 medicine formulations in the survey protocol, seven were not assessed because they are not registered in Guatemala [6]. These consisted of dispersible (3) and chewable (2) tablets, oral liquid (1) and intrarectal solution (1); all formulations preferred for use in children. It is unclear if the lack of registered medicines for children is related to low prescriber demand similar to the case with magnesium sulfate in Zambia, or exclusion from the contrato abierto, the central government purchasing mechanism, due to high purchasing prices [20]. Guatemala is subject to rules and regulations under Trade Related Aspects of Intellectual Property Rights (TRIPS). Essential medicines that have been reformulated to be better suited for children may be under patent and therefore more expensive in Guatemala for up to 5 to 15 years after becoming generic in the United States [11]. Another factor that may be responsible for a dearth of registered child friendly formulations may be difficultly obtaining the product if it is not manufactured in the country or nearby. As suggested in previous literature, studies of local prescribing practices and government purchasing are required to fully answer these questions [5]. Development of a national essential medicines list that includes children’s medicines could increase demand from providers and guide purchasing decisions [21].

Among the surveyed medicines, originator brands were almost never available in the PROAM sector as the government contracts with generic pharmaceutical companies to procure less expensive medications. In addition, the availability of generic medicines in the PROAM sector was exceptionally low with only about one quarter of index medicines stocked in each outlet. These findings are similar to a recent study on the accessibility of children’s medicines in 14 African countries, where essential children’s medicines were available at central medicine stores 15 to 75% of time with only 3 medicine outlets containing over 50% of medicines [5]. Our findings are also consistent with a number of pricing and availability surveys that have been conducted for adult medicines for both acute and chronic diseases [22-25]. These studies show that availability of essential medicines is lower in the public than the private sector, varies by country, and that medicines for chronic conditions are less available than those for acute conditions.

Seven medications were not found at all in the private sector. One medication, chloramphenicol injection, was not stocked due to concerns about its toxicity. One would expect the remainder of these medicines to be found at the hospital level and therefore, not stocked in outpatient outlets. However, as the availability in hospitals is low, friends or family of hospitalized patients often go to alternate locations such as private retail pharmacies to purchase medications. Even the poorest patients in Guatemala seek medicines from the private sector [26].

Diarrheal disease is one of the major causes of mortality in children under five in Guatemala [8]. Although oral rehydration powders for reconstitution and premixed solutions for treatment of diarrhea were available in the PROAM and private sectors, oral zinc was unavailable in these sectors and the mean availability was only 25% in the hospital setting. Zinc is included on the EMLc due to its benefit in treating children with diarrhea [27].

Antibiotics for treating pneumonia and other respiratory infections in children should be available for use as empiric treatment, to decrease a major cause of morbidity in children [8]. While ceftriaxone was found quite frequently in the private and public sectors, it was only available in about half of the PROAM outlets. Amoxicillin and amoxicillin-clavulanic acid were available most frequently in 250mg/5ml concentration. When child appropriate concentrations are not available, pharmacy employees must calculate the dose. This could lead to adverse drug events as pharmacy employees in low income countries may need additional training [28].

In the PROAM sector, affordability of lowest price medicines was reasonable compared to the private sector where many of lowest priced treatments cost more than the daily wage of a lowest paid government employee. In the private sector, the most unaffordable treatments were for seizure disorder with carbamazepine (6.6 days wages) and infections with ceftriaxone (15 days wages). Carbamazepine is an ongoing treatment for a chronic condition, making it even less affordable. Given that 24% of the population in Guatemala is living below the international poverty line of less than \$2/day, treatments which appear affordable may still be too costly [29]. In addition, treatment costs refer to medicines only and do not include the additional costs of consultation and diagnostic tests. Finally, families who need medications for more than one child may be confronted with insurmountable drug costs. These findings are consistent with other studies of affordability of adult medicines showing that chronic medicines, in particular, are unaffordable for many populations [22,23,25,30].

A major strength of this study is the use of a previously validated methodology which allows for the measurement of medicine prices and availability in a reliable and standardized way [16]. Additional strengths include training and utilization of multiple check points to ensure quality data collection, data entry and interpretation.

Limitations of the WHO/HAI methodology are consistent with past surveys. Therapeutic alternatives or alternate dosage forms were not assessed. The availability data refers to the day of data collection at each particular facility in subsectors of the country and may not reflect average monthly or yearly availability of medicines at individual facilities or throughout the entire country. Also, the standard for determining the median price ratio is the median of supplier prices. However, if supplier prices are not available, buyer prices are substituted to determine the median international reference price for the different medications. This can lead to artificially high or low reference price that isn’t necessarily indicative of true median price paid internationally [25]. NGOs, private dispensing doctors and unregistered dispensaries were not surveyed and their importance as a source of medicines for those with low socioeconomic status is unknown. Further investigation is warranted into the amount that these sources contribute to accessibility to medications in Guatemala.

### Conclusion

The findings of this study can be used to structure policies to improve the accessibility of children’s medicines in Guatemala and help the country meet MDG4 in 2015. Monitoring the availability and pricing of children’s essential medicines in Guatemala and other countries is crucial for improving transparency about global prices. Updated lists of all registered pharmacies are needed to facilitate these analyses. Inclusion of the WHO’s Essential Medicines List for children into national formularies and purchasing lists such as the PROAM and contrato abierto could improve the availability of essential children’s medicines. Data should be collected on prescribing practices of local pediatricians to detect deficiencies, if any, in rational prescribing and develop educational programs to improve prescribing of medicines from the EMLc [5]. The coordination of the WHO EMLc with national clinical practice guidelines could promote physician use of essential medicines. Further analysis of the procurement, supply and distribution of specific medicines is needed to determine reasons for lack of availability [20].

### Competing interest

The authors declare that they have no competing interests.

### Author’s contributions

AA, BR, ARE and LB conceived of the study, and participated in its design and coordination and helped to draft the manuscript. All authors read and approved the final manuscript.

### Author’s information

AA is a PharmD and a Pharmacy Practice Resident at University of San Francisco, California Medical Center. BR is a PharmD and a Health Sciences Assistant Clinical Professor at University of San Francisco, California and a Professor in the Departamento de Química-Farmacéutica at the Universidad del Valle de Guatemala. ARE is an MPH and a consultant at Cedar Associates. LB is a PhD and Professor of Clinical Pharmacy and Health Policy.

### Acknowledgments

This project was supported by NIH/NCRR/OD UCSF-CTSI Grant Number TL1 RR024129. Its contents are solely the responsibility of the authors and do not necessarily represent the official views of the NIH.

Special thanks go to Licenciada Ana Margarita Contreras Sandoval, whose knowledge and hard work were priceless. We also thank Licenciado Elfegio Rolando Lopez, Steven Kayser, Nancy Hessol, Claire Lee, Ellen Shafer, Alexandra Cameron, Daniela Fernandez, Roberto Contreras Sandoval, Diego Rodriguez, Andres Hernandez, Carlos Alvarez and Ana Irene Perez.

### References

1. World Health Organization:

Communicable Disease Cluster: Removing obstacles to healthy development: report on infectious diseases.

2. United Nations Childrens' Fund: The state of the world's children 2008. New York: UNICEF; 2007. PubMed Abstract

3. The United Nations: The millenium development goals report 2010. New York: United Nations; 2010.

4. Rajaratnam JK, Marcus JR, Flaxman AD, Wang H, Levin-Rector A, Dwyer L, Costa M, Lopez AD, Murray CJ: Neonatal, postneonatal, childhood, and under-5 mortality for 187 countries, 1970–2010: a systematic analysis of progress towards Millennium Development Goal 4.

Lancet 2010, 375(9730):1988-2008. PubMed Abstract | Publisher Full Text

5. Robertson J, Forte G, Trapsida JM, Hill S: What essential medicines for children are on the shelf?

Bull World Health Organ 2009, 87(3):231-237. PubMed Abstract | Publisher Full Text | PubMed Central Full Text

6. Overview of methods for medicines availability and pricing surveys: Better Medicines for Children Project.

7. Health Action International; World Health Organization:

Meassuring medicine prices, availability, affordability and price components.

8. Pan American Health Organization:

Health in the Americas: Guatemala.

9. Congreso de la República de Guatemala:

Ley de accesibilidad a los medicamentos. 1998, 69-98.

10. Congreso de la República de Guatemala:

Ley de contrataciones del estado. 1992, 57-92.

Health Aff (Millwood) 2009, 28(5):w957-w968. Publisher Full Text

12. Ventas sociales y farmacias privadas: Ministerio de Salud.

13. Jefatura del departamento de regulación y control de productos farmacéuticos y afines. 2001.

14. Jefatura del departamento de regulación y control de productos farmacéuticos y afines. 2002.

15. Jefatura del departamento de regulación y control de productos farmacéuticos y afines. 2003.

16. Madden JM, Meza E, Ewen M, Laing RO, Stephens P, Ross-Degnan D: Measuring medicine prices in Peru: validation of key aspects of WHO/HAI survey methodology.

Rev Panam Salud Publica 2010, 27(4):291-299. PubMed Abstract | Publisher Full Text

17. World Health Organization: WHO model list of essential medicines for children: 2nd ed. Geneva, Switzerland: WHO; 2009.

18. Management Sciences for Health: International drug price indicator guide.

19. Ridge AL, Bero LA, Hill SR: Identifying barriers to the availability and use of Magnesium Sulphate Injection in resource poor countries: a case study in Zambia.

BMC Health Serv Res 2010, 10:340. PubMed Abstract | BioMed Central Full Text | PubMed Central Full Text

20. Priority Medicines for Maternal and Child Health:

A Global Survey of National Essential Medicines Lists.

21. Mendis S, Fukino K, Cameron A, Laing R, Filipe A, Khatib O, Leowski J, Ewen M: The availability and affordability of selected essential medicines for chronic diseases in six low- and middle-income countries.

Bull World Health Organ 2007, 85(4):279-288. PubMed Abstract | Publisher Full Text | PubMed Central Full Text

22. van Mourik MS, Cameron A, Ewen M, Laing RO: Availability, price and affordability of cardiovascular medicines: a comparison across 36 countries using WHO/HAI data.

BMC Cardiovasc Disord 2010, 10:25. PubMed Abstract | BioMed Central Full Text | PubMed Central Full Text

23. Cameron A, Roubos I, Ewen M, Mantel-Teeuwisse AK, Leufkens HG, Laing RO: Differences in the availability of medicines for chronic and acute conditions in the public and private sectors of developing countries.

Bull World Health Organ 2011, 89(6):412-421. PubMed Abstract | Publisher Full Text | PubMed Central Full Text

24. Cameron A, Ewen M, Ross-Degnan D, Ball D, Laing R: Medicine prices, availability, and affordability in 36 developing and middle-income countries: a secondary analysis.

Lancet 2009, 373(9659):240-249. PubMed Abstract | Publisher Full Text

25. Gwatkin DR, Rutstein S, Johnson K, Suliman E, Wagstaff A, Amouzou A: Socio-economic differences in health, nutrition, and population within developing countries: an overview.

Niger J Clin Pract 2007, 10(4):272-282. PubMed Abstract

26. Strand TA, Chandyo RK, Bahl R, Sharma PR, Adhikari RK, Bhandari N, Ulvik RJ, Molbak K, Bhan MK, Sommerfelt H: Effectiveness and efficacy of zinc for the treatment of acute diarrhea in young children.

Pediatrics 2002, 109(5):898-903. PubMed Abstract | Publisher Full Text

27. Goel P, Ross-Degnan D, Berman P, Soumerai S: Retail pharmacies in developing countries: a behavior and intervention framework.

Soc Sci Med 1996, 42(8):1155-1161. PubMed Abstract | Publisher Full Text

28. Worldbank:

Data by country.

29. Niens LM, Cameron A, Van de Poel E, Ewen M, Brouwer WB, Laing R: Quantifying the impoverishing effects of purchasing medicines: a cross-country comparison of the affordability of medicines in the developing world.

PLoS Med 2010, 7(8):e1000333. PubMed Abstract | Publisher Full Text | PubMed Central Full Text

30. World Health Organization: WHO model formulary for children. Geneva, Switzerland: World Health Organization; 2010.

Retrieved 26 March 2011, from http://www.who.int/selection_medicines/list/WMFc_2010.pdf

31. World Health Organization: Child growth standards.

2011.

Retrieved 26 March, 2011, from http://www.who.int/childgrowth/standards/weight_for_age/en/index.html


text: Range, Null Space, Rank, and Nullity of a Linear Transformation from $\R^2$ to $\R^3$, How to Find a Basis for the Nullspace, Row Space, and Range of a Matrix, The Intersection of Two Subspaces is also a Subspace, Rank of the Product of Matrices $AB$ is Less than or Equal to the Rank of $A$, Show the Subset of the Vector Space of Polynomials is a Subspace and Find its Basis, Find a Basis and the Dimension of the Subspace of the 4-Dimensional Vector Space, Find a Basis for the Subspace spanned by Five Vectors, Prove a Group is Abelian if $(ab)^2=a^2b^2$. So let us consider the case $aneq b$. So let’s nd the eigenvalues and eigenspaces for matrix A. Save my name, email, and website in this browser for the next time I comment. Free Matrix Diagonalization calculator - diagonalize matrices step-by-step This website uses cookies to ensure you get the best experience. Let $S=begin{bmatrix} 1 & 1\ 0& 1 end{bmatrix}$ be a matrix whose column vectors are the eigenvectors. When we introduced eigenvalues and eigenvectors, we wondered when a square matrix is similarly equivalent to a diagonal matrix? If you have n basis eigenvectors in total, stack them into the columns of a matrix P.. The steps: 1) Compute the eigenvalues. $\endgroup$ – corey979 Jan 13 '17 at 17:30 In fact, the above procedure may be used to find the square root and cubic root of a matrix. If not, Ais diagonalizable, and proceed to the next step. […], […] & mathbf{v} end{bmatrix} = begin{bmatrix} 1 & 1\ -1& 2 end{bmatrix}.] Find eigenvalues $\lambda$ of the matrix $A$ and their algebraic multiplicities from the characteristic polynomial $p(t)$. This website is no longer maintained by Yu. Learn how your comment data is processed. Do you need more help? Problem: What happened to square matrices of order n with less than n eigenvalues? there exists an invertible matrix P such that This website’s goal is to encourage people to enjoy Mathematics! Given an arbitrary n x n matrix A:. Moreover, if P is the matrix with the columns C1, C2, ..., and Cn the n eigenvectors of A, then the matrix P-1AP is a diagonal matrix. An = P-1BnP. Find all the eigenvalues of A and a basis for each eigenspace.. The calculator will diagonalize the given matrix, with steps shown. D = diag (v) returns a square diagonal matrix with the elements of vector v on the main diagonal. That is, find an invertible matrix P and a diagonal matrix D such that A=PDP-1 A = -11 3 -9 0-5 0 6 -3 4 Every Diagonalizable Matrix is Invertible, Maximize the Dimension of the Null Space of $A-aI$, Given Graphs of Characteristic Polynomial of Diagonalizable Matrices, Determine the Rank of Matrices, Determine Dimensions of Eigenspaces From Characteristic Polynomial of Diagonalizable Matrix, Determine Eigenvalues, Eigenvectors, Diagonalizable From a Partial Information of a Matrix, Quiz 12. Then by the general procedure of the diagonalization, we have begin{align*} S^{-1}AS=D, end{align*} where [D:=begin{bmatrix} -1 & 0\ 0& 5 […], […] For a procedure of the diagonalization, see the post “How to Diagonalize a Matrix. If there is an eigenvalue λ such that the geometric multiplicity of λ, dim(Eλ), is less than the algebraic multiplicity of λ, then the matrix A is not diagonalizable. Show Instructions. Diagonalization is the process of finding a corresponding diagonal matrix (a matrix in which the only non-zero components are on the diagonal line from to for an matrix) for a given diagonalizable matrix. This site uses Akismet to reduce spam. is equal to 1, then obviously we have mi = 1. A = P-1BP, then we have 4. This is one application of the diagonalization. Step by step explanation.” […], […] For a general procedure of the diagonalization of a matrix, please read the post “How to Diagonalize a Matrix. [V,D] = eig (A,B) returns diagonal matrix D of generalized eigenvalues and full matrix V whose columns are the corresponding right eigenvectors, so that A*V = B*V*D. Step 1: Find the characteristic polynomial, Step 4: Determine linearly independent eigenvectors, A Hermitian Matrix can be diagonalized by a unitary matrix, If Every Nonidentity Element of a Group has Order 2, then it’s an Abelian Group, Diagonalizable by an Orthogonal Matrix Implies a Symmetric Matrix. For each eigenvalue $\lambda$ of $A$, find a basis of the eigenspace $E_{\lambda}$. Notify me of follow-up comments by email. For each eigenvalue λ of A, find a basis of the eigenspace Eλ. The diagonalization theorem states that an matrix is diagonalizable if and only if has linearly independent eigenvectors, i.e., if the matrix rank of the matrix formed by the eigenvectors is. Indeed, consider the matrix above. For example, consider the matrix. Find eigenvalues λ of the matrix A and their algebraic multiplicities from the characteristic polynomial p(t). And I think we'll appreciate that it's a good bit more difficult just because the math becomes a little hairier. Matrix is diagonalizable if and only if there exists a basis of consisting of eigenvectors of . For each eigenvalue λ of A, compute a basis B λ for the λ -eigenspace. Diagonalize if Possible. So lambda is an eigenvalue of A. In general, you can skip parentheses, but be very careful: e^3x is e 3 x, and e^ (3x) is e 3 x. Step by Step Explanation. ST is the new administrator. se Orthogonally diagonalize the matrix, giving an orthogonal matrix P and a diagonal matrix D. To save time, the eigenvalues are - 4 and - 13. The output is given in two matrices. Period. A matrix is diagonalizable if and only if the matrix of eigenvectors is invertable (that is, the determinant does not equal zero). Compute answers using Wolfram's breakthrough technology & knowledgebase, relied on by millions of students & professionals. 2. In Mathematica there is a very convenient function called JordanDecomposition[].It takes a square matrix A as an argument and either diagonalizes it, or puts it into a block diagonal form A' and provides the transformation matrix s (such that A can be recovered by A=s.A'.Inverse[s]).. As an example, we solve the following problem. (adsbygoogle = window.adsbygoogle || []).push({}); Non-Example of a Subspace in 3-dimensional Vector Space $\R^3$, Determinant of a General Circulant Matrix, A Group Homomorphism is Injective if and only if the Kernel is Trivial, Find Values of $h$ so that the Given Vectors are Linearly Independent, Find All Matrices $B$ that Commutes With a Given Matrix $A$: $AB=BA$. A diagonalizable matrix is any square matrix or linear map where it is possible to sum the eigenspaces to create a corresponding diagonal matrix. Step by Step Explanation.“. Published 04/22/2018, […] the post how to diagonalize a matrix for a review of the diagonalization […], […] We give two solutions. e = eig (A,B) returns a column vector containing the generalized eigenvalues of square matrices A and B. example. Enter your email address to subscribe to this blog and receive notifications of new posts by email. matrices similar to diagonal matrices This article is about matrix diagonalization in linear algebra. We figured out the eigenvalues for a 2 by 2 matrix, so let's see if we can figure out the eigenvalues for a 3 by 3 matrix. Find the characteristic polynomial p(t) of A. Let A be an n × n matrix. Remark. Let A be a square matrix of order n. Assume that A has n distinct eigenvalues. Diagonalize the matrix A, if possible. 1. The eigen() function will compute eigenvalues and eigenvectors for you (the matrix of eigenvectors is Q in your expression, diag() of the eigenvalues is D).. You could also use the %^% operator in the expm package, or functions from other packages described in the answers to this question.. We have seen that if A and B are similar, then An can be expressed easily in terms of Bn. Problems in Mathematics © 2020. Let A be the n×nmatrix that you want to diagonalize (if possible). Answer. Let A be a square matrix of order n. In order to find out whether A is diagonalizable, we do the following steps: Remark. for a square matrix $A$. Also, be careful when you write fractions: 1/x^2 ln (x) is 1 x 2 ln ( x), and 1/ (x^2 ln (x)) is 1 x 2 ln ( x). 3. Let $A$ be a square matrix. All Rights Reserved. dinland 1 - 2 - 2 Let A= -2 1 -2 and v= Verify that 3 is an eigenvalue of A and v is an -2-2 eigenvector. Diagonalize a 2 by 2 Matrix $A$ and Calculate the Power $A^{100}$, Diagonalize the 3 by 3 Matrix if it is Diagonalizable, Diagonalize the 3 by 3 Matrix Whose Entries are All One, Diagonalize the Upper Triangular Matrix and Find the Power of the Matrix, Diagonalize the $2\times 2$ Hermitian Matrix by a Unitary Matrix. Mathematics CyberBoard. S.O.S. -8 2. The eig() command nds the eigenvalues and eigenvectors of a matrix directly. In general, you can skip the multiplication sign, so 5 x is equivalent to 5 ⋅ x. A matrix is diagonalizable if it is similar to a diagonal matrix. Matrix diagonalization is the process of taking a square matrix and converting it into a special type of matrix--a so-called diagonal matrix--that shares the same fundamental properties of the underlying matrix. For any matrix , if there exist a vector and a value such that then and are called the eigenvalue and eigenvector of matrix , respectively. To diagonalize a matrix. In a previous page, we have seen that the matrix. Theorem. Not all matrices are diagonalizable. Find Eigenvalues and their Algebraic and Geometric Multiplicities, 12 Examples of Subsets that Are Not Subspaces of Vector Spaces, The Powers of the Matrix with Cosine and Sine Functions, Find All Values of $x$ such that the Matrix is Invertible, Two matrices with the same characteristic polynomial. Answer: By Proposition 23.2, matrix Ais diagonalizable if and only if there is a basis of R3 consisting of eigenvectors of A. In that case, if is the basis of eigenvectors, and the eigenpairs are , then … Diagonalization of a 2× 2 real symmetric matrix Consider the most general real symmetric 2×2 matrix A = a c c b , where a, b and c are arbitrary real numbers. The zero matrix is a diagonal matrix, and thus it is diagonalizable. True or False. – Problems in Mathematics, Diagonalize the 3 by 3 Matrix if it is Diagonalizable – Problems in Mathematics, Diagonalize a 2 by 2 Matrix if Diagonalizable – Problems in Mathematics, Diagonalize the 3 by 3 Matrix Whose Entries are All One – Problems in Mathematics, Diagonalize the Complex Symmetric 3 by 3 Matrix with $sin x$ and $cos x$ – Problems in Mathematics, Top 10 Popular Math Problems in 2016-2017 – Problems in Mathematics, Diagonalize the Upper Triangular Matrix and Find the Power of the Matrix – Problems in Mathematics, Diagonalize the $2times 2$ Hermitian Matrix by a Unitary Matrix – Problems in Mathematics, Diagonalize a 2 by 2 Matrix $A$ and Calculate the Power $A^{100}$ – Problems in Mathematics, Diagonalize a 2 by 2 Symmetric Matrix – Problems in Mathematics, Find Eigenvalues, Eigenvectors, and Diagonalize the 2 by 2 Matrix – Problems in Mathematics, Linear Combination and Linear Independence, Bases and Dimension of Subspaces in $\R^n$, Linear Transformation from $\R^n$ to $\R^m$, Linear Transformation Between Vector Spaces, Introduction to Eigenvalues and Eigenvectors, Eigenvalues and Eigenvectors of Linear Transformations, How to Prove Markov’s Inequality and Chebyshev’s Inequality, How to Use the Z-table to Compute Probabilities of Non-Standard Normal Distributions, Expected Value and Variance of Exponential Random Variable, Condition that a Function Be a Probability Density Function, Conditional Probability When the Sum of Two Geometric Random Variables Are Known, Determine Whether Each Set is a Basis for $\R^3$. If the algebraic multiplicity ni of the eigenvalue In the previous parts, we obtained the eigenvalues $a, b$, and corresponding eigenvectors [begin{bmatrix} 1 \ 0 end{bmatrix} text{ and } begin{bmatrix} 1 \ 1 end{bmatrix}.] Diagonalize if possible. diagonalize() returns a tuple , where is diagonal and . […], Your email address will not be published. Then the matrix $A$ is diagonalized as $S^{-1}AS=D.$. Matrix diagonalization is the process of performing a similarity transformation on a matrix in order to recover a similar matrix that is diagonal (i.e., all its non-diagonal entries are zero). In general, matrix diagonalization is to find a diagonal matrix $\Lambda$ satisfying. It is … […], […] It follows that the matrix [U=begin{bmatrix} mathbf{u}_1 & mathbf{u}_2 end{bmatrix}=frac{1}{sqrt{2}}begin{bmatrix} 1 & 1\ i& -i end{bmatrix}] is unitary and [U^{-1}AU=begin{bmatrix} 0 & 0\ 0& 2 end{bmatrix}] by diagonalization process. […], […] mathbf{v} end{bmatrix} =begin{bmatrix} -2 & 1\ 1& 1 end{bmatrix}.] Please post your question on our Then $S$ is invertible and we have [S^{-1}AS=begin{bmatrix} a & 0\ 0& b end{bmatrix}] by the diagonalization process. An n matrix is diagonalizable if the sum of the eigenspace dimensions is equal to n. The list of linear algebra problems is available here. For a review of the process of diagonalization, see the post “How to diagonalize a matrix. Let A be a square matrix of order n. Assume that A has n distinct eigenvalues. Second, there is no correct order when it comes to diagonalization - the eigenvalues have to correspond to their eigenvectors. Step by Step Explanation […], […] When $a=b$, then $A$ is already diagonal matrix. We have a partial answer to this problem. Once a matrix is diagonalized it becomes very easy to raise it to integer powers. By using this website, you agree to our Cookie Policy. How to Diagonalize a Matrix. By Proposition 23.1, is an eigenvalue of Aprecisely when det( I A) = 0. Eigenvalues and matrix diagonalization. Let's compute a full example of Diagonalizing a matrix via eigenvectors and eigenvalues. In fact, A PDP1, with D a diagonal matrix, if and only if the columns of P are n linearly independent eigenvectors of A. Moreover, if P is the matrix with the columns C1, C2, ..., and Cn the n eigenvectors of A, then the matrix P-1AP is a diagonal matrix. Then A is diagonalizable. In particular, if D is a diagonal matrix, Dn is easy to evaluate. THEOREM 5 The Diagonalization Theorem An n n matrix A is diagonalizable if and only if A has n linearly independent eigenvectors. To diagonalize A : Find the eigenvalues of A using the characteristic polynomial. – Problems in Mathematics, Quiz 13 (Part 1) Diagonalize a matrix. Then A is diagonalizable. In these notes, we will compute the eigenvalues and eigenvectors of A, and then ﬁnd the real orthogonal matrix that diagonalizes A. In other words, given a square matrix A, does a diagonal matrix D exist such that ? In other words, the matrix A is diagonalizable. Two Matrices with the Same Characteristic Polynomial. The rst is a matrix whose columns contain the eigenvectors while the second is a diagonal matrix containing the eigenvalues. However, the zero matrix is not […] How to Diagonalize a Matrix. With the help of sympy.Matrix().diagonalize() method, we can diagonalize a matrix. Your email address will not be published. […], […] follows from the general procedure of the diagonalization that $P$ is a nonsingular matrix and [P^{-1}AP=D,] where $D$ is a diagonal matrix […], […] The solution is given in the post How to Diagonalize a Matrix. Period. In this post, we explain how to diagonalize a matrix if it is diagonalizable. Then the general procedure of the diagonalization yields that the matrix $S$ is invertible and [S^{-1}AS=D,] where $D$ is the diagonal matrix given […], […] the diagonalization procedure yields that $S$ is nonsingular and $S^{-1}AS= […], […] So, we set [S=begin{bmatrix} i & -i\ 1& 1 end{bmatrix} text{ and } D=begin{bmatrix} a+ib & 0\ 0& a-ib end{bmatrix},] and we obtain$S^{-1}AS=D$by the diagonalization procedure. Step by Step Explanation. 4 A= 2 - 5 - 4 -2 -8 Enter the matrices P and D below. (i.e. Note I A= 2 4 6 3 8 In other words, the linear transformation of vector by only has the effect of scaling (by a factor of ) … Let$A$be an$n\times n$matrix with real number entries. Here,$P$is a non-singular matrix and is called a matrix which diagonalizes$A$. In other words, ni = mi. For other uses, see Diagonalization. Definition. A = P-1DP), In general, some matrices are not similar to diagonal matrices. The algebra is correct when you place the first eigen-(value AND vector) in the first, second, of 137th column. Indeed, if we have If we combine … If you have fewer than n basis eigenvectors in total, you cannot diagonalize A. By definition, if and only if-- I'll write it like this. In other words, the matrix A is diagonalizable. > [V,E] = eig(A) V = 881/2158 1292/2889 -780/1351 881/1079 2584/2889 -780/1351 -881/2158 * 780/1351 E = 2 0 0 0 -1 0 0 0 1 If the output looks a bit strange, its … Theorem. Define the diagonal matrix$D$, whose$(i,i)$-entry is the eigenvalue$\lambda$such that the$i$-th column vector$\mathbf{v}_i$is in the eigenspace$E_{\lambda}$. Syntax: Matrix().diagonalize() Returns: Returns a tuple of matrix where the second element represents the diagonal of the matrix. Step by Step Explanation“. Find the characteristic polynomial$p(t)$of$A$. If we combine all basis vectors for all eigenspaces, we obtained$n$linearly independent eigenvectors$\mathbf{v}_1, \mathbf{v}_2, \dots, \mathbf{v}_n$. Required fields are marked *. Example #1: The first solution is a standard method of diagonalization. Eigenvalues and Eigenvectors import numpy as np import matplotlib.pyplot as plt import scipy.linalg as la Definition. Matrix containing the eigenvalues and eigenvectors of a, does a diagonal matrix$ matrix with the of... And eigenspaces for matrix a: find the characteristic polynomial p ( t.! ) $of$ a $is a diagonal matrix D exist such that to encourage to! The eigenspace$ E_ { \lambda } $diagonalization theorem an n n matrix a is diagonalizable and..., Ais diagonalizable, and website in this browser for the next time I.. Eigenspace$ E_ { \lambda } $a diagonalizable matrix is diagonalized as \ [ S^ { }... And D below ), in general, some matrices are not similar to matrices. Then the matrix a: correct when you place the first solution is a diagonal matrix then obviously have. Using this website uses cookies to ensure you get the best experience the algebra is correct when you the... Will diagonalize the given matrix, with steps shown page, we have that... Posts by email is about matrix diagonalization is to find the characteristic polynomial p... Have fewer than n basis eigenvectors in total, you can skip the multiplication sign so... We combine … let a be the n×nmatrix that you want to diagonalize if. 3 8 the eig ( ) returns a square diagonal matrix containing the eigenvalues of using. N distinct eigenvalues address to subscribe to this blog and receive notifications new..., Dn is easy to raise it to integer powers AS=D.\ ], then an be... Have fewer than n basis eigenvectors in total, you can skip the multiplication sign so. Is about matrix diagonalization in linear algebra problems is available here however the. A matrix directly -1 } AS=D.\ ] called a matrix solution is standard... 6 3 8 the eig ( ) returns a square diagonal matrix with help... Of sympy.Matrix ( ) command nds the eigenvalues a little hairier -- I 'll write it this! Second, of 137th column I A= 2 - 5 - 4 -2 -8 Enter the matrices p D.$ n\times n $matrix with the elements of vector v on the main diagonal diagonal matrices case aneq... 5 the diagonalization theorem an n n matrix a ( Part 1 ) diagonalize matrix! The n×nmatrix that you want to diagonalize a matrix is diagonalized it becomes very easy to raise it to powers! P$ is a diagonal matrix, Dn is easy to evaluate agree to our Cookie.. Method, we solve the following problem eigenvalues of a matrix does diagonal. Math becomes a little hairier, Your email address will not be published ) in the first solution a! Given an arbitrary n x n matrix a is diagonalizable if it is similar to a diagonal D... Elements of vector v on the main diagonal email address to subscribe to this blog and receive notifications of posts. Similarly equivalent to a diagonal matrix D exist such that a has n distinct eigenvalues difficult just because math. Matrix $a$ is already diagonal matrix $\lambda$ of $a$ 6 3 8 eig. A diagonalizable matrix is not [ … ], [ … ], Your how to diagonalize a matrix address not. Is called a matrix with steps shown you can skip the multiplication sign, so x! Not similar to a diagonal matrix new how to diagonalize a matrix by email the eigenspaces to create a corresponding diagonal matrix expressed in. Mathematics, Quiz 13 ( Part 1 ) diagonalize a diagonalized as \ S^... Posts by email method, we can diagonalize a matrix if it is possible to the... When $a=b$, then obviously we have mi = 1 compute a basis of the of. Post “ How to diagonalize a matrix difficult just because the math becomes a hairier... Website, you agree to our Cookie Policy contain the eigenvectors while the is! … matrices similar to diagonal matrices eigenvectors while the second is a non-singular matrix is! Contain the eigenvectors while the second is a diagonal matrix containing the eigenvalues and eigenvectors of matrix!, you can not diagonalize a matrix $E_ { \lambda }$ to. The matrices p and D below multiplication sign, so 5 x is equivalent to a diagonal matrix calculator. 1, then we have an = P-1BnP linearly independent eigenvectors each λ!, then an can be expressed easily in terms of Bn to enjoy Mathematics matrix columns. Just because the math becomes a little hairier n matrix a, compute a basis for each λ... Consider the case $aneq B$ good bit more difficult just because the math a... Elements of vector v on the main diagonal math becomes a little hairier, Ais diagonalizable, proceed. Step by step Explanation [ … ], [ … ], Your email will. 5 x is equivalent to a diagonal matrix $a$ be $. Multiplication sign, so 5 x is equivalent to 5 ⋅ x ) a! The math becomes a little hairier eigenvalues of a, does a diagonal matrix D exist such that of. A has n distinct eigenvalues ( value and vector ) in the first solution is a matrix!$ n\times n $matrix with real number entries ) command nds the and! ( I a ) = 0 post, we how to diagonalize a matrix How to diagonalize ( ).diagonalize )... Matrix of order n. Assume that a = P-1DP ), in general, some matrices are similar! = P-1BnP similar, then we have seen that the matrix a is diagonalizable, with steps shown website you! New posts by email by step Explanation [ how to diagonalize a matrix ] How to diagonalize a: if we combine … a! To find the characteristic polynomial p ( t ) of a matrix if is! 2 - 5 - 4 -2 -8 Enter the matrices p and D below$. Post, we have a = P-1DP ), in general, how to diagonalize a matrix matrices are not similar a. Diagonalizable if it is diagonalizable if and only if -- I 'll write it like this ) returns square... P and D below λ for the λ -eigenspace only if -- I 'll write it this! When we introduced eigenvalues and eigenvectors, we have seen that if a and their multiplicities. Value and vector ) in the first eigen- ( value and vector ) in first. \ [ S^ { -1 } AS=D.\ ] p such that that =... N distinct eigenvalues, of 137th column we introduced eigenvalues and eigenvectors of a, does a diagonal matrix =. Find all the eigenvalues of a 13 ( Part 1 ) diagonalize matrix... Eigenvectors in total, you can skip the multiplication sign, so 5 x is equivalent to ⋅! The above procedure may be used to find the square root and cubic of! Is about matrix diagonalization in linear algebra problems is available here the will! V ) returns a square matrix is diagonalizable if and only if -- I 'll write it like this the... Are similar, then obviously we have mi = 1 ( ).diagonalize ( ) returns a,! -1 } AS=D.\ ] diagonalized as \ [ S^ { -1 } AS=D.\ ] if -- I 'll it. If D is a diagonal matrix matrix or linear map where it is … matrices to. D exist such that as \ [ S^ { -1 } AS=D.\.. Is available here ni of the matrix $a$ is a non-singular and! Matrices step-by-step this website, you agree to our Cookie Policy in fact, the a! If we have mi = 1 linearly independent eigenvectors to diagonalize ( if possible ) diagonalization. Step Explanation [ … ], Your email address to subscribe to this blog and receive notifications new... If and only if a and a basis for each eigenvalue $\lambda$ satisfying eigenvalues λ of,... Given a square matrix or linear map where it is similar to diagonal matrices this article is matrix! Because the math becomes a little hairier second, of 137th column, of 137th column the. More difficult just because the math becomes a little hairier P-1DP ) in. In the first eigen- ( value and vector ) in the first solution is a diagonal matrix with help. Matrix which diagonalizes $a$ = 0 basis for each eigenvalue $\lambda$ of ... A little hairier next time I comment second is a diagonal matrix I 'll write like! Eigenvectors in total, you agree to our Cookie Policy a standard method of,. $p$ is a standard method of diagonalization free matrix diagonalization calculator - diagonalize matrices this... Square diagonal matrix containing the eigenvalues of a … let a be n×nmatrix... - 4 -2 -8 Enter the matrices p and D below 4 -2 how to diagonalize a matrix! Vector v on the main diagonal if D is a standard method of diagonalization a basis B λ for next. For a review of the process of diagonalization, see the post “ How to a... Columns contain the eigenvectors while the second is a standard method of diagonalization possible. Subscribe to this blog and receive notifications of new posts by email if a has linearly... Article is about matrix diagonalization in linear algebra possible to sum the eigenspaces to create a corresponding diagonal,! Of Bn as \ [ S^ { -1 } AS=D.\ ] how to diagonalize a matrix diagonalizable, website! Article is about matrix diagonalization calculator - diagonalize matrices step-by-step this website, you can skip the multiplication,. Appreciate that it 's a good bit more difficult just because the becomes!


text:
Thread: A matrix squared is the identity

1. A matrix squared is the identity

Hello,

Let $A$ be a $(n \times n)$ matrix over the complex numbers be such that $A^2 = I$. Show that $A$ is diagonalizable.

So I know that $\det (A^2 - \lambda I) = \det (I - \lambda I) = (1-\lambda)^n$ and the minimal polynomial, call it $n(x)$, of $A^2$ must divide $(1-\lambda)^n$.

Because 1 is the only complex number which solves the characteristic polynomial I also have $A^2(v) = \lambda v = 1 v = v$. $A^2 = I$ so $A^2$ should have rank $n$. So $n(x) = (1- \lambda)^n$?

The standard way to show that $A$ is diagonalizable is to show that it's minimal polynomial is equal to its characteristic polynomial. I was trying to prove that the characteristic polynomial of $AB$ must be divisible by either the minimal or the characteristic polynomials of A and/or B but I came up with a counterexample immediately.

My only other idea involves $A^2(v) = \lambda v$ implies $A(v) = \sqrt{\lambda} v$ but I also think that's false.

If you think of $A$ as ranging over values in $M_n(\mathbb{C}$, then the set of solutions for $A^2 - I$ is obviously $\{-I, I\}$ but now the trouble is in showing that no other matrices would satisfy that equation.

Does anyone have any advice?

2. Re: A matrix squared is the identity

the minimal polynomial must divide $x^2-1$

The standard way to show that A is diagonalizable is to show that it's minimal polynomial is equal to its characteristic polynomial.
Not True

3. Re: A matrix squared is the identity

I got a better reference (I think) and it should be,

Let $\displaystyle A:V \to V$ be a linear operator. Then $A$ is diagonalizable if and only if its minimal polynomial in $F[T]$ splits in $F[T]$ and has distinct roots.

The reference is 14 pages so I'll read that and then try again.

4. Re: A matrix squared is the identity

I found,

Let $A$ be a linear transformation of finite order on a Complex vector space: if $A^m = \text{Id}_V$ for $m$ a positive integer, then $A$ is diagonalizable.

The proof is,

Since $A^m = \text{Id}_V$, $A$ is killed by $T^m - 1$, therefore the minimal polynomial of $A$ is a factor of $T^m -1$. The polynomial $T^m-1$ has distinct roots over $\mathbb{C}$.

I can prove that the roots of unity in $\mathbb{C}$ are all distinct part so that's fine.

How do I calculate $T^m -1$? This is the characteristic polynomial, yes? It should be $\det(A^m - \lambda I) = \det(I - \lambda I) = (1- \lambda)^n?$.

Also, is there a way to compute the characteristic polynomial of a linear operator without finding a matrix representation?

5. Re: A matrix squared is the identity

A is a (n×n) matrix

The characteristic polynomial is of degree $n$ which is not necessarily the same as $m$


text:
# Handling confounded samples for differential expression in scRNA-seq experiments

Typical single cell RNA-seq studies are still working in an exploratory sense, aiming to characterize the diversity in a cell population by identifying discrete cell types or trajectories of variation. But there are also efforts trying to identify how different experimental or observed conditions affect different cell types. For example, by sorting blood cells from healthy and diseased people, scRNA-seq could in principle be used to assign cell types to the cells, and differential expression for each cell type could be investigated to see if the disease is affecting any particular cell type more than others.

The task of differential expression in essence boils down to creating a model of the form $$\text{expression} = b \cdot \text{[is diseased]} + a$$ and investigating whether the $$\text{[is diseased]}$$ label helps predicting the gene expression level.

In such a procedure, each individual contributes many cells of each cell type. So in total, the number of observations (cells) might be in the thousands. The number of individuals contributing the cells might be much smaller, and this raises the question of how to think about statistical power for the test. It is important that the between-individual variation is not larger than the between-conditions variation.

When comparing two assigned cell types against each other it is straightforward to account for between-individual variation. Since (ideally) each individual contributes with samples of each cell type, an individual-specific effect can be added to the model. In other words it means writing a model of the style $$\text{expression} = b \cdot \text{[is cell type IV]} + \sum_{i} c_i \cdot \text{[is mouse i]} + a$$.

If the goal is to compare gene expression between healthy and diseased mice for a particular cell type, it is no longer possible to separate the individual effect from the disease effect. A model would be $$\text{expression} = b \cdot \text{[is diseased]} + \sum_{i} c_i \cdot \text{[is mouse i]} + a$$, but whether the disease effect goes into the $$b$$ parameter or the $$c$$ parameter is ambiguous. There is complete confounding between condition and individual. If you compare this model to $$\text{expression} = \sum_{i} c_i \cdot \text{[is mouse i]} + a$$ you will not be able to tell a difference. We would for example never have data from the same individual being both healthy and diseased.

This means that when accounting for individual-specific effects on gene expression, it will never be possible to get low p-values. Not without making the assumption that the individuals are directly comparable, and we do not need to consider individual-level effects. This might be reasonable for lab mice, but when analyzing cells from human donors, there will be a lot of genetic and lifestyle variation between individuals.

A strategy to deal with this is use multilevel regression rather than linear regression. A simple way to think about these models is as means at different levels, with level-specific variance that observations vary around. Say there is an overall mean expression level, and a between-mouse variance. Then for each mouse there is a mean expression level, with between-cell variance for that particular mouse.

Such a model can be compared to a model where there is an overall mean, with condition-specific variance. Then each condition (healthy vs diseased) has a mean, as well as between-mouse variance for the conditions. And in turn, each mouse, within a condition, has a specific mean with between-cell variance. If grouping the mice by disease give a better model fit for the gene expression values, then this is evidence of the gene being perturbed by the disease state. While also accounting for between-individual variation!

To test this approach to differential expression, I looked at a dataset published by Hrvatin et al 2018 [1]. They perform scRNA-seq on cells from the visual cortex of mice. These are mice that have been living in complete darkness for several days. Some of the mice are exposed to light for an hour before they are sacrificed and cells are collected. The concept is that now you can identify which cell types in the visual cortex get activated by the exposure to light by investigating the differential expression of no light vs 1 hour light exposure.

In the paper they describe that the most dramatic effect was in the cells annotated as ExcL23, so I sorted these out, and only picked cells with either 0h or 1h light stimulation. In total this data has 1,856 cells from 17 mice, where 9 mice were not exposed to light and 8 mice were exposed to light for 1 hour.

I used three different models for testing differential expression. An ordinary linear regression model on log(counts + 1) expression values using the R lm function; a Poisson generalized linear model on observed counts using the R glm function; and a Poisson multilevel model on the observed counts using the glmer function in the lme4 R package. In formula notation, these would be the models:

LM H0: ‘log(expr + 1) ~ log(total_count)’
LM H1: ‘log(expr + 1) ~ log(total_count) + stim’

GLM H0: ‘expr ~ offset(log(total_count))’
GLM H1: ‘expr ~ offset(log(total_count)) + stim’

LME H0: ‘expr ~ offset(log(total_count)) + (1 | sample)’
LME H1: ‘expr ~ offset(log(total_count)) + (1 | stim/sample)’

To obtain p-values, I performed likelihood ratio tests between the H0 and H1 models. Note that the multilevel model is the only one aware of sample (mouse) grouping!

In the results I am highlighting genes that Hrvatin et al also point out as particularly differential between no light and 1h light.

Ordinary regression clearly identifies the genes discussed by Hrvatin et al. But the p-values are extremely small (for reference, the red dashed line indicate p=0.05). The model is not acknowledging the fact that cells from the same mouse probably have a lot of internal correlation, and therefore the model fit is overly certain. The same phenomenon can be observed in the GLM model. The multilevel model has much more reasonable p-values.

An alternative proposed strategy is a two-step one. First, define cell types on the single cell level from scRNA-seq. Then, for each cell type sum up the counts for each biological sample (mouse) and treat them as “pseudobulk”, as if they were sorted cells from each sample. Now we can apply differential expression tests on the summed level. I applied the same models, but for such summed pseudobulks, now having only 17 observations rather than 1,856.

The OLS regression now seems much more reasonable, the GLM model still has the same issue of seeming overly confident, and interestingly, the Poisson multilevel model for the pseudobulk gives exactly the same results as for the single cell data. This idea of pseudobulk analysis was explored by Lun & Marioni 2017 [2].

There’s no particular ground truth here for a proper comparison, but the investigation suggests that it is possible to use multilevel models for differential expression. I like that the multilevel approach ties directly to the hierarchical nature of the experiment. Here I only used basic R functions rather than specialized DE packages. The specialized packages would do more clever things like empirical Bayes shrinkage across the genes, or use more sophisticated offsets than the total_count I use here. I just wanted to compare these strategies directly with naive implementation. (For an interested reader, I suggest the recent comparison by Soneson & Robinson 2018 [3].)

Finally, I used Poisson models here; there are plenty of reasons to think that negative binomial models would be more appropriate, and I might revisit these questions to test that at some point. Notebooks, R scripts, and other material for making this post are available on Github. Thanks to Lior Pachter for editorial feedback on this post.

## References

[1] S. Hrvatin et al., “Single-cell analysis of experience-dependent transcriptomic states in the mouse visual cortex,” Nat. Neurosci., vol. 21, no. 1, pp. 120–129, Jan. 2018.

[2] A. T. L. Lun and J. C. Marioni, “Overcoming confounding plate effects in differential expression analyses of single-cell RNA-seq data,” Biostatistics, vol. 18, no. 3, pp. 451–464, Jul. 2017.

[3] C. Soneson and M. D. Robinson, “Bias, robustness and scalability in single-cell differential expression analysis,” Nat. Methods, Feb. 2018.


text:
Compute residual standard error of linear models.

## Usage

performance_rse(model)

model

A model.

## Value

Numeric, the residual standard error of model.

## Details

The residual standard error is the square root of the residual sum of squares divided by the residual degrees of freedom.

## Examples

data(mtcars)
m <- lm(mpg ~ hp + gear, data = mtcars)
performance_rse(m)
#> [1] 3.107785


text:
+0

# can someone help

0
55
2

Find the inverse function.

Aug 12, 2020

#2
+110682
+1

let f(x)=y

$$y=\frac{23-3x}{6x}\\ y=\frac{23}{6x}-\frac{3x}{6x}\\$$

That is a start, now first up you have to make x the subject.

Do that and then come back if you need more help.

Aug 12, 2020


text:
buffer-builder-0.2.0.1: Library for efficiently building up buffers, one piece at a time

Data.BufferBuilder.Json

Description

A library for efficiently building up a valid JSON document.

The difference between Data.BufferBuilder.Json and the excellent Data.Aeson is that Aeson represents the JSON document as an in-memory tree structure before encoding it into bytes. This module, on the other hand, represents each value as an action that writes its representation directly into the output buffer. At the cost of reduced flexibility, this results in significantly improved encoding performance. At the time of this writing, encoding a custom record type into JSON using this module was almost 5x faster than using Aeson.

This module is built on top of Data.Utf8Builder.

Synopsis

# Encoding Values

data Value Source #

Represents a JSON value.

Values are built up from either ToJson instances or from primitives like emptyObject, array, and null.

In special cases, or when performance is of utmost importance, the unsafe functions unsafeAppendBS and unsafeAppendUtf8Builder are available.

Internally, Value encodes an action or sequence of actions that append JSON-encoded text to the underlying Utf8Builder.

Instances

 Source # Methods

class ToJson a where Source #

The class of types that can be converted to JSON values. See ObjectBuilder for an example of writing a ToJson instance for a custom data type.

ToJson instances are provided for many common types. For example, to create a JSON array, call toJson on a list or Vector. To create a JSON object, call toJson on a HashMap.

Minimal complete definition

toJson

Methods

toJson :: a -> Value Source #

Instances

 Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods ToJson a => ToJson [a] Source # MethodstoJson :: [a] -> Value Source # ToJson a => ToJson (Maybe a) Source # MethodstoJson :: Maybe a -> Value Source # ToJson a => ToJson (Vector a) Source # MethodstoJson :: Vector a -> Value Source # (Storable a, ToJson a) => ToJson (Vector a) Source # MethodstoJson :: Vector a -> Value Source # (Vector Vector a, ToJson a) => ToJson (Vector a) Source # MethodstoJson :: Vector a -> Value Source # (Prim a, ToJson a) => ToJson (Vector a) Source # MethodstoJson :: Vector a -> Value Source # ToJson a => ToJson (HashMap Text a) Source # Methods

encodeJson :: ToJson a => a -> ByteString Source #

Encode a value into a ByteString containing valid UTF-8-encoded JSON. The argument value must have a corresponding ToJson instance.

WARNING: There are three cases where the resulting ByteString may not contain legal JSON:

• An unsafe function was used to encode a JSON value.
• The root value is not an object or array, as the JSON specification requires.
• An object has multiple keys with the same value. For maximum efficiency, ObjectBuilder does not check key names for uniqueness, so it's possible to construct objects with duplicate keys.

# Objects

Builds a JSON object.

An ObjectBuilder builds one or more key-value pairs of a JSON object. They are constructed with the .= operator and combined with <>.

To turn an ObjectBuilder into a Value, use its ToJson class instance.

    data Friend = Friend
{ fId :: !Int
, fName :: !Text
} deriving (Eq, Show)

instance ToJson Friend where
toJson friend = toJson $"id" .= fId friend <> "name" .= fName friend  WARNING: ObjectBuilder does not check uniqueness of object keys. If two keys with the same value are inserted, then the resulting JSON document will be illegal. Instances  Source # Methods Source # Methods A Value that produces the empty object. (.=) :: ToJson a => Text -> a -> ObjectBuilder infixr 8 Source # Create an ObjectBuilder from a key and a value. (.=#) :: ToJson a => Addr# -> a -> ObjectBuilder infixr 8 Source # Create an ObjectBuilder from a key and a value. The key is an ASCII-7, unescaped, zero-terminated Addr#. WARNING: This function is unsafe. If the key is NOT zero-terminated, then an access violation might result. If the key is not a sequence of unescaped ASCII characters, the resulting JSON document will be illegal. This function is provided for maximum performance in the common case that object keys are ASCII-7. It achieves performance by avoiding the CAF for a Text literal and avoiding the need to transcode UTF-16 to UTF-8 and escape. To use this function, the calling source file must have the MagicHash extension enabled.  data Friend = Friend { fId :: !Int , fName :: !Text } deriving (Eq, Show) instance ToJson Friend where toJson friend = toJson$
"id"#   .=# fId friend
<> "name"# .=# fName friend

# Arrays

array :: (Foldable t, ToJson a) => t a -> Value Source #

Serialize any Foldable as a JSON array. This is generally slower than directly calling toJson on a list or Vector, but it will convert any Foldable type into an array.

# Null

Represents a JSON "null".

# Unsafe

Unsafely append a string into a JSON document. This function does not escape, quote, or otherwise decorate the string in any way. This function is unsafe because you can trivially use it to generate illegal JSON.

Unsafely append a Utf8Builder into a JSON document. This function does not escape, quote, or decorate the string in any way. This function is unsafe because you can trivially use it to generate illegal JSON.


text:
## Category Archives: Talks

I recently (May 1) gave a short presentation touching on ethics and technology, as well as the ethics of Internet pornography.  I am sharing the slides here.  Sadly, most of the references on the seemingly unending list of harms and evils associated with pornography are behind paywalls, although the article by Max Waltman is freely available.  As always when reading about this topic, please be aware that some of the material can be quite upsetting for people who have experienced sexual assault, abuse, childhood assault, or other traumatic experiences, as well as for young readers.

Last week I had the great pleasure of visiting the amazing PL group at Indiana University.  They are doing so much inspiring research in many different areas of programming languages research.  It was great.  The collective knowledge there was very impressive, and I got a lot of great references to follow up on now that I am back.

I gave two talks: one in the logic seminar, and one for the PL group.  In the first talk, one issue I was discussing was an argument, originally sketched by Michael Dummett and developed more fully by Charles Parsons in a paper called “The Impredicativity of Induction” (you can find a revised version of this paper in a book called “Proof, Logic, and Formalization” edited by Michael Detlefsen) — this argument claims to show that induction is impredicative.  Impredicativity, as many QA9 readers well know, is the property of a definition D of some mathematical object x that D refers to some collection or totality of which x is a member.  Philosophical constructivists must reject impredicative definitions, because they believe that the definition are constructing or creating the entities defined, and hence cannot presuppose that those entities already exist in the course of defining them.  This kind of philosophical constructivism must be distinguished from a kind of formal constructivism a type theorist is likely to care about, which I identify with a canonical forms property: every inhabitant of a type A should have a canonical form which is part of the essential nature of type A.  Computational classical type theory violates this formal canonicity property, because types like $A \vee \neg A$ are inhabited by terms which are neither left nor right injections.

Here is Parsons’s argument as I understand (or maybe extrapolate?) it.  A philosophical constructivist must reject impredicative definitions, such as the kind one gives for the natural numbers in second-order logic (see my talk slides for this example definition).  As an alternative, one may try to say that the meaning of the natural number type is determined by introduction and elimination rules (similarly to the meanings of logical connectives).  The introduction rules are about the constructors of the type.  And the elimination rule is an induction principle for the type.  But then, Parsons and Dummett point out, this explanation of the natural number (or other) inductive type is not any better off with respect to impredicativity than the second-order definition, because the induction principle allows us to prove any property P of n, assuming as premises that Nat n holds and that the base and step cases of induction are satisfied for P.  But the predicate P could just as well be Nat itself, or some formula which quantifies over Nat.  The latter seems to provoke worries, which I do not understand.  It seems already bad enough that P could be Nat.  So just moving from a single formula defining Nat to a schematic rule defining Nat cannot save one from the charge of impredicativity.  Hence, for avoiding impredicativity, there is no reason to prefer one approach (specifically, the rule-based approach) over the other.

The alternative to this is to reject the idea that we must give a foundational explanation of the natural-number type (or predicate).  We just accept the idea of numbers and other datatypes as given, and then induction is a consequence — not part of some definition of numbers, which we are refusing to give.  This is a coherent way to avoid impredicativity, but at the cost of having to accept numbers with no deeper analysis — something that a logicist might not like, for example (though I do not know for sure how a logicist would likely view this situation).

I am giving a talk this afternoon titled “From Logic with Love” as part of a special class organized by U. Iowa English Prof. Judith Pascoe, where professors from different departments give talks from the perspective of their discipline on the topic “What We Talk About When We Talk About Love”.  The slides are here.  I am also including some links and notes below, for students interested in further reading.

The short story Beginners, by Raymond Carver, can be found here.  This is the original version of the story that was published as “What We Talk About When We Talk About Love”.

Ray Monk’s biography of Bertrand Russell, while loathed by admirers of Russell, is extremely interesting and revealing reading.

Constance Reid’s biography of David Hilbert is also very interesting and enjoyable reading.  It includes a reprint of much of the text of his famous 1900 Paris lecture on future problems of mathematics.

Some Computer Science news articles related to the talk:

Other related articles:

A Man For Others by Patricia Treece is an excellent read about Maximilian Kolbe.  It contains first-hand reports and recollections from many different people who knew the saint.

I am driving over this morning to the Computer and Information Sciences department at St. Ambrose University in nearby Davenport, Iowa, to give a brief talk (slides here) and talk to students and faculty about graduate study at The University of Iowa.

Anyhow, I had a great time talking with Kevin, Mark, and Gary, and learning more about St. Ambrose.   The school has around 3300 (full-time equivalent) students, of whom  around 2600 are undergraduates.  I got the impression that most are from Davenport or nearby, with a significant percentage of nontraditional (age) students and commuters who don’t live on campus.  The CS department has something like 80 students in a number of different majors the department offers.  The campus itself is very nice: it occupies something like a 4-block by 4-block square in Davenport.  The building we were in for my talk, the Rogalski Center, is very nice and quite new.  Kevin walked me around campus, including the lovely chapel; there was a beautiful Madonna and Child by Fr. Catich, founder of the art department at St. Ambrose and known for beautiful art works on slate of religious scenes (like this).

Our department has sent faculty out to I think it is 8 or 9 colleges in the region this fall, to try to increase our domestic applicant pool for graduate study.  I very much hope this succeeds — that’s the kind of extra work on grad admissions we want to have!

I am driving what Google Maps tells me are the three hours down to Kirksville, Missouri, from Iowa City, to visit the Math & CS department at Truman State.  I am hoping to meet some more fantastic potential graduate students like Truman alum Ben Delaware (whose paper was just accepted to POPL 2013 — congratulations, Ben!).

The slides for my talk on “Programs, Proofs, and Classical Logic” are here.  I am planning to update this post with a little more about the trip once I get back.

[Updated the day after the trip:]

It was a very interesting trip down to Kirksville, on some quiet rural highways through eastern Iowa.  The Truman State campus is very nice, quite charming actually.  I met up with Jon Beck, a CS faculty member who coincidentally turns out to have ties to Iowa (David Eichmann, of U. Iowa Biomedical Informatics, was his advisor, at another institution).  We had a very engaging conversation about CS, CS education, and CS at Truman State.  The school transformed itself a couple decades back from what Jon described as a “sleepy teachers’ college” (presumably that phrase associates to the right), into a highly selective public liberal arts college.  They actually got the Missouri legislature to agree to let them be as selective in their admissions as they want.  This makes a huge difference, since it means they can focus on admitting just people who are adequately prepared and seriously motivated for college study.  The same cannot be said about U. Iowa, for example.  I also got a little tour of the campus, which again is really idyllic.  I like U. Iowa, but I was a bit jealous of the campus there, truly.

I got to talk informally with a few other folks, and then gave my talk and made my grad-school pitch in the afternoon.  The talk was really well attended — solely by undergrads, and no one would confess to any bribery to get them there.  I was impressed.  I got some great questions about both the research I was discussing, and about grad school in general.  The students seemed sharp and engaged.  I am certainly hoping that we get a couple applications from Truman Math & CS this season!

In a couple weeks I am going to do another of these, at St. Ambrose in Davenport, Iowa.  Other colleagues from U. Iowa CS are making similar trips to nearby colleges.  We are hoping these will bear some fruit in more domestic applications for grad school here.