text:
Volume 3, Issue 4
Multigrid and MGR[nu] Methods for Diffusion Equations
DOI:

J. Comp. Math., 3 (1985), pp. 373-384

Published online: 1985-03

Preview Full PDF 93 1689
Export citation

Cited by

• Abstract

The MGR[v] algorithm of Ries, Trottenberg and Winter with v=0 and the algorith 2.1 of Braess are essentially the same multigrid algorithm for the discrete posion equation. In this report we consider the extension to the general diffusion equation. In particular, we indicate the proof of the basic result $\ru \leq 1/2(1+Kh)$, thus extending the results of Braess and Ries...,In addition to this theoretical result we present computational results which indicate that other constant coefficient estimates carry over this case.

• Keywords

@Article{JCM-3-373, author = {Seymour V. Parter and David Kamowitz}, title = {Multigrid and MGR[nu] Methods for Diffusion Equations}, journal = {Journal of Computational Mathematics}, year = {1985}, volume = {3}, number = {4}, pages = {373--384}, abstract = { The MGR[v] algorithm of Ries, Trottenberg and Winter with v=0 and the algorith 2.1 of Braess are essentially the same multigrid algorithm for the discrete posion equation. In this report we consider the extension to the general diffusion equation. In particular, we indicate the proof of the basic result $\ru \leq 1/2(1+Kh)$, thus extending the results of Braess and Ries...,In addition to this theoretical result we present computational results which indicate that other constant coefficient estimates carry over this case. }, issn = {1991-7139}, doi = {https://doi.org/}, url = {http://global-sci.org/intro/article_detail/jcm/9633.html} }
TY - JOUR T1 - Multigrid and MGR[nu] Methods for Diffusion Equations AU - Seymour V. Parter & David Kamowitz JO - Journal of Computational Mathematics VL - 4 SP - 373 EP - 384 PY - 1985 DA - 1985/03 SN - 3 DO - http://doi.org/ UR - https://global-sci.org/intro/article_detail/jcm/9633.html KW - AB - The MGR[v] algorithm of Ries, Trottenberg and Winter with v=0 and the algorith 2.1 of Braess are essentially the same multigrid algorithm for the discrete posion equation. In this report we consider the extension to the general diffusion equation. In particular, we indicate the proof of the basic result $\ru \leq 1/2(1+Kh)$, thus extending the results of Braess and Ries...,In addition to this theoretical result we present computational results which indicate that other constant coefficient estimates carry over this case.


text:
# Find a formula for a function f that satisfies the following conditions. \lim_{x \rightarrow...

## Question:

Find a formula for a function f that satisfies the following conditions.

{eq}\lim_{x \rightarrow \pm\infty},f(x)=0\lim_{x \rightarrow 0 },f(x)=-\infty, \\ , \\ \lim_{x \rightarrow 9^{-}},f(x)=\infty , \lim_{x \rightarrow 9^{+}},f(x)=-\infty \\ f(6)=0.\\ f(x)= {/eq}

## Asymptote of a Function:

An asymptote of a function is a line such that its distance to the function approaches to zero as long as the line and the function goes to infinity or to an specific value. The asymptote could be classified as vertical, horizontal or oblique. Horizontal and oblique asymptotes appear when the independent variable goes to infinity and the function approaches to a number. Vertical asymptotes appear when the function goes to infinity while the independent variable approaches to a number.

• A function {eq}\, g(t)\, {/eq} will have a vertical asymptote at {eq}\, w= a\, {/eq} if {eq}\, \displaystyle \lim_{t \rightarrow a}g(t) = \infty {/eq}.
• A function {eq}\, g(t)\, {/eq} will have an horizontal asymptote at {eq}\, t= a\, {/eq} if {eq}\, \displaystyle \lim_{t \rightarrow +\infty}g(t) = a \,\text{ or }\, \displaystyle \lim_{t \rightarrow -\infty}g(t) = a {/eq}.

According to the given limits we know:

• {eq}\displaystyle \lim_{x \rightarrow \pm \infty}f(x) =0 \; \Rightarrow \; {/eq} the function has an horizontal asymptote in {eq}\, y =0 {/eq}.
• {eq}\displaystyle \lim_{x \rightarrow 0}f(x) =-\infty \; \Rightarrow \; {/eq} the function has a vertical asymptote in {eq}\, x=0 {/eq}.
• {eq}\displaystyle \lim_{x \rightarrow 9}f(x) =\infty \; \Rightarrow \; {/eq} the function has a vertical asymptote in {eq}\, x=9 {/eq}.
• {eq}\, f(6)=0 \; \Rightarrow \; {/eq} the function has a root at {eq}\, x=6\, {/eq}.

Consider the function {eq}\, f(x) = \displaystyle \frac{x-6}{x^2(9-x)} \, {/eq}

Notice that the function has a root at {eq}\, x=6\, {/eq} and is undefined at {eq}\, x=0 \; \text{ and }\; x=9 {/eq} and goes to infinity at both values.

The sign of the function is:

{eq}f(x) >0 \; \Rightarrow \; x\in (6,9)\\ f(x) <0 \; \Rightarrow \; x\in (-\infty, 0)\cup (0,6)\cup (9,+\infty) {/eq}

Thus, the signs of each {eq}\, \infty\, {/eq} correspond to the limits given on the exercise.

Finally, the degree of the polynomial in the denominator is higher that the polynomial in the numerator, thus, the function approaches to zero as long as {eq}\, x\rightarrow \infty {/eq}.

The function {eq}\, f(x) = \displaystyle \frac{x-6}{x^2(9-x)} \, {/eq} satisfies all conditions given in the exercise.

format: plain


text:
Re: formatting help needed

Hello Richard,

sorry for my long silence - I didn't resolve the issues completely, but I got
over an important hurdle.

I exported my .lyx-file to a .tex-file. This was the only way, I could get in
the "\setlength\parindent{0.7cm}" option. It was quite hard for me because
the German umlaut didn't get translated properly. I found out that I had to
change the encoding to utf8 to make it work.

\usepackage{fancyhdr}
\pagestyle{fancy}

The next point I need to solve is the header issue:
* page number: font size 12
* left pages: chapter title (right-aligned) in small capitals and font size 10
* right pages: subchapter title (left-aligned) in small capitals and font size
10
header not on first page of chapter

At present I get both chapter and subchapter titles in the header so that they
overwrite each other and are unreadable. The page number is in the footer and
should go up to the header.

A second point is the font size (12 and solved ;-) but the line distance
should be 14 points. How do I get that?

Thanks a lot for your help!

Markus

Just is case it may help, here is my header of the .tex file:
------------
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,english,ngerman]{extbook}
\usepackage{mathptmx}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[a4paper]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{color}
\usepackage{array}
\usepackage{textcomp}

\setlength\parindent{0.7cm}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

\usepackage{babel}

\begin{document}
------------

Am Donnerstag, 7. Mai 2009 15:03:42 schrieb rgheck:
> Markus Büchele wrote:
> > Hi Lyx experts,
> >
> > I have been using LYX for over decade now. It has always been a fantastic
> > tool, especially for my PhD thesis.
> >
> > Unfortunately I have arrived at a dead end just before publication. My
> > publisher (Franz Steiner Verlag, Stuttgart, Germany) has very percise
> > ideas about the layout of the text and I am unable to adjust to his
> > wishes with LYX.
>
> All of this can be done, probably without too much trouble.
>
> > Things which need to be adapted are:
> > * font in the header, which has to be small capitals instead of capitals
> > and a different font size
>
> I assume here that you mean the page header, or do you mean the chapter
> titles? Adjusting the page headers can be done use the fancyhdr package,
> and is fairly simple.
>     http://www.ctan.org/tex-archive/help/Catalogue/entries/fancyhdr.html
> Adjusting the chapter titles can be done using the titlesec package and
> is also fairly simple.
>     http://www.ctan.org/tex-archive/macros/latex/contrib/titlesec/
> We can work out the details.
>
> > * header (left pages): the word chapter is printed in all chapters in
> > German ("Kapitel" which is correct), but in chapter 9 there is "chapter"
> > in the header (a bug?)
>
> Did you have some English in the document somewhere? It seems as if the
> language has gotten changed.
>
> > * space of indentation at the beginning of paragraphs
>
>     \setlength\parindent{2cm}
> or whatever it is you need. LaTeX will accept lots of different units,
> too. See here:
>
> http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/teTeX/latex/latex2e-html
>/ltx-86.html for help.
>
> > * headlines of chapters without the word "chapter" in the headline and
> > different font size
>
> I think this is where you want to use titlesec.
>
> An alternative might be to switch to use the book (koma-script) class.
> The koma-script classes provide for a LOT of customization.
>
> Richard


text:
# Show that this language is not regular by Pumping Lemma

Over the alphabet $\Sigma=\{a,b\}$, we define $$L=\{a^pb^m: p\text{ is prime }, m>0\}+\{a^r:r\geq 0\}.$$

I must show that this laguage is not regular using the pumping lemma. I guess I should apply it to a word of the form $a^pb^m$, and my intuition is that I should come to the contradiction of $p$ not being prime. But I'm not very familiar with the pumping lemma, this is my first try, so I'll appreciate any hint in order to choose a word $x=a^pb^m$ with $p+m\geq n$ ($n$ from the lemma) which yields a contradiction.

• Choose a word $a^pb^m$ with $p \geq n$ and $m \geq 1$ of your choice. Good luck! – Yuval Filmus Dec 31 '17 at 19:05
• ok, then I've got $x=uvw$ with $v\neq \varepsilon$ and $|uv|\leq n$. That means that $v=a^s$ for some $1\leq s\leq n$, $|u|=a^l$ and $|w|\geq 1$ (let's say $w=a^tb^m$). Then, I use that $uv^kw\in L\forall k\in\mathbb{N}$, which is equivalent to say that $a^la^{ks}a^tb^m\in L$. Since $k$ is arbitrary, I can choose it in such a way that $l+ks+t$ is not prime. Is it fine? – Javi Dec 31 '17 at 19:32
• Unfortunately this kind of discussion doesn't fit this platform. You should be able to tell whether your proof is valid or not. – Yuval Filmus Dec 31 '17 at 19:33
• For "prime and pumping" arguments see here for instance Prove that the language of unary not-prime numbers satisfies the Pumping Lemma or, Prime number CFG and Pumping Lemma . There is more to find when you use the search box. – Hendrik Jan Jan 1 '18 at 13:38


text:
# Logistic regression is not fucked

Summary: Arguments against the use of logistic regression due to problems with “unobserved heterogeneity” proceed from two distinct sets of premises. The first argument points out that if the binary outcome arises from a latent continuous outcome and a threshold, then observed effects also reflect latent heteroskedasticity. This is true, but only relevant in cases where we actually care about an underlying continuous variable, which is not usually the case. The second argument points out that logistic regression coefficients are not collapsible over uncorrelated covariates, and claims that this precludes any substantive interpretation. On the contrary, we can interpret logistic regression coefficients perfectly well in the face of non-collapsibility by thinking clearly about the conditional probabilities they refer to.

A few months ago I wrote a blog post on using causal graphs to understand missingness and how to deal with it, which concluded on a rather positive note:

“While I generally agree that pretty much everything is fucked in non-hard sciences, I think the lessons from this analysis of missing data are actually quite optimistic…”

Well, today I write about another statistical issue with a basically optimistic message. So I decided this could be like the second installment in a “some things are not fucked” series, in which I look at a few issues/methods that some people have claimed are fucked, but which are in fact not fucked.1

In this installment we consider logistic regression — or, more generally, Binomial regression (including logit and probit regression).2

### Wait, who said logistic regression was fucked?

The two most widely-read papers sounding the alarm bells seem to be Allison (1999) and Mood (2010). The alleged problems are stated most starkly by Mood (2010, pp. 67-68):

1. “It is problematic to interpret [logistic regression coefficients] as substantive effects, because they also reflect unobserved heterogeneity.
2. It is problematic to compare [logistic regression coefficients] across models with different independent variables, because the unobserved heterogeneity is likely to  vary across models.
3. It is problematic to compare [logistic regression coefficients] across samples, across groups within samples, or over time—even when we use models with the same independent variables—because the unobserved heterogeneity can vary across the compared samples, groups, or points in time.”

These are pretty serious allegations.3  These concerns have convinced some people to abandon logistic regression in favor of the so-called linear probability model, which just means using classical regression directly on the binary outcome, although usually with heteroskedasticity-robust standard errors. To the extent that’s a bad idea—which, to be fair, is a matter of debate, but is probably ill-advised as a default method at the very least—it’s important that we set the record straight.

The allegations refer to “unobserved heterogeneity.” What exactly is this unobserved heterogeneity and where does it come from? There are basically two underlying lines of argument here that we must address. Both arguments lead to a similar conclusion—and previous sources have sometimes been a bit unclear by drawing from both arguments more or less interchangeably in order to reach this conclusion—but they rely on fundamentally distinct premises, so we must clearly distinguish these arguments and address them separately. The counterarguments I describe below are very much in the same spirit as those of Kuha and Mills (2017).

### First argument: Heteroskedasticity in the latent outcome

A standard way of motivating the probit model for binary outcomes (e.g., from Wikipedia) is the following. We have an unobserved/latent outcome variable $Y^*$ that is normally distributed, conditional on the predictor $X$. Specifically, the model for the $i$th observation is

$Y_i^* = \beta_0^* + \beta_1^*X_i + \varepsilon_i\text{, with }\varepsilon_i \sim \text{Normal}(0, \sigma^2)$.

The latent variable $Y^*$ is subjected to a thresholding process, so that the discrete outcome we actually observe is

$Y_i = \begin{cases} 1, & \text{if}\ Y_i^* \ge T \\ 0, & \text{if}\ Y_i^* < T\end{cases}$.

This leads the probability of $Y=1$ given $X$ to take the form of a Normal CDF, with mean and standard deviation a function of $\beta_1^*$, $\sigma^2$, and the deterministic threshold $T$. So the probit model is basically motivated as a way of estimating $\beta_1^*$ from this latent regression of $Y^*$ on $X$, although on a different scale. This latent variable interpretation is illustrated in the plot below, from Thissen & Orlando (2001). These authors are technically discussing the normal ogive model from item response theory, which looks pretty much like probit regression for our purposes.

We can interpret logistic regression in pretty much exactly the same way. The only difference is that now the unobserved continuous $Y^*$ follows not a normal distribution, but a similarly bell-shaped logistic distribution given $X$. A theoretical argument for why $Y^*$ might follow a logistic distribution rather than a normal distribution is not so clear, but since the resulting logistic curve looks essentially the same as the normal CDF for practical purposes (after some rescaling), it won’t tend to matter much in practice which model you use. The point is that both models have a fairly straightforward interpretation involving a continuous latent variable $Y^*$ and an unobserved, deterministic threshold $T$.

So the first argument for logistic regression being fucked due to “unobserved heterogeneity” comes from asking: What if the residual variance $\sigma^2$ is not constant, as assumed in the model above, but instead is different at different values of $X$? Well, it turns out that, as far as our observable binary outcome $Y$ is concerned, this heteroskedasticity can be totally indistinguishable from the typically assumed situation where $\sigma^2$ is constant and $Y^*$ is increasing (or decreasing) with $X$. This is illustrated in Figure 2 below.

Suppose we are comparing the proportions of positive responses (i.e., $Y=1$) between two groups of observations, Group 1 and Group 2. To give this at least a little bit of context, maybe Group 2 are human subjects of some social intervention that attempts to increase participation in local elections, Group 1 is a control group, the observed binary $Y$ is whether the person voted in a recent election, and the latent continuous $Y^*$ is some underlying “propensity to vote.” Now we observe a voting rate of 10% in the control group (Group 1) and 25% in the experimental group (Group 2). In terms of our latent variable model, we’d typically assume this puts us in Scenario A from Figure 2: The intervention increased people’s “propensity to vote” ($Y^*$) on average, which pushed more people over the threshold $T$ in Group 2 than in Group 1, which led to a greater proportion of voters in Group 2.

The problem is that these observed voting proportions can be explained equally well by assuming that the intervention had 0 effect on the mean propensity to vote, but instead just led to greater variance in the propensities to vote. As illustrated in Scenario B of Figure 2, this could just as well have led the voting proportion to increase from 10% in the control group to 25% in the experimental group, and it’s a drastically different (and probably less appealing) conceptual interpretation of the results.

Another possibility that would fit the data equally well (but isn’t discussed as often) is that the intervention had no effect at all on the distribution of $Y^*$, but instead just lowered the threshold for Group 2, so that even people with a lower “propensity to vote” were able to drag themselves to the polls. This is illustrated in Scenario C of Figure 2.

So you can probably see how this supports the three allegations cited earlier. When we observe a non-zero estimate for a logistic regression coefficient, we can’t be sure this actually reflects a shift in the mean of the underlying continuous latent variable (e.g., increased propensity to vote), because it also reflects latent heteroskedasticity, and we can’t tell these two explanations apart. And because the degree of heteroskedasticity could easily differ between models, between samples, or over time, even comparing logistic regression coefficients to one another is problematic…if shifts in the underlying mean are what we care about.

##### Are shifts in an underlying mean what we care about?

There’s the crux of the matter. This entire first line of argument presupposes that all of the following are true for the case at hand:

1. It makes any conceptual sense to think of the observed binary $Y$ as arising from a latent continuous $Y^*$ and a deterministic threshold.
2. We actually care how much of the observed effect on $Y$ is due to mean shifts in $Y^*$ vs. changes in the variance of $Y^*$.
3. We’ve observed only a single binary indicator of $Y^*$, so that Scenarios A and B from Figure 2 are empirically indistinguishable.

In my experience, usually at least one of these is false. For example, if the observed binary $Y$ indicates survival of patients in a medical trial, what exactly would an underlying $Y^*$ represent? It could make sense for the patients who survived—maybe it represents their general health or something—but surely all patients with $Y=0$ are equally dead! Returning to the voting example, we can probably grant that #1 is true: it probably does make conceptual sense to think about an underlying, continuous “propensity to vote.” But #2 is probably false: I couldn’t care less if the social intervention increased voting by increasing propensity to vote, spreading out the distribution of voting propensities, or just altering the threshold that turns the propensity into voting behavior… I just want people to vote!

Finally, when #1 and #2 are true, so that the investigator is primarily interested not in the observed $Y$ but rather in some underlying latent $Y^*$, in my experience the investigator will usually have taken care to collect data on multiple binary indicators of $Y^*$—in other words, #3 will be false. For example, if I were interested in studying an abstract $Y^*$ like “political engagement,” I would certainly view voting as a binary indicator of that, but I would also try to use data on things like whether that person donated money to political campaigns, whether they attended any political conventions, and so on. And when there are multiple binary indicators of $Y^*$, it then becomes possible to empirically distinguish Scenario A from Scenario B in Figure 2, using, for example, statistical methods from item response theory.

These counterarguments are not to say that this first line of argument is invalid or irrelevant. The premises do lead to the conclusion, and there are certainly situations where those premises are true. If you find yourself in one of those situations, where #1-#3 are all true, then you do need to heed the warnings of Allison (1999) and Mood (2010). The point of these counterarguments is to say that, far more often than not, at least one of the premises listed above will be false. And in those cases, logistic regression is not fucked.

Okay, great. But we’re not out of the woods yet. As I mentioned earlier, there’s a second line of argument that leads us to essentially the same conclusions, but that makes no reference whatsoever to a continuous latent $Y^*$.

### Second argument: Omitted non-confounders in logistic regression

To frame the second argument, first think back to the classical regression model with two predictors, a focal predictor $X$ and some covariate $C$:

$Y_i = \beta^A_0 + \beta^A_1X_i + \beta^A_2C_i + \varepsilon^A_i$.

Now suppose we haven’t observed the covariate $C$, so that the regression model we actually estimate is

$Y_i = \beta^B_0 + \beta^B_1X_i + \varepsilon^B_i$.

In the special case where $C$ is uncorrelated with $X$, we know that $\beta^B_1 =\beta^A_1$, so that our estimate of the slope for $X$ will, on average, be the same either way. The technical name for this property is collapsibility: classical regression coefficients are said to be collapsible over uncorrelated covariates.

It turns out that logistic regression coefficients do not have this collapsibility property. If a covariate that’s correlated with the binary outcome is omitted from the logistic regression equation, then the slopes for the remaining observed predictors will be affected, even if the omitted covariate is uncorrelated with the observed predictors. Specifically, in the case of omitting an uncorrelated covariate, the observed slopes will be driven toward 0 to some extent.

This is all illustrated below in Figure 3, where the covariate $C$ is shown as a binary variable (color = red vs. blue) for the sake of simplicity.

So now we can lay out the second line of argument against logistic regression. Actually, the most impactful way to communicate the argument is not to list out the premises, but instead to use a sort of statistical intuition pump. Consider the data in the right-hand panel of Figure 3. The slope (logistic regression coefficient) of $X$ on $Y$ is, let’s say, $\beta=2$ for both the red group and the blue group. But suppose the color grouping factor is not observed, so that we can only fit the simple/unconditional logistic regression that ignores the color groups. Because of the non-collapsibility of logistic regression coefficients, the slope from this regression (shown in black in Figure 2) is shallower, say, $\beta=1$. But if the slope is $\beta=2$ among both the red and the blue points, and if every point is either red or blue, then who exactly does this $\beta=1$ slope apply to? What is the substantive interpretation of this slope?

For virtually every logistic regression model that we estimate in the real world, there will be some uncorrelated covariates that are statistically associated with the binary outcome, but that we couldn’t observe to include in the model. In other words, there’s always unobserved heterogeneity in our data on covariates we couldn’t measure. But then—the argument goes—how can we interpret the slopes from any logistic regression model that we estimate, since we know that the estimates would change as soon as we included additional relevant covariates, even when there’s no confounding?

These are rhetorical questions. The implication is that no meaningful interpretation is possible—or, as Mood (2010, p. 67) puts it, “it is problematic to interpret [logistic regression coefficients] as substantive effects.” I beg to differ. As I argue next, we can interpret logistic regression coefficients perfectly well even in the face of non-collapsibility.

##### Logistic regression coefficients are about conditional probabilities

Specifically, we can write logistic regression models directly analogous to models A and B from above as:

$f\big(\text{Pr}(Y_i=1|X_i=x,C_i=c)\big) = \beta^A_0 + \beta^A_1x + \beta^A_2c$,

$f\big(\text{Pr}(Y_i=1|X_i=x)\big) = \beta^B_0 + \beta^B_1x$,

where $f(\cdot)$ is the logit link function. As the left-hand-sides of these regression equations make clear, $\beta^A_1$ tells us about differences in the probability of $Y$ as $X$ increases conditional on the covariate $C$ being fixed at some value $c$, while $\beta^B_1$ tells us about differences in the probability of $Y$ as $X$ increases marginal over $C$. There is no reason to expect these two things to coincide in general unless $\text{Pr}(Y|X,C)=\text{Pr}(Y|X)$, which we know from probability theory is only true when $Y$ and $C$ are conditionally independent given $X$—in terms of our model, when $\beta^A_2=0$.

So now let’s return to the red vs. blue example of Figure 3. We supposed, for illustration’s sake, a slope of $\beta^B_1=1$ overall, ignoring the red vs. blue grouping. Then the first rhetorical question from before asked, “who exactly does this $\beta^B_1=1$ slope apply to?” The answer is that it applies to a population in which we know the $X$ values but we don’t know the $C$ values, that is, we don’t know the color of any of the data points. There’s an intuition that if $\beta^A_1=2$ among both the red and blue points, then for any new point whose color we don’t know, we ought to guess that the slope that applies to them is also $2$. But that presupposes that we were able to estimate slopes among both the red and blue groups, which would imply that we did observe the colors of at least some of the points. On the contrary, let me repeat: the $\beta^B_1=1$ slope applies to a population in which we know the $X$ values but we don’t know any of the $C$ values. Put more formally, the $\beta^B_1=1$ slope refers to changes in $\text{Pr}(Y|X) = \text{E}_C\big[\text{Pr}(Y|X,C)\big]$; there is an intuition that these probabilities ought to equal $\text{Pr}\big(Y|X,C=\text{E}[C]\big)$, but these are not the same because the latter still require conditioning on $C$.

The second rhetorical question from above asked, “how can we interpret the slopes from any logistic regression model that we estimate, since we know that the estimates would change as soon as we included additional relevant covariates, even when there’s no confounding?” The answer is that we interpret them conditional on all and only the covariates that were included in the model. Again, conceptually speaking, the coefficients refer to a population in which we know the values of the covariates represented in the model and nothing more. There’s no problem with comparing these coefficients between samples or over time as long as these coefficients refer to the same population, that is, populations where the same sets of covariates are observed.

As for comparing coefficients between models with different covariates? Here we must agree with Mood and Allison that, in most cases, these comparisons are probably not informative. But this is not because of “unobserved heterogeneity.” It’s because these coefficients refer to different populations of units. In terms of models A and B from above, $\beta^A_1$ and $\beta^B_1$ represent completely different conceptual quantities and it’s a mistake to view estimates of $\beta^B_1$ as somehow being deficient estimates of $\beta^A_1$. As a more general rule, parameters from different models usually mean different things—compare them at your peril. In the logistic regression case, there may be situations where it makes sense to compare estimates of $\beta^A_1$ with estimates of $\beta^B_1$, but not because one thinks they ought to be estimating the same quantity.

### Footnotes and References

1 Or which, at least, are not fucked for the given reasons, although they could still be fucked for unrelated reasons.
2 This stuff is also true for some survival analysis models, notably Cox regression.
3 At least, I think they are… a definition of “substantive effects” is never given (are they like causal effects?), but presumably they’re something we want in an interpretation.

Allison, P. D. (1999). Comparing logit and probit coefficients across groupsSociological methods & research28(2), 186-208.

Kuha, J., & Mills, C. (2017). On group comparisons with logistic regression modelsSociological Methods & Research, 0049124117747306.

Mood, C. (2010). Logistic regression: Why we cannot do what we think we can do, and what we can do about itEuropean sociological review26(1), 67-82.

Pang, M., Kaufman, J. S., & Platt, R. W. (2013). Studying noncollapsibility of the odds ratio with marginal structural and logistic regression modelsStatistical methods in medical research25(5), 1925-1937.

Rohwer, G. (2012). Estimating effects with logit models. NEPS Working Paper 10, German National Educational Panel Study, University of Bamberg.

Thissen, D. & Orlando, M. (2001). Item response theory for items scored in two categories. In D. Thissen & Wainer, H. (Eds.), Test Scoring (pp. 73-140). Mahwah, NJ: Lawrence Erlbaum Associates, Inc.

## 10 thoughts on “Logistic regression is not fucked”

1. CHCH says:

Hi Jake – Happy to see that you followed up our prior correspondence with this post – this is really great. Your writing on the topic is the most cogent I’ve seen, and I love the general back-to-basics approach of re-examining whether some of our “simplest” tools are maybe not so simple after all.

However, and I don’t mean to be flippant, I’d like to give a “glass half empty” recap of the way I understand the post, and then you can correct me (/ cheer me up):

You basically agree that all of the criticisms are logically correct and suggest only that the premises are limited in applicability. So, we’re still fucked, just not completely! Specifically, the people who *aren’t* fucked are those that (1) don’t care about why the outcome variable is changing OR (2) pursue a strategy that could be understood to compound the problem – i.e., using many measures and many logistic regressions (IRT) – to somehow escape the collapsibility & unobserved heterogeneity problems.

I feel like (1) is highly subjective (I think many people do run multiple logistic regression to understand what elements are responsible for change in an outcome) and (2) is at least not obviously true (are you aware of any quantitative demonstration that IRT solves this problem, and under what conditions?). So, I still feel a little bit fucked.

Two perhaps more positive/constructive comments: (A) I am a bit surprised to not see a suggestion to use a linear probability model as a sensitivity analysis for binomial regression, given these issues; is there a reason you do not mention that possibility? (B) would you suggest recasting binomial outcomes as theoretically meaningful to allow the use of other models (e.g., time to event rather than event occurrence, enabling use of Cox etc) without these problems, or are these models also possibly fucked?

Again, fantastic stuff here.

So there are two separate arguments I’m responding to in this post, and correct me if I’m wrong, but it looks like in your comment you’re only referring to the first argument (about latent heteroskedasticity as I’ve called it). So I won’t mention the collapsibility argument either here.

Yes, I find argument #1 to be valid but to have limited applicability. I mean “limited” in two separate senses here. First, it’s limited compared to the apparently universal applicability suggested by Mood & Allison. I hope you at least agree with this. Second, it’s limited in that it likely only applies in a minority of cases. I agree that this is a much more subjective assessment, and one that almost certainly depends on the research in question and so forth. But, well, it’s my assessment, and I’ve offered counter-arguments to try to back this assessment up (by questioning the premises that I labeled 1-3).

Now let me respond a little more specifically. You wrote:
“the people who *aren’t* fucked are those that (1) don’t care about why the outcome variable is changing…”
Well, no… two responses here.

First, I don’t think it’s fair to characterize people who don’t care about distinguishing Scenarios A and B in my Figure 2 as “not caring WHY the outcome variable is changing.” One can be indifferent about distinguishing Scenarios A and B and yet still care about, e.g., explaining the causal path that links X to Y, for example by studying mediators and moderators of the relationship. In social sciences, explanations at this causal level are usually what people mean when they talk about “why” an outcome variable is changing.

Second, you left out another important condition, which is that argument #1 only goes through if the latent variable interpretation is correct! That is, if the thresholding process that it’s based on is the true data generating process. If in fact there is no thresholding mechanism working behind the scenes for the case at hand, then argument #1 is irrelevant. Of course, we can’t directly verify whether the thresholding process is true; we can only judge whether that would make conceptual sense and is a priori likely. And in a lot of cases, the idea of an underlying latent variable and deterministic threshold is a bit of a stretch; in such cases, basically the outcome either happened or it didn’t, and it’s not clear what the interpretation of a continuous outcome would even be (as in the survival example I gave). That said, I do accept that there are plenty of cases where such an interpretation would make good sense.

So, again, for us to accept the conclusion of argument #1, both of the following (as well as the multiple indicators thing, addressed below) have to be true: the latent variable + threshold interpretation is quite plausible, and if it were true then we’d only be interested in one of the scenarios from Figure 2 — usually Scenario A.

About the multiple indicators issue, you wrote:
“people who *aren’t* fucked are those that […] (2) pursue a strategy that could be understood to compound the problem – i.e., using many measures and many logistic regressions (IRT) – to somehow escape the collapsibility & unobserved heterogeneity problems. […] (2) is at least not obviously true.”

I think I can convince you pretty easily that it’s true. Basically you need to have multiple thresholds, which you can get either by having multiple binary outcomes (as in IRT) or a single ordinal response with >2 categories (as in the unequal-variance signal detection model). Then the latent variance parameter (or, more precisely, a variance ratio) is identifiable.

To see this more concretely, consider Figure 2 again. Now imagine that, in addition to the threshold already drawn, there were a second threshold that sat right exactly in the middle of the Group 1 distribution, so that half the mass lie on either side of the threshold. How would this new threshold carve up the Group 2 distribution? The key is that it would do so differently in Scenario A vs. Scenario B. In Scenario B, clearly this new threshold would carve up Group 2 in the same way it did Group 1, that is, with half the probability mass on either side of the threshold. But in Scenario A, this threshold would carve up Group 2 such that about 25% of the mass would be below the new threshold and 75% of the mass above the new threshold. So if there are multiple thresholds, then Scenarios A and B entail different observed probabilities across the 4 response combinations for Group 2, which makes it possible to statistically distinguish the two scenarios.

As for potentially “compounding the problem,” I guess I’m not sure what you mean. And to answer your question, no, I haven’t read a paper that used IRT methodology to distinguish Scenarios A and B — which probably makes sense because I haven’t read that many papers that use IRT methodology period. But I think it’s pretty easy to see how this would work, as I hope I’ve convinced you above.

“(A) I am a bit surprised to not see a suggestion to use a linear probability model as a sensitivity analysis for binomial regression, given these issues; is there a reason you do not mention that possibility?”
No particular reason. The idea of doing both analyses and checking to see whether they give similar answers seems fine to me. In cases where they do, arguably you don’t need to worry too much about the issues in this blog post. In cases where they don’t agree, there’s a question of which model to trust more. In those cases I’d argue that logistic regression generally has a more statistically sound basis, considering (a) the problems the linear probability model (LPM) has with predicting probabilities outside of the [0, 1] range (and the resulting inconsistency of its parameter estimates) and (b) the implausibility of a truly linear response function near the 0/1 boundaries. Both of these issues would especially be a problem when predicting a substantially unbalanced binary response.

Certainly if you’re not in one of the situations implicated by argument #1, then I can’t see a good reason to trust the LPM results more than the logistic regression results. But even if you are in one of the situations implicated in argument #1, it’s not at all clear how the LPM can save you. In those situations, you believe in and care about a latent continuous variable, but the LPM contains no statistical mechanism for telling you anything about that latent variable. So I can’t say I really see how the LPM would help un-fuck you there.

“(B) would you suggest recasting binomial outcomes as theoretically meaningful to allow the use of other models (e.g., time to event rather than event occurrence, enabling use of Cox etc) without these problems, or are these models also possibly fucked?”
Hopefully I’m interpreting you correctly here — but yes, if you have other relevant data about the response, like time-to-event data, then by all means you should probably use it! With that said, certain time-to-event models (but not all) also exhibit the non-collapsibility of argument #2, notably Cox regression as mentioned in Footnote 2.

2. Joey Heffner says:

Hi,

Great article! Do you have any practical advice regarding how to appropriately compare logistic Beta estimates if we should not compare estimates across models?

In your example, if we added a second predictor (X2) is it possible to compare the betas for X and X2 to definitely say which of these variables is a stronger predictor of the dependent variable Y? Furthermore, if these betas changed when you introduced the grouping variable (color), then those new betas would have to be taken as conditional upon grouping variable being known correct?

1. Hi Joey, comparing coefficients within the same model works pretty much the same as in classical regression. Just like in that case, you probably want to make sure that the two predictors whose slopes you’re comparing are measured on a comparable scale.

1. Joey Heffner says:

Hi Jake,

Thanks that makes sense. But what happens if you want to do some model comparison?

So if you want to compare three (toy) logistic models:
1. DV ~ X
2. DV ~ X2
3. DV ~ X*X2 (interaction & main effects)

Your post gave me the impression that comparing across these logistic models would be problematic, so the only model that would allow you to compare the effect of X vs. X2 would be the third model. As opposed to a linear model where you may be able to do some sort of Beta test between X and X2 (derived from model 1 & 2).

Thank you again for responding earlier!

1. Joey,

The issue conceded in the post as potentially problematic is concerned with parameter comparison — in particular, comparing parameters between models with different sets of covariates — not with model comparison. Model comparison in logistic regression is just fine, and no one (at least in this conversation thus far) has alleged otherwise.

For the specific case you mentioned, there would be no problem in comparing Models 1 vs. 3 or Models 2 vs. 3. These comparisons essentially amount to testing the null hypothesis that some parameters equal 0. That involves comparing parameter estimate(s) to a fixed value, not to another parameter estimate from a different model — which is the potentially problematic situation discussed in the post — so it’s fine. On the other hand, comparing the X2 slope estimate from Model 2 with the X2 slope estimate from Model 3 wouldn’t make sense in most cases. But that’s not what we’re doing when we’re doing model comparison.

Comparing Models 1 vs. 2 would be a little trickier, but that’s just because these are non-nested models. So that’s something that’s not unique to logistic regression — it would be a little tricky in classical regression as well. A traditional approach would be to base the comparison on AIC and/or BIC, but there are other, perhaps more sophisticated approaches as well.

3. Hi Jake – I found this through a link from another blog. This is a great post – I’d love to see it with embedded code using something like rmarkdown. Regardless, I wanted to comment on one point you make hoping to generate discussion. This point is

“Logistic regression coefficients are about conditional probabilities”

I would argue that logistic (or the coefficients of any linear model) estimate two very different parameters
1) the parameters that generated the response, that is, causal effect parameters
2) the parameter that is conditional on the covariates

comparing #2 across models is indeed comparing apples and oranges but not #1, because this parameter is independent of other factors that causally generate the response. For #1, if A (above) is the true model then X(B) is a predictor of the true generating parameter, but is biased because of the omitted confounder. But, if all we care about is #2, then “confounding” is meaningless. Confounding is only meaningful if we are concerned with estimating the generating parameters. This is obvious once the difference between the two parameters are clear but other than Gelman and Hill I’m haven’t seen it stated explicitly anywhere.

Multiple regression was invented as a system of correlations but almost immediately the first use of partial regression coefficients was by Yule who was explicitly estimating #1. The #2 way of thinking really didn’t become clear until Fisher in 1922, as far as I can tell from my very light reading of the history of regression modeling.

Textbooks are very muddled about this. They simultaneously talk about the “correct” model as the model that generates the data and a regression coefficient as an “effect” conditional on the covariates. Morgan and Winship note this confusion. Pearl has been differentiating these two for a few years. Shalizi’s online unpublished textbook is the most clear, I think, where he refers to these as 1) causal conditioning and 2) probabilistic conditioning (p. 505 of his 2017 version).

I have a preprint at bioRxiv with this in the context of model averaging regression coefficients, https://www.biorxiv.org/content/early/2017/12/04/133785.


text:
Simplify 90/(1+271e^(-0.122*33))

Simplify the denominator.
Multiply by .
Rewrite the expression using the negative exponent rule .
Combine and .
Write as a fraction with a common denominator.
Combine the numerators over the common denominator.
Multiply the numerator by the reciprocal of the denominator.
Combine and .
The result can be shown in multiple forms.
Exact Form:
Decimal Form:
Simplify 90/(1+271e^(-0.122*33))

Our Professionals

Lydia Fran

We are MathExperts

Solve all your Math Problems: https://elanyachtselection.com/

Scroll to top


text:
# Math Help - Distance

1. ## Distance

Show that the average distance between two points that are chosen randomly and uniformly in a sphere of radius 1 is 36/35, about 1.029.

2. ## Average distance between two point in the unit sphere

This is what you're looking for

Distances In Bounded Regions


text:
# Luck Matters: Understanding Training Dynamics of Deep ReLU Networks

31 May 2019Yuandong TianTina JiangQucheng GongAri Morcos

We analyze the dynamics of training deep ReLU networks and their implications on generalization capability. Using a teacher-student setting, we discovered a novel relationship between the gradient received by hidden student nodes and the activations of teacher nodes for deep ReLU networks... (read more)

PDF Abstract


text:
# How to perform convolution using polyphase structure

I am trying to implement convolution using polyphase structure but, how to split input samples among different filter banks is my major doubt. Please explain the same with example?

• Why do you want to use polyphase? It's only useful for specific applications and the best implementation depends on which application it is – Hilmar Jan 17 '20 at 8:36
• @Hilmar it's for a real-time narrow band filter. Already implemented other efficient methods but, it's been decided polyphase would be the best bet. How do I convolve using polyphase structure?, I already have my filter coefficients separated. – Nagashree Jan 17 '20 at 9:42
• yeah, but the polyphase decomposition type you use depends on why you're doing a polyphase implementation, so: we're going in circles. Please tell us why you're doing this filter in polyphase. – Marcus Müller Jan 17 '20 at 10:03
• @MarcusMüller I am doing this filter in polyphase for parallel processing and to have a smaller buffer requirement. Mainly I want to achieve continuous filtering and not hold any input sample. – Nagashree Jan 17 '20 at 10:14
• ee.ic.ac.uk/hp/staff/dmb/courses/DSPDF/01200_Polyphase.pdf: this is the pdf I went through before starting my implementation. – Nagashree Jan 17 '20 at 10:21

x(1:2:end) = cos(2*pi*f*t(1:2:end));


text:
Connect with us

CBD to the Rescue? Oklahoma Judge to Voice Verdict to Johnson & Johnson’s $17 Billion Opioid Lawsuit Published on - Ad - Johnson & Johnson (J&J) has been slapped with a potential$17 billion lawsuit for having used a marketing strategy that seems to have driven opioid crisis in Oklahoma reports Microsoft News’ MSN.

As per the claims made, an Oklahoma judge will be deciding Monday, August 26, 2019 at 4PM EDT, whether or not J&J will be held liable. A remarkable 2,000 opioid lawsuits are pending for a verdict in Ohio, with trials pushed closer to October.

That said, J&J’s lawsuit depicts a years-long marketing campaign that expounded on their painkillers’ benefits without mentioning so much on the associated risks. Their drugs, Duragesic and Nucynta were supposedly overly-prescribed by doctors, which carry some opioid.

In response to the allegations, the firm argued that their painkillers were supported by scientific proof that it only played a “tiny fraction of opioids prescribed in Oklahoma,” emphasizes the news outlet.

Attorney General, Michael Hunter is the one who wants J&J to pay up over $17 billion. The money will be used towards helping the state to address the crisis at hand and what can be done to protect residents over the course of 30 years, especially in terms of treatments and programs. This isn’t the first case with a large sum of money in pending, as Purdue Pharma LP’s OxyContin supposedly had to pay up$270 million in March and Pharmaceutical Industries Ltd.’s Teva resulting in \$85 million.

Could CBD Be THE Viable Solution?

With the opioid crisis on the rise, and the numerous pharmaceutical companies getting exposed, consumers are surely to turn in the direction of cannabidiol (CBD). Deemed a type of cannabinoid, free of mind-altering properties and derived specifically from the hemp plant, many existing studies have concluded that it serves as a natural pain reliever.

CBD’s anti-inflammatory properties are trusted to make a positive difference in those experiencing chronic pains, some of which include neuropathic pain, arthritis, migraine, and fibromyalgia among many others.

While researchers are still not sure how it communicates with the body’s endocannabinoid system (eCS), as more studies are being conducted, similar results depicting its pain relief properties are being voiced.

Bearing this in mind, consumers need to be aware that not all CBD products are Food and Drug Administration (FDA) approved. As of now, Epidiolex is the only drug approved by the agency, for the sole purposes of epilepsy (containing both CBD and THC).

Cannabinoids to Overcome Opioid Crisis?

Recently, researchers at the University of New Mexico supposedly used a large database of real-time recordings that looked at the effects of commercially available cannabis products across the U.S. The team concluded that there is a

“Strong evidence that cannabis can significantly alleviate pain, with the average user experiencing a three-point drop in pain suffering from a 0 to 10 point scale immediately following cannabis consumption.”

One of the lead investigators of the study, Jacob Miguel Vigil spoke of the findings and limitations that currently exist. As per Vigil,

“Cannabis offers the average patient an effective alternative to using opioids for general use in the treatment of pain with very minimal negative side effects.”

That said, the problem now becomes the inability to conduct research. Obviously, with any new ingredient for medicinal purposes comes the search for reliability and validity. If enough studies are not conducted, then results cannot be generalized to the population.

Vigil stressed the need to get cannabis out of Schedule 1, adding that even reclassifying as

“Schedule II, i.e. classifying with fentanyl, oxycodone, and cocaine rather than heroin and ecstasy could dramatically improve our ability to conduct research and only would require that the DEA recognizes that accepted medical uses for cannabis exist.”

The researcher further noted that the cannabis plant is surely to house different cannabinoids that tend to pain and aches, which could also include flavonoids and terpenes. Nonetheless, the study did find that cannabis use is “relatively safe”.

He goes on to stress the nature of the opioid crisis and how “chronic opioid use is associated with poorer quality of life [compared to] cannabis use [which] is associated with a reversal of each of these potential outcomes.”


text:
General plugins

Planet eStream not appearing in the text editor

Planet eStream not appearing in the text editor

Hello


text:
×

# LEVEL UP

Hi I answered all the questions of this week's PHYSICS(Electricity and Magnetism,Mechanics) Level 4 correctly but I didn't get level up yet! Can you give me any reason?

Note by Balaji Dodda
3 years, 10 months ago

Sort by:

Wait for this problem set to close. · 3 years, 10 months ago

You have to get 7/8 problems in 2 weeks,means you have to have 1 week perfect and the other 3/4,for physics. · 3 years, 10 months ago

Another good week will surely level you up.. · 3 years, 10 months ago

Thanks · 3 years, 10 months ago


text:
# Bound for the number of solutions to a system of congruence relations

Suppose I have $n$ polynomials in $n$ variables $G_j(x_1, \ldots, x_n)$ with integer coefficients. Let $u_j$ be some fixed $p$-adic integers. Consider the system of congruences $$G_j(\mathbf{x}) \equiv u_j x_j^{-1} \pmod{p^k}$$ for $1 \leq j \leq n$. Let $N(p,k)$ be the number of all solutions $\mathbf{a} \in ((\mathbb{Z}/p^k \mathbb{Z})^*)^n$ to the above system of congruences. I am interested in upper bounds for $N(p;k)$.

I am wondering is it possible to obtain $N(p;k) \ll 1$, where the implicit constant may depend on the degrees and the coefficients of the polynomials but not on $p$ or $k$. If so what conditions do I need for the polynomials $G_j$?

I would greatly appreciate any comments. Thank you very much.

• Such an upper bound certainly doesn't hold in general: take all the $u_j$ equal to $1$, and take $G_j(x) = x_1 \cdots x_{j-1} x_{j+1} \cdots x_n$. Then all $n$ congruences are exactly the same, and the number of solutions is $\big( p^{k-1}(p-1) \big)^{n-1}$. – Greg Martin Feb 25 '18 at 20:45
• If the system of equations $G_j =u_jx_j^{-1}$ has finitely many solutions in an algebraically closed field of characteristic zero (e.g. $\mathbb{C}$), then it will have at most that many solutions in any $p$-adic field and your bound will follow. – Felipe Voloch Feb 25 '18 at 20:55


text:
# STRANGE MESONS ($\mathit S$ = $\pm1$, $\mathit C$ = $\mathit B$ = 0)

${{\mathit K}^{+}}$ = ${\mathit {\mathit u}}$ ${\mathit {\overline{\mathit s}}}$, ${{\mathit K}^{0}}$ = ${\mathit {\mathit d}}$ ${\mathit {\overline{\mathit s}}}$, ${{\overline{\mathit K}}^{0}}$ = ${\mathit {\overline{\mathit d}}}$ ${\mathit {\mathit s}}$, ${{\mathit K}^{-}}$ = ${\mathit {\overline{\mathit u}}}$ ${\mathit {\mathit s}}$, similarly for ${{\mathit K}^{*}}$'s
 ${{\mathit K}^{\pm}}$ ${{\mathit K}^{0}}$ ${{\mathit K}_S^0}$ ${{\mathit K}_L^0}$ ${{\mathit K}_{{0}}^{*}{(800)}}~$or ${{\mathit \kappa}}$ ${{\mathit K}^{*}{(892)}}$ ${{\mathit K}_{{1}}{(1270)}}$ ${{\mathit K}_{{1}}{(1400)}}$ ${{\mathit K}^{*}{(1410)}}$ ${{\mathit K}_{{0}}^{*}{(1430)}}$ ${{\mathit K}_{{2}}^{*}{(1430)}}$ ${{\mathit K}{(1460)}}$ ${{\mathit K}_{{2}}{(1580)}}$ ${{\mathit K}{(1630)}}$ ${{\mathit K}_{{1}}{(1650)}}$ ${{\mathit K}^{*}{(1680)}}$ ${{\mathit K}_{{2}}{(1770)}}$ ${{\mathit K}_{{3}}^{*}{(1780)}}$ ${{\mathit K}_{{2}}{(1820)}}$ ${{\mathit K}{(1830)}}$ ${{\mathit K}_{{0}}^{*}{(1950)}}$ ${{\mathit K}_{{2}}^{*}{(1980)}}$ ${{\mathit K}_{{4}}^{*}{(2045)}}$ ${{\mathit K}_{{2}}{(2250)}}$ ${{\mathit K}_{{3}}{(2320)}}$ ${{\mathit K}_{{5}}^{*}{(2380)}}$ ${{\mathit K}_{{4}}{(2500)}}$ ${{\mathit K}{(3100)}}$


text:
SharedModular Exponentiation .sagewsOpen in CoCalc
23.digits(2)
list(reversed(23.digits(2)))

[1, 1, 1, 0, 1] [1, 0, 1, 1, 1]
def ModExp(b,n,m):
"""
This function returns b^n mod m with the built in Digits Command.
Note - Digits returns a list of the form [a_0 a_1 ... a_k]
"""
e = n.digits(2);
l = len(e)-1;
x = 1;
power = mod(b,m)
for i in [0..l]:
#print 'i =',i, 'x =', x, 'pow =', power #Print Out of Values i,x, and power
if e[i] == 1: x = mod(x*power,m)
power = mod(power^2,m)
return x

ModExp(3,23,25)

i = 0 x = 1 pow = 3 i = 1 x = 3 pow = 9 i = 2 x = 2 pow = 6 i = 3 x = 12 pow = 11 i = 4 x = 12 pow = 21 2
mod(3^23,25)

2
ModExp(3,98,25)

i = 0 x = 1 pow = 3 i = 1 x = 1 pow = 9 i = 2 x = 9 pow = 6 i = 3 x = 9 pow = 11 i = 4 x = 9 pow = 21 i = 5 x = 9 pow = 16 i = 6 x = 19 pow = 6 14
ModExp(3,613,25)

i = 0 x = 1 pow = 3 i = 1 x = 3 pow = 9 i = 2 x = 3 pow = 6 i = 3 x = 18 pow = 11 i = 4 x = 18 pow = 21 i = 5 x = 18 pow = 16 i = 6 x = 13 pow = 6 i = 7 x = 3 pow = 11 i = 8 x = 3 pow = 21 i = 9 x = 3 pow = 16 23
import time
a = 87035158
n = 141897117
m = 251583961

t= time.time()
ModExp(a,n,m)
print time.time()-t

t= time.time()
mod(a^n,m)
print time.time()-t

1234567 0.00758504867554 1234567 42.6682598591
import time
a=323555;
n=12532777;
m=223532111

t= time.time()
ModExp(a,n,m)
print time.time()-t

t= time.time()
mod(a^n,m)
print time.time()-t

130889551 0.00142598152161


text:
Question

# Verify: (i) $$x^3+y^3=(x+y)(x^2-xy+y^2)$$ (ii) $$x^3-y^3=(x-y)(x^2+xy+y^2)$$

Solution

## To verify put $$x=1$$ and $$y=2$$ in given equations, and check wheater LHS and RHS are equal.(i) $$x^{3}+y^{3}=(x+y)(x^{2}-xy+y^{2})$$LHS: $$x^{3}+y^{3}=$$ $$1^{3}+2^{3}$$ $$=9$$RHS: $$=(x+y)(x^{2}-xy+y^{2})$$ $$=(1+2)(1^{2}-1.2+2^{2})$$ $$=9$$verified(ii) $$x^{3}-y^{3}=(x-y)(x^{2}+xy+y^{2})$$LHS:$$x^{3}-y^{3}=$$ $$1^{3}-2^{3}$$ $$=-7$$RHS:$$(x-y)(x^{2}+xy+y^{2})$$$$=(1-2)(1^{2}+1.2+2^{2})$$ $$=-7$$It is verified MathematicsRS AgarwalStandard IX

Suggest Corrections

0

Similar questions
View More

Same exercise questions
View More

People also searched for
View More


text:
# Anaximperator blog

Blogging against alternative cancer treatments

## German New Medicine (GNM) and Debunking Hamer on Cancer Metastasis: Slam Dunk

Ryke Geerd Hamer, inventor of the German New Medicine, claims that there is no such thing as cancer metastasis.

Hamer also claims that cancer does not spread through the bloodstream.

However, these claims can easily be checked out, and that is just what jli, our pathologist, has done in this post.


text:
# My problems #18

Algebra Level 3

Find the number of positive integers $$m$$for which there exist nonnegative integers $$x_0$$, $$x_1$$, $$\dots$$ , $$x_{2011}$$ such that $m^{x_0} = \displaystyle\sum_{k = 1}^{2011} m^{x_k}.$

×


text:
SEARCH HOME
 Math Central Quandaries & Queries
 Subject: integers Name: bill Who are you: Other if the value of xyz company stock drops from $25 per share to$21 per share, what is the percent of the decrease?

Hi Bill,

The stock price dropped from $25 to$21 so it dropped $4. The percentage change is the change (-$4), as a fraction of the starting price (\$25), and then expressed as a percentage. The drop as a fraction of the starting price is -4/25. Expressed as a percent this is

-4/25 100 = -16%.

Hence there is a -16% change which is a 16% decrease.

Penny

Math Central is supported by the University of Regina and The Pacific Institute for the Mathematical Sciences.


text:
# Solve the equation (\frac{t}{t+1})^{2}-\frac{2t}{t+1}-8=0

Solve the equation
${\left(\frac{t}{t+1}\right)}^{2}-\frac{2t}{t+1}-8=0$
You can still ask an expert for help

• Questions are typically answered in as fast as 30 minutes

Solve your problem for the price of one coffee

• Math expert for every subject
• Pay only if we can solve it

Step 1
The given equation is,
${\left(\frac{t}{t+1}\right)}^{2}-\frac{2t}{t+1}-8=0$
On simplifying the given equation, we get
${\left(\frac{t}{t+1}\right)}^{2}-\frac{2t}{t+1}-8=0$
${\left(\frac{t}{t+1}\right)}^{2}-2\left(\frac{t}{t+1}\right)-8=0$
Let, $\frac{t}{t+1}=u,t\ne -1$
Then the given equation becomes,
${u}^{2}-2u-8=0$
Step 2
On solving the obtained quadratic equation, we get
${u}^{2}-2u-8=0$
${u}^{2}-4u+2u-8=0$
u(u-4)+2(u-4)=0
(u+2)(u-4)=0
u=-2 or 4
Step 3
When u=−2
$\frac{t}{t+1}=-2$
t=-2(t+1)
t=-2t-2
t+2t=-2
3t=-2
$t=-\frac{2}{3}$
When u=4
$\frac{t}{t+1}=4$
t=4(t+1)
t=4t+4
t-4t=4
-3t=4
$t=-\frac{4}{3}$
Therefore, the values of t are


text:
# Implementation of Word2vec¶

This section is a practice exercise for the two previous sections. We use the skip-gram model from the “Word Embedding (word2vec)” section and negative sampling from the “Approximate Training” section as examples to introduce the implementation of word embedding model training on a corpus. We will also introduce some implementation tricks, such as subsampling and mask variables.

First, import the packages and modules required for the experiment.

In [1]:

import collections
import gluonbook as gb
import math
from mxnet import autograd, gluon, nd
from mxnet.gluon import data as gdata, loss as gloss, nn
import random
import sys
import time
import zipfile

## Process the Data Set¶

Penn Tree Bank (PTB) is a small commonly-used corpus[1]. It takes samples from Wall Street Journal articles and includes training sets, validation sets, and test sets. We will train the word embedding model on the PTB training set. Each line of the data set acts as a sentence. All the words in a sentence are separated by spaces.

In [2]:

with zipfile.ZipFile('../data/ptb.zip', 'r') as zin:
zin.extractall('../data/')

with open('../data/ptb/ptb.train.txt', 'r') as f:
# St is the abbreviation of "sentence" in the loop.
raw_dataset = [st.split() for st in lines]

'# sentences: %d' % len(raw_dataset)

Out[2]:

'# sentences: 42068'

For the first three sentences of the data set, print the number of words and the first five words of each sentence. The end character of this data set is “<eos>”, uncommon words are all represented by “<unk>”, and numbers are replaced with “N”.

In [3]:

for st in raw_dataset[:3]:
print('# tokens:', len(st), st[:5])

# tokens: 24 ['aer', 'banknote', 'berlitz', 'calloway', 'centrust']
# tokens: 15 ['pierre', '<unk>', 'N', 'years', 'old']
# tokens: 11 ['mr.', '<unk>', 'is', 'chairman', 'of']

### Create Word Index¶

For the sake of simplicity, we only keep words that appear at least 5 times in the data set.

In [4]:

# Tk is an abbreviation for "token" in the loop.
counter = collections.Counter([tk for st in raw_dataset for tk in st])
counter = dict(filter(lambda x: x[1] >= 5, counter.items()))

Then, map the words to the integer indexes.

In [5]:

idx_to_token = [tk for tk, _ in counter.items()]
token_to_idx = {tk: idx for idx, tk in enumerate(idx_to_token)}
dataset = [[token_to_idx[tk] for tk in st if tk in token_to_idx]
for st in raw_dataset]
num_tokens = sum([len(st) for st in dataset])
'# tokens: %d' % num_tokens

Out[5]:

'# tokens: 887100'

### Subsampling¶

In text data, there are generally some words that appear at high frequencies, such “the”, “a”, and “in” in English. Generally speaking, in a context window, it is better to train the word embedding model when a word (such as “chip”) and a lower-frequency word (such as “microprocessor”) appear at the same time, rather than when a word appears with a higher-frequency word (such as “the”). Therefore, when training the word embedding model, we can perform subsampling[2] on the words. Specifically, each indexed word $$w_i$$ in the data set will drop out at a certain probability. The dropout probability is given as:

$\mathbb{P}(w_i) = \max\left(1 - \sqrt{\frac{t}{f(w_i)}}, 0\right),$

Here, $$f(w_i)$$ is the ratio of the instances of word $$w_i$$ to the total number of words in the data set, and the constant $$t$$ is a hyper-parameter (set to $$10^{-4}$$ in this experiment). As we can see, it is only possible to drop out the word $$w_i$$ in subsampling when $$f(w_i) > t$$. The higher the word’s frequency, the higher its dropout probability.

In [6]:

def discard(idx):
return random.uniform(0, 1) < 1 - math.sqrt(
1e-4 / counter[idx_to_token[idx]] * num_tokens)

subsampled_dataset = [[tk for tk in st if not discard(tk)] for st in dataset]
'# tokens: %d' % sum([len(st) for st in subsampled_dataset])

Out[6]:

'# tokens: 376131'

As we can see, we have removed about half of the words after the second sampling. The following compares the number of times a word appears in the data set before and after subsampling. The sampling rate of the high-frequency word “the” is less than 1/20.

In [7]:

def compare_counts(token):
return '# %s: before=%d, after=%d' % (token, sum(
[st.count(token_to_idx[token]) for st in dataset]), sum(
[st.count(token_to_idx[token]) for st in subsampled_dataset]))

compare_counts('the')

Out[7]:

'# the: before=50770, after=2081'

But the low-frequency word “join” is completely preserved.

In [8]:

compare_counts('join')

Out[8]:

'# join: before=45, after=45'

### Extract Central Target Words and Context Words¶

We use words with a distance from the central target word not exceeding the context window size as the context words of the given center target word. The following definition function extracts all the central target words and their context words. It uniformly and randomly samples an integer to be used as the context window size between integer 1 and the max_window_size (maximum context window).

In [9]:

def get_centers_and_contexts(dataset, max_window_size):
centers, contexts = [], []
for st in dataset:
if len(st) < 2:  # Each sentence needs at least 2 words to form a "central target word - context word" pair.
continue
centers += st
for center_i in range(len(st)):
window_size = random.randint(1, max_window_size)
indices = list(range(max(0, center_i - window_size),
min(len(st), center_i + 1 + window_size)))
indices.remove(center_i)  # Exclude the central target word from the context words.
contexts.append([st[idx] for idx in indices])
return centers, contexts

Next, we create an artificial data set containing two sentences of 7 and 3 words, respectively. Assume the maximum context window is 2 and print all the central target words and their context words.

In [10]:

tiny_dataset = [list(range(7)), list(range(7, 10))]
print('dataset', tiny_dataset)
for center, context in zip(*get_centers_and_contexts(tiny_dataset, 2)):
print('center', center, 'has contexts', context)

dataset [[0, 1, 2, 3, 4, 5, 6], [7, 8, 9]]
center 0 has contexts [1, 2]
center 1 has contexts [0, 2, 3]
center 2 has contexts [0, 1, 3, 4]
center 3 has contexts [2, 4]
center 4 has contexts [2, 3, 5, 6]
center 5 has contexts [3, 4, 6]
center 6 has contexts [4, 5]
center 7 has contexts [8, 9]
center 8 has contexts [7, 9]
center 9 has contexts [8]

In the experiment, we set the maximum context window size to 5. The following extracts all the central target words and their context words in the data set.

In [11]:

all_centers, all_contexts = get_centers_and_contexts(subsampled_dataset, 5)

## Negative Sampling¶

We use negative sampling for approximate training. For a central and context word pair, we randomly sample $$K$$ noise words ($$K=5$$ in the experiment). According to the suggestion in the Word2vec paper, the noise word sampling probability $$\mathbb{P}(w)$$ is the ratio of the word frequency of $$w$$ to the total word frequency raised to the power of 0.75[2].

In [12]:

def get_negatives(all_contexts, sampling_weights, K):
all_negatives, neg_candidates, i = [], [], 0
population = list(range(len(sampling_weights)))
for contexts in all_contexts:
negatives = []
while len(negatives) < len(contexts) * K:
if i == len(neg_candidates):
# An index of k words is randomly generated as noise words based on the weight of each word (sampling_weights)
# . For efficient calculations, k can be set slightly larger.
i, neg_candidates = 0, random.choices(
population, sampling_weights, k=int(1e5))
neg, i = neg_candidates[i], i + 1
# Noise words cannot be context words.
if neg not in set(contexts):
negatives.append(neg)
all_negatives.append(negatives)
return all_negatives

sampling_weights = [counter[w]**0.75 for w in idx_to_token]
all_negatives = get_negatives(all_contexts, sampling_weights, 5)

We extract all central target words all_centers, and the context words all_contexts and noise words all_negatives of each central target word from the data set. We will read them in random mini-batches.

In a mini-batch of data, the $$i$$-th example includes a central word and its corresponding $$n_i$$ context words and $$m_i$$ noise words. Since the context window size of each example may be different, the sum of context words and noise words, $$n_i+m_i$$, will be different. When constructing a mini-batch, we concatenate the context words and noise words of each example, and add 0s for padding until the length of the concatenations are the same, that is, the length of all concatenations is $$\max_i n_i+m_i$$(max_len). In order to avoid the effect of padding on the loss function calculation, we construct the mask variable masks, each element of which corresponds to an element in the concatenation of context and noise words, contexts_negatives. When an element in the variable contexts_negatives is a padding, the element in the mask variable masks at the same position will be 0. Otherwise, it takes the value 1. In order to distinguish between positive and negative examples, we also need to distinguish the context words from the noise words in the contexts_negatives variable. Based on the construction of the mask variable, we only need to create a label variable labels with the same shape as the contexts_negatives variable and set the elements corresponding to context words (positive examples) to 1, and the rest to 0.

Next, we will implement the mini-batch reading function batchify. Its mini-batch input data is a list whose length is the batch size, each element of which contains central target words center, context words context, and noise words negative. The mini-batch data returned by this function conforms to the format we need, for example, it includes the mask variable.

In [13]:

def batchify(data):
max_len = max(len(c) + len(n) for _, c, n in data)
centers, contexts_negatives, masks, labels = [], [], [], []
for center, context, negative in data:
cur_len = len(context) + len(negative)
centers += [center]
contexts_negatives += [context + negative + [0] * (max_len - cur_len)]
masks += [[1] * cur_len + [0] * (max_len - cur_len)]
labels += [[1] * len(context) + [0] * (max_len - len(context))]
return (nd.array(centers).reshape((-1, 1)), nd.array(contexts_negatives),

We use the batchify function just defined to specify the mini-batch reading method in the DataLoader instance. Then, we print the shape of each variable in the first batch read.

In [14]:

batch_size = 512
num_workers = 0 if sys.platform.startswith('win32') else 4
dataset = gdata.ArrayDataset(all_centers, all_contexts, all_negatives)
batchify_fn=batchify, num_workers=num_workers)
for batch in data_iter:
for name, data in zip(['centers', 'contexts_negatives', 'masks',
'labels'], batch):
print(name, 'shape:', data.shape)
break

centers shape: (512, 1)
contexts_negatives shape: (512, 60)
labels shape: (512, 60)

## The Skip-Gram Model¶

We will implement the skip-gram model by using embedding layers and mini-batch multiplication. These methods are also often used to implement other natural language processing applications.

### Embedding Layer¶

The layer in which the obtained word is embedded is called the embedding layer, which can be obtained by creating an nn.Embedding instance in Gluon. The weight of the embedding layer is a matrix whose number of rows is the dictionary size (input_dim) and whose number of columns is the dimension of each word vector (output_dim). We set the dictionary size to 20 and the word vector dimension to 4.

In [15]:

embed = nn.Embedding(input_dim=20, output_dim=4)
embed.initialize()
embed.weight

Out[15]:

Parameter embedding0_weight (shape=(20, 4), dtype=float32)

The input of the embedding layer is the index of the word. When we enter the index $$i$$ of a word, the embedding layer returns the $$i$$th row of the weight matrix as its word vector. Below we enter an index of shape (2,3) into the embedding layer. Because the dimension of the word vector is 4, we obtain a word vector of shape (2,3,4).

In [16]:

x = nd.array([[1, 2, 3], [4, 5, 6]])
embed(x)

Out[16]:

[[[ 0.01438687  0.05011239  0.00628365  0.04861524]
[-0.01068833  0.01729892  0.02042518 -0.01618656]
[-0.00873779 -0.02834515  0.05484822 -0.06206018]]

[[ 0.06491279 -0.03182812 -0.01631819 -0.00312688]
[ 0.0408415   0.04370362  0.00404529 -0.0028032 ]
[ 0.00952624 -0.01501013  0.05958354  0.04705103]]]
<NDArray 2x3x4 @cpu(0)>

### Mini-batch Multiplication¶

We can multiply the matrices in two mini-batches one by one, by the mini-batch multiplication operation batch_dot. Suppose the first batch contains $$n$$ matrices $$\boldsymbol{X}_1, \ldots, \boldsymbol{X}_n$$ with a shape of $$a\times b$$, and the second batch contains $$n$$ matrices $$\boldsymbol{Y}_1, \ldots, \boldsymbol{Y}_n$$ with a shape of $$b\times c$$. The output of matrix multiplication on these two batches are $$n$$ matrices $$\boldsymbol{X}_1\boldsymbol{Y}_1, \ldots, \boldsymbol{X}_n\boldsymbol{Y}_n$$ with a shape of $$a\times c$$. Therefore, given two NDArrays of shape ($$n$$, $$a$$, $$b$$) and ($$n$$, $$b$$, $$c$$), the shape of the mini-batch multiplication output is ($$n$$, $$a$$, $$c$$).

In [17]:

X = nd.ones((2, 1, 4))
Y = nd.ones((2, 4, 6))
nd.batch_dot(X, Y).shape

Out[17]:

(2, 1, 6)

### Skip-gram Model Forward Calculation¶

In forward calculation, the input of the skip-gram model contains the central target word index center and the concatenated context and noise word index contexts_and_negatives. In which, the center variable has the shape (batch size, 1), while the contexts_and_negatives variable has the shape (batch size, max_len). These two variables are first transformed from word indexes to word vectors by the word embedding layer, and then the output of shape (batch size, 1, max_len) is obtained by mini-batch multiplication. Each element in the output is the inner product of the central target word vector and the context word vector or noise word vector.

In [18]:

def skip_gram(center, contexts_and_negatives, embed_v, embed_u):
v = embed_v(center)
u = embed_u(contexts_and_negatives)
pred = nd.batch_dot(v, u.swapaxes(1, 2))
return pred

## To train a model¶

Before training the word embedding model, we need to define the loss function of the model.

### Binary Cross Entropy Loss Function¶

According to the definition of the loss function in negative sampling, we can directly use Gluon’s binary cross entropy loss function SigmoidBinaryCrossEntropyLoss.

In [19]:

loss = gloss.SigmoidBinaryCrossEntropyLoss()

It is worth mentioning that we can use the mask variable to specify the partial predicted value and label that participate in loss function calculation in the mini-batch: when the mask is 1, the predicted value and label of the corresponding position will participate in the calculation of the loss function; When the mask is 0, the predicted value and label of the corresponding position do not participate in the calculation of the loss function. As we mentioned earlier, mask variables can be used to avoid the effect of padding on loss function calculations.

In [20]:

pred = nd.array([[1.5, 0.3, -1, 2], [1.1, -0.6, 2.2, 0.4]])
# 1 and 0 in the label variables label represent context words and the noise words, respectively.
label = nd.array([[1, 0, 0, 0], [1, 1, 0, 0]])
mask = nd.array([[1, 1, 1, 1], [1, 1, 1, 0]])  # Mask variable.

Out[20]:

[0.8739896 1.2099689]
<NDArray 2 @cpu(0)>

Next, as a comparison, we will implement binary cross-entropy loss function calculation from scratch and calculate the predicted value with a mask of 1 and the loss of the label based on the mask variable mask.

In [21]:

def sigmd(x):
return -math.log(1 / (1 + math.exp(-x)))

print('%.7f' % ((sigmd(1.5) + sigmd(-0.3) + sigmd(1) + sigmd(-2)) / 4))
print('%.7f' % ((sigmd(1.1) + sigmd(-0.6) + sigmd(-2.2)) / 3))

0.8739896
1.2099689

### Initialize Model Parameters¶

We construct the embedding layers of the central and context words, respectively, and set the hyper-parameter word vector dimension embed_size to 100.

In [22]:

embed_size = 100
net = nn.Sequential()
nn.Embedding(input_dim=len(idx_to_token), output_dim=embed_size))

### Training¶

The training function is defined below. Because of the existence of padding, the calculation of the loss function is slightly different compared to the previous training functions.

In [23]:

def train(net, lr, num_epochs):
ctx = gb.try_gpu()
net.initialize(ctx=ctx, force_reinit=True)
{'learning_rate': lr})
for epoch in range(num_epochs):
start_time, train_l_sum = time.time(), 0
for batch in data_iter:
center, context_negative, mask, label = [
data.as_in_context(ctx) for data in batch]
pred = skip_gram(center, context_negative, net[0], net[1])
# Use the mask variable to avoid the effect of padding on loss function calculations.
l = (loss(pred.reshape(label.shape), label, mask) *
l.backward()
trainer.step(batch_size)
train_l_sum += l.mean().asscalar()
print('epoch %d, train loss %.2f, time %.2fs'
% (epoch + 1, train_l_sum / len(data_iter),
time.time() - start_time))

Now, we can train a skip-gram model using negative sampling.

In [24]:

train(net, 0.005, 8)

epoch 1, train loss 0.46, time 8.64s
epoch 2, train loss nan, time 8.32s
epoch 3, train loss nan, time 8.32s
epoch 4, train loss nan, time 8.30s
epoch 5, train loss nan, time 8.30s
epoch 6, train loss nan, time 8.31s
epoch 7, train loss nan, time 8.36s
epoch 8, train loss nan, time 8.31s

## Applying the Word Embedding Model¶

After training the word embedding model, we can represent similarity in meaning between words based on the cosine similarity of two word vectors. As we can see, when using the trained word embedding model, the words closest in meaning to the word “chip” are mostly related to chips.

In [25]:

def get_similar_tokens(query_token, k, embed):
W = embed.weight.data()
x = W[token_to_idx[query_token]]
cos = nd.dot(W, x) / nd.sum(W * W, axis=1).sqrt() / nd.sum(x * x).sqrt()
topk = nd.topk(cos, k=k+1, ret_typ='indices').asnumpy().astype('int32')
for i in topk[1:]:  # Remove the input words.
print('cosine sim=%.3f: %s' % (cos[i].asscalar(), (idx_to_token[i])))

get_similar_tokens('chip', 3, net[0])

cosine sim=nan: <unk>
cosine sim=nan: N
cosine sim=nan: years

## Summary¶

• We can use Gluon to train a skip-gram model through negative sampling.
• Subsampling attempts to minimize the impact of high-frequency words on the training of a word embedding model.
• We can pad examples of different lengths to create mini-batches with examples of all the same length and use mask variables to distinguish between padding and non-padding elements, so that only non-padding elements participate in the calculation of the loss function.

## Problems¶

• We use the batchify function to specify the mini-batch reading method in the DataLoader instance and print the shape of each variable in the first batch read. How should these shapes be calculated?
• Try to find synonyms for other words.
• Tune the hyper-parameters and observe and analyze the experimental results.
• When the data set is large, we usually sample the context words and the noise words for the central target word in the current mini-batch only when updating the model parameters. In other words, the same central target word may have different context words or noise words in different epochs. What are the benefits of this sort of training? Try to implement this training method.

## Reference¶

[1] Penn Tree Bank. https://catalog.ldc.upenn.edu/ldc99t42

[2] Mikolov, T., Sutskever, I., Chen, K., Corrado, G. S., & Dean, J. (2013). Distributed representations of words and phrases and their compositionality. In Advances in neural information processing systems (pp. 3111-3119).


text:
0/8
##### Examples
###### Lessons
1. Solving Radical Equations Involving One Square Root Term
Solve:
1. $3\sqrt {x - 2} + x = 0$
(hint: no solutions)
2. $x - 2 = 2\sqrt {x + 1}$
(hint: one solutions)
3. $x + \sqrt {2{x^2} - 7} = 3$
(hint: two solutions)
4. $\sqrt {x + 9} - 10 = - 8$
(hint: one solutions)
2. Solving Radical Equations Involving More than One Square Root Term
Solve:
1. $\sqrt{3x+4}-\sqrt{x+1}=3$
(hint: one solutions)
2. $\sqrt{x-2}+3=\sqrt{2x+5}$
(hint: two solutions)
3. $\sqrt{x-4}+\sqrt{x}=4$
(hint: one solutions)
4. $\sqrt{5x+20}=\sqrt{x+8}+\sqrt{x+3}$
(hint: two solutions)
###### Free to Join!
StudyPug is a learning help platform covering math and science from grade 4 all the way to second year university. Our video tutorials, unlimited practice problems, and step-by-step explanations provide you or your child with all the help you need to master concepts. On top of that, it's fun - with achievements, customizable avatars, and awards to keep you motivated.
• #### Easily See Your Progress

We track the progress you've made on a topic so you know what you've done. From the course view you can easily see what topics have what and the progress you've made on them. Fill the rings to completely master that section or mouse over the icon to see more details.
• #### Make Use of Our Learning Aids

###### Practice Accuracy

See how well your practice sessions are going over time.

Stay on track with our daily recommendations.

• #### Earn Achievements as You Learn

Make the most of your time as you use StudyPug to help you achieve your goals. Earn fun little badges the more you watch, practice, and use our service.
• #### Create and Customize Your Avatar

Play with our fun little avatar builder to create and customize your own avatar on StudyPug. Choose your face, eye colour, hair colour and style, and background. Unlock more options the more you use StudyPug.
###### Topic Notes
Radical equations are equations that have variables stunk inside a radical. We will show you how to solve this type of equations in this lesson.
3-step approach for solving radical equations:

1) Isolate the "square root" term.

2) i. Square both sides of the equation to get rid of the "square root".

ii. (optional) If the resulting equation still has a "square root" term, repeat steps 1 and 2.

3) Solve the equation, and REMEMBER to substitute answers back into the original equation to identify any EXTRANEOUS ROOTS,


text:
by glebovg
 P: 164 1. The problem statement, all variables and given/known data By substituting the wave function $\psi (x) = Ax{e^{ - bx}}$ into the Schoedinger equation for a 1-D atom, show that a solution can be obtained for $b = 1/{a_0}$, where ${a_0}$ is the Bohr radius. 2. Relevant equations $- \frac{{{\hbar ^2}}}{{2m}}\frac{{{d^2}\psi (x)}}{{d{x^2}}} - \frac{{{e^2}}}{{4\pi {\varepsilon _0}x}}\psi (x) = E\psi (x)$. ${a_0} = \frac{{4\pi {\varepsilon _0}{\hbar ^2}}}{{m{e^2}}}$ 3. The attempt at a solution I get to the point where $2b - x{b^2} = \frac{{2m}}{{{\hbar ^2}}}Ex + \frac{m}{{{\hbar ^2}}}\frac{{{e^2}}}{{2\pi {\varepsilon _0}}}$. If I let x = 0 I get the desired result. Can I do that? Apparently the wave function solving the equation must satisfy two conditions: $\psi (x) \to 0$ as $x \to \infty$ $\psi (0) = 0$ But why is that? Can anyone explain?
P: 281
 Quote by glebovg $\psi (x) \to 0$ as $x \to \infty$ $\psi (0) = 0$ But why is that? Can anyone explain?
The first condition is necessary because the wavefunction must be normalisable. Meaning it must have a finite integral over all space. If it tended to anything other than 0, then this would not be the case.

The second condition is necessary because you are talking about an atom. Atoms have a positive nucleus. There is no probability of finding an electron at exactly the centre of the nucleus.
 P: 164 Can you help? How do I show that $b = 1/{a_0}$? What should E be? Also, how to derive the expression for the ground state energy?
P: 281

You need to recognise that in the ground state $x = a_0 = 1/b$ and therefore $E = -\frac{b^2 \hbar^2}{2m}$. Thus you can cancel the terms for $x$ from the equation and calculate the bohr radius by plugging in known values of the constants. This also leaves you with an equation for calculating the ground state energy.


text:
Please use this identifier to cite or link to this item: https://hdl.handle.net/10356/73206
 Title: Sparse tensor product finite element method for some linear and nonlinear multiscale problems Authors: Tan, Wee Chin Keywords: DRNTU::Science::Mathematics Issue Date: 2018 Source: Tan, W. C. (2018). Sparse tensor product finite element method for some linear and nonlinear multiscale problems. Doctoral thesis, Nanyang Technological University, Singapore. Abstract: Partial differential equations with multiple scales arise from a wide range of scientific and engineering problems, such as composite materials, oil flow and seismology. Solving multiscale partial differential equations are extremely difficult. Traditionally, numerical methods have to use a mesh size that is at most the order of the smallest scale to extract all the information in the microscopic scale. There has been extensive work to study multiscale partial differential equations and develop numerical methods to approximate the solutions. Although there is a large literature on the topic, there are still many challenges and open problems. This thesis contributes novel essentially optimal numerical methods for solving locally periodic multiscale monotone parabolic problems, multiscale linear and nonlinear equations that depend on microscopic scales in both space and time, and multiscale nonlinear monotone variational inequalities. We develop the sparse tensor product finite element (FE) method to approximate the solutions to the problems. The method approximates all the necessary microscopic and macroscopic information with a prescribed accuracy using an essentially optimal number of degrees of freedom. For locally periodic problems, this is better than other methods available in the literature. Chapter 2 studies linear parabolic equations that depend on a microscopic time scale and a microscopic spatial scale. We consider the most interesting critical similarity case where the derivative with respect to the fast time variable plays a role in the cell problems. Using multiscale convergence, we deduce a high dimensional multiscale homogenized equation that provides the solution to the homogenized equation, which provides the macroscopic information, and the time-space corrector term, which encodes the microscopic information. We develop the sparse tensor product FE method for solving this time-space multiscale homogenized equation. The method provides an approximation to all the necessary information with a required accuracy, using an essentially optimal number of degrees of freedom. From the FE solution of the time-space multiscale homogenized equation, we construct a numerical corrector for the solution of the original time-space multiscale equation. Chapter 3 develops a new method for solving monotone parabolic equations that depend on $n$ separable microscopic scales. For nonlinear problems, forming the homogenized equation is practically impossible, as for each vector in $\spa$, we have to solve a nonlinear monotone cell problem. Applying multiscale convergence, we obtain a high dimensional multiscale homogenized equation which when solved, the solution will provide the necessary macroscopic and microscopic information. We develop the backward Euler and Crank-Nicholson methods for sparse tensor product FE spaces. In both approaches, the sparse tensor product FE method provides an approximation with an essentially optimal level of accuracy, but uses an essentially optimal number of degrees of freedom. For two scale problems, a new homogenization error is derived in terms of the microscopic scale. A numerical corrector is deduced with an explicit error. For general multiscale problems, a numerical corrector is derived, without an explicit error. This is because of the unavailability of a homogenization error. Chapter 4 considers multiscale monotone parabolic equations which depend on a microscopic time scale and a microscopic spatial scale. As in Chapter \ref{chap:chapter2}, we consider the most interesting case when the derivative with respect to the fast time variable plays a part in the limiting equation. Applying multiscale convergence, a high dimensional multiscale homogenized equation is obtained. This chapter develops a new numerical method to solve the multiscale monotone parabolic problems with an essentially equal level of accuracy as the full tensor product FE method. The backward Euler and Crank-Nicholson methods are developed for the sparse tensor product FE spaces. The sparse tensor product FE method uses an essentially optimal number of degree of freedom to get an approximation with the desired level of accuracy. A numerical corrector is also derived from the FE solutions. Chapter 5 studies locally periodic multiscale variational inequalities which depend on a macroscopic and $n$ microscopic scales. Using multiscale convergence, we deduce a multiscale homogenized variational inequality in a high dimensional tensorized domain. To the best of our knowledge, numerical method for multiscale variational inequalities have not been developed. We develop the sparse tensor product FE method for locally periodic multiscale problems which attains an essentially equal level of accuracy to that of the full tensor product FE method but requires only an essentially optimal number of degrees of freedom which is essentially equal to that for solving a problem in $\spa$. In the two scale case, we deduce a new homogenization error for the nonlinear monotone variational inequalities. A numerical corrector is constructed with an explicit error in terms of the FE error and the homogenization error. In the multiscale case, we construct a numerical corrector without an explicit error. In all the chapters, we apply the methods developed to solve some multiscale problems numerically to verify the theory. URI: http://hdl.handle.net/10356/73206 DOI: 10.32657/10356/73206 Fulltext Permission: open Fulltext Availability: With Fulltext Appears in Collections: SPMS Theses

###### Files in This Item:
File Description SizeFormat

#### Page view(s) 50

173
Updated on Jan 27, 2021

67
Updated on Jan 27, 2021


text:
# Diffeomorphism mapping interior point to boundary point of manifolds with boundary

Why can a diffeomorphism $F: M \to N$ between two smooth manifolds with boundary not take an interior point of $M$ to a boundary point of $N$?

Let $(U, \varphi)$ be a smooth chart for $M$, $(V, \psi)$ a smooth chart for $N$. I believe it is because it would cause $(\psi \circ F \circ \varphi^{-1}): \varphi(U) \to \psi(V)$ to be a diffeomorphism between an open set in $\mathbb{R}^n$ and an open set in $\mathbb{H}^n$ such that its intersection with $\partial \mathbb{H}^n$ is nonempty, and this cannot be. However, I don't know how to prove this. Any help would be appreciated

A diffeomorphism is in particular a homeomorphism, so a neighbourhood of a point must be mapped to a homeomorphic neighbourhood of the image of the point. In particular, it cannot take interior points to boundary points since they have non-homeomorphic neighbourhoods.

• Ah, I think I see my confusion. Lee's Smooth Manifolds never explicitly says the nbds of the different kinds of points are not homeomorphic but he says that a point can never be both kinds of points, which is effectively saying the above. Thanks. – Emilio Minichiello Sep 20 '18 at 14:31
• @EmilioMinichiello: Javi's answer is correct (and I've upvoted) - but do you know how to prove they have non-homeomorphic neighborhoods? (And I wouldn't say they are non-homeomorphic by definition. They are certainly presented differently, but that doesn't rule out some kind of weird homeomorphism. The usual trick is local homology.) – Jason DeVito Sep 20 '18 at 14:32
• I'm on Chapter 2 of Smooth Manifolds, Lee doesn't give us the proof that the nbds are non-homeomorphic. He only says that a point cannot be a boundary point and an interior point simultaneously, and that every smooth chart will map a boundary point to the boundary of $\mathbb{H}^n$. I'm trying to understand how this implies that $F(\text{Int}M) = \text{Int}N$. – Emilio Minichiello Sep 20 '18 at 14:39

The usual proof that neighborhoods that intersect $\partial\mathbb{H}$ are distinct from neighborhoods uses the local homology groups $H^\ast(M,M\setminus\{p\})$ for different choices of $p$. It has the advantage of showing that a homeomorphism must map boundary to boundary and interior to interior.

Suppose $f:M\rightarrow N$ is a diffeomorphism and that $p\in \operatorname{int} M$ and $f(p)\in \partial N$. Then $d_p f:T_p M\rightarrow T_{f(p)} N$ must be an isomorphism.

But I claim that is not. To see this, pick a $w\in T_{f(p)}$ which points outside of $N$. I claim there is no $v\in T_p M$ with $d_p f(v) = w$.

To see this, suppose there is such a $v$, choose a smooth path $\gamma_v:(-\epsilon,\epsilon)\rightarrow M$ with $\gamma_v(0) = p$ and $\gamma_v'(0) = v$. Then $f\circ\gamma$ is a smooth curve in $N$. By picking a chart near $f(p)$, we can view all this as happening in $\mathbb{R}^n$.

So, without loss of generality, we have a curve $\gamma$ for which $\gamma(0) = \vec{0}\in \mathbb{R}^n$, $\gamma\subseteq H =\{(x_1,...,x_n)\in \mathbb{R}^n: x_n\leq 0\}$, but $\gamma'(0) \notin H$. That is, the $n$th coordinate of $\gamma'(0)$ is positive.

Since $\gamma$ is smooth, $\gamma'$ is continuous, so the $n$-th coordinate of $\gamma'(t)$ is positive in a neighborhood of $0$. But now the mean value theorem applied to the $n$th coordinate of $\gamma$ implies that $\gamma(t)\notin H$ for small $t$ with $t>0$.

• I like to generalize a little bit, which sometimes helps people see the point. To any shape in $\Bbb R^m$ there is a tangent cone at any given point, consisting of those tangent vectors you can obtain as the derivative of some curve in the shape. Now it is a quick exercise to verify that diffeomorphisms preserve tangent cones. This shows interior and boundary points differ, but also cone points, and that not all cone points are the same... – user98602 Sep 20 '18 at 18:47
• PS. I wonder what the odds are we will ever be at the same conference? We are a little too far from each other's orbit to make it too likely. One can hope... – user98602 Sep 20 '18 at 22:42
• I do not have something like that, but I'll send you an email to start the chain. Also, I'm going to delete my unrelated comments after you see them (as they are not much help to the OP!) – user98602 Sep 21 '18 at 17:20


text:
## partial derivative of metric tensor

v r ( On a Riemannian manifold, the curve connecting two points that (locally) has the smallest length is called a geodesic, and its length is the distance that a passenger in the manifold needs to traverse to go from one point to the other. When that varies in a smooth (or differentiable) manner from point to point. In the above coordinates, the matrix representation of η is, (An alternative convention replaces coordinate The resulting natural positive Borel measure allows one to develop a theory of integrating functions on the manifold by means of the associated Lebesgue integral. 0 M t to give a real number: This is a generalization of the dot product of ordinary Euclidean space. DefMetric@1,metrich@-a,-bD,cd, 8"È","D"<,InducedFrom® 8metricg,n<,PrintAs->"h"D. DefMetric::old : There are already metrics 8metricg

Filed Under: Informações

## Comentários

nenhum comentário

Nome *

E-mail*

Website


text:
THEMATIC PROGRAMS

July 23, 2018
THE FIELDS INSTITUTE FOR RESEARCH IN MATHEMATICAL SCIENCES
 January-June 2014 Thematic Program on Abstract Harmonic Analysis, Banach and Operator Algebras Coxeter Lecture Series May 27,28,29, 2014 at 3:30 p.m. Fields Institute, Room 230 Sorin Popa University of California, Los Angeles On $\text{II}_1$ factors arising from free groups acting on spaces

 Thematic Program Home Page Video of the talks will be available at FieldsLive Distinguished and Coxeter Lecturers
 On $\text{II}_1$ factors arising from free groups acting on spaces A famous problem going back to Murray and von Neumann (1936-1943), asks whether the $\text{II}_1$ factors $L(\Bbb F_n)$, obtained as the centralizers in ${\cal B}(\ell^2 \Gamma)$ of the left regular representation of the free groups on $n$ generators, are non-isomorphic for different $n$. While this is still open, its "group measure space" version, asking whether the crossed product $\text{II}_1$ factors $L^\infty(X)\rtimes \Bbb F_n$, arising from free ergodic probability measure preserving actions $\Bbb F_n\curvearrowright X$, are non-isomoprphic for $n= 2, 3, ...$, independently of the actions, has recently been settled by Stefaan Vaes and myself. I will comment on this result, as well as on some related problems. Speakers in the Distinguished and Coxeter Lecture Series have made outstanding contributions to their field of mathematics. The Lecture Sereies consists of three one-hour lectures.