text:
# Definition:Zero Matrix

## Definition

Let $\Bbb F$ be one of the standard number system $\N$, $\Z$, $\Q$, $\R$ and $\C$.

Let $\map \MM {m, n}$ be an $m \times n$ matrix space over $\Bbb F$.

The zero matrix of $\map \MM {m, n}$, denoted $\mathbf 0$, is the $m \times n$ matrix whose elements are all zero, and can be written $\sqbrk 0_{m n}$.

### Ring

Let $\struct {R, +, \circ}$ be a ring whose zero is $0_R$.

Let $\map {\MM_R} {m, n}$ be an $m \times n$ matrix space over $R$.

The zero matrix of $\map {\MM_R} {m, n}$, denoted $\mathbf 0_R$, is the $m \times n$ matrix whose elements are all $0_R$, and can be written $\sqbrk {0_R}_{m n}$.

### General Monoid

Let $\struct {S, \circ}$ be a monoid whose identity is $e$.

Let $\map {\MM_S} {m, n}$ be an $m \times n$ matrix space over $S$.

The zero matrix of $\map {\MM_S} {m, n}$, denoted $\mathbf e$, is the $m \times n$ matrix whose elements are all $e$, and can be written $\sqbrk e_{m n}$.

## Also denoted as

Some sources present the zero matrix as $\mathbf O$, that is, using the letter $\text O$, rather than the number $\mathbf 0$, that is, the zero digit.

## Also known as

Some sources refer to the zero matrix as the null matrix.

format: plain


text:
# Help:Editor FAQ

See Help:Contents for all help pages

# Scholarwiki

## What is a "category"? What is an "Encyclopedia of.."?

An encyclopedia in Scholarpedia is a portal article (web page) containing lists of articles/authors on a given topic and other useful information. This page is edited and manually maintained by its editor: nothing there is added automatically.

In Scholarpedia categories are keywords (also) used to label articles related to the same topic.

An article belongs to category C iff its source page contains the token [[Category:C]].

For each category, a category page is automatically created. For a category C the category page is located at http://www.scholarpedia.org/article/Category:C. The category page automatically shows at its bottom links to all the pages in that category (i.e. having  [[Category:C]] in the text). The top of a category page can be edited as usual. In Scholarpedia you can link to the page of say category "Physics" by adding to the text the token  [[:Category:Physics|text to be displayed]] (note the leading ":")

A category D is a subcategory of a category C iff the category page of D contains the token [[Category:C]] (just as with article pages). Articles belonging to subcategory do not automatically belong to the parent category (if you want that you should add [[Category:parent category name]] to each article in the subcategory).

## How can I delete a page?

You cannot. Just empty all its contents and categories, and add the tag [[Category:Delete this page]]. The editor-in-chief will delete the page for you.

## How I create super-categories and sub-categories of my category?

To include your category into a bigger category, just edit your category page and list all the "bigger" categories you would like it to be included,
by writing [[Category:BiggerCategoryName_1]] [[Category:BiggerCategoryName_2]] and so on.

In this sense, categories are treated as just articles.

## Should I add [[Category:Scholarpedia]] to the articles in my category?

NO. This is a temporary category for articles that will have their own categories when an appropriate editor is found and the appropriate encyclopedia is initiated.

FIXME

## How can I find if a potential author or reviewer already has a username

To check whether a potential author or reviewer already has a username in Scholarpedia, go to user list and find the username of that person. Alternatively, you can find any person by typing his/her last name in the search window and pressing 'Title' button. If the person with such a username exists, you will see the link 'User:<lastname>'. The person may have a different username, so there is a line "See all users with names/affiliations containing ...". Follow this line.

## There is a misprint in the username of some user: shall I create another account?

NO: just inform the user or contact support@scholarpedia.org.

FIXME

# Editorial activity

## In my communication with the authors, which email account should I use?

Editors should use their own email accounts for all communications with authors. They do not need to forward their correspondence to the editor-in-chief, unless they think that the editor-in-chief should be aware of it (to avoid potential conflicts with future invitations, etc.).

## Can editors see the suggestions that are sent to suggestions@scholarpedia.org?

All the suggestions by the general public are mailed to the editor-in-chief, who then sends invitations. Since presently, the suggestions are restricted to eponymous articles, the invitation process is quick (no need to do the homework to find "the original inventor"). If a suggested article overlaps with any of the categories for which there is an editor, the editor-in-chief tries to contact the corresponding editor.

## How should I proceed if an author does not answer and I'd like to invite a co-author?

If the author agreed to write an article, you cannot invite a co-author without the author's approval. What if he/she does not want a co-author or does not want this particular person? Thus, if the author does not answer your emails, there is nothing you can do. If the author ignores your requests at all, then you should cancel the original invitation and invite another person - apparently the author is not serious to work with you on this article.

## An author requests more time to finish the article: should I change his deadline? How?

It is often helpful to give authors extra time to finish an article, although the sponsor of the article should make this decision. You can update the deadline by going to the article, looking at the last box in the editorial banner that says "Deadline", and then clicking on the "(update)" link. You can also email support@scholarpedia.org.

## May I invite referees for an article that is not yet submitted for refereeing?

You should wait until the article is ready before inviting referees.

## A submitted article needs to be prettified (references, titles, equations), shall I do it myself?

You are certainly welcome to make such changes, although Assistant Editors would also be available for this task. Email support@scholarpedia.org to connect with assistant editors.

## Do we have some reviewer instructions?

Yes, they are available at http://www.scholarpedia.org/article/Help:Reviewers .

## May I invite more than 2 referees?

YES. Any number of reviewers could be invited. However, the authors should be willing to incorporate suggestions from reviewers that respond in a reasonable time-frame. If an invited referee doesn't respond to the initial request, it is often helpful to follow up after a week by emailing the reviewer directly. You may want to aim to have 3 referees, so that if one referee is not able to respond in a reasonable amount of time, the publication of the article is not significantly delayed.

No. Keep the empty sections. They are needed to comply with the Scholarpedia standard. Instead of deleting, it is better to provide links there for other relevant articles (in "See also" section) or contact the author and ask to provide further reading material.

## I need to create a test page to use in my editorial activity: how/where to create it?

If you are user X, create it as e.g.: User:X/sandbox.

## How long shall I wait for an invited reviewer?

It is up to the editor to set the time-frame for an invited reviewer. That said, one month after the reviewer accepts the role is often considered a reasonable time. If a reviewer takes longer than one month, the editor should certainly touch base with the reviewer.

## A reviewer asks me for more time to do his job: what/how to do?

You may invite another reviewer if you think it may be beneficial, otherwise, the main thing that needs to be done is to make sure that the article doesn't expire in the mean time.

## What should an author do to approve the final version of an article (after referee approval)?

There is a 7-day editorial period, where the authors need to wait before the publication. After this time, one of the authors needs to click on the "publish" button in the editorial banner that appears at the top of the article.

## Who are the people acknowledged at the bottom of the article?

The person who sponsors the article and the reviewers are acknowledge at the bottom of the article.


text:
Killing space

$( X , n )$

A fibre space $p _ {n} : ( X , n ) \rightarrow X$ for which the homotopy groups $\pi _ {i} ( X , n )$ vanish if $i < n$, and $p _ {n*} : \pi _ {i} ( X , n ) \rightarrow \pi _ {i} ( X)$ is an isomorphism if $i \geq n$. The space $( X , n )$ is constructed by induction with respect to $n$. If $( X , n - 1 )$ has already been constructed, then $( X , n )$ is taken to be the homotopy fibre of the canonical mapping

$$( X , n - 1 ) \rightarrow K ( \pi _ {n-} 1 ( X) , n - 1 ) ,$$

$K ( \pi _ {n-} 1 ( X) , n - 1 )$ denoting an Eilenberg–MacLane space. The sequence of spaces $( X , n )$ and mappings $p _ {n}$ is a Moore–Postnikov system of the mapping $* \rightarrow X$.


text:
8 added 14 characters in body; edited body

Let $X = \prod _{s \in S} \Omega_s$, with $\Omega_s$ finite and all the same, $S$ countable. Let $\mu_1$ and $\mu_2$ be two probability measures on the product space (not necessarily the product measure). Let $C$ be a coupling between the two measures and let's define,

$$rift(C) = sup_{s \in S}\lbrace \mbox{ } C \mbox{ } \mbox{ } \lbrace ( \omega^1, \omega^2 ) \in X \times X \ \text{ s.t. } \omega^1_s \neq \omega^2_s \mbox{ } \rbrace \mbox{ } \mbox{ } \rbrace.$$

Then we call distance between the two measures $dist(\mu_1, \mu_2)$ the infimum over all the possible couplings $c$ of the previous quantity.

How can I prove that, if A is a cylinder subset of $X$, specified by $r$ components $\omega_i$, then $\forall \mu_1, \mu_2$ probability measures as before, $$|\mu_1(A) - \mu_2(A)| \leq r \mbox{ } dist(\mu_1, \mu_2)$$

Definition: the coupling is not necessarily the product between the two measures. Let's consider two measures $\mu^1$ and $\mu^2$, acting each one on the $\sigma$-algebra of subsets of $X$. The coupling $C$ is any measure acting on the $\sigma$-algebra of subsets of $X^1 \times X^2$, with $X^i = X$, which has as marginals $\mu^1$ and $\mu^2$, i.e. $\mu^1 = C \circ \pi^{-1}_1$, $\mu^2 = C \circ \pi^{-1}_2$, where $\pi_i$ is the projection $\pi_i : X^1 \times X^2 \longrightarrow X^i$.

7 deleted 2 characters in body

Let $X = \prod _{s \in S} \Omega_s$, with $\Omega_s$ finite and all the same, $S$ countable. Let $\mu_1$ and $\mu_2$ be two probability measures on the product space (not necessarily the product measure). Let $C$ be a coupling between the two measures and let's define,

$$rift(C) = sup_{s \in S}\lbrace \mbox{ } C \mbox{ } ( \mbox{ } \lbrace \omega^1, \omega^2 \in X\ \text{ s.t. } \omega^1_s \neq \omega^2_s \mbox{ } \rbrace) rbrace \mbox{ } \mbox{ } \rbrace.$$

Then we call distance between the two measures $dist(\mu_1, \mu_2)$ the infimum over all the possible couplings $c$ of the previous quantity.

How can I prove that, if A is a cylinder subset of $X$, specified by $r$ components $\omega_i$, then $\forall \mu_1, \mu_2$ probability measures as before, $$|\mu_1(A) - \mu_2(A)| \leq r \mbox{ } dist(\mu_1, \mu_2)$$

Definition: the coupling is not necessarily the product between the two measures. Let's consider two measures $\mu^1$ and $\mu^2$, acting each one on the $\sigma$-algebra of subsets of $X$. The coupling $C$ is any measure acting on the $\sigma$-algebra of subsets of $X^1 \times X^2$, with $X^i = X$, which has as marginals $\mu^1$ and $\mu^2$, i.e. $\mu^1 = C \circ \pi^{-1}_1$, $\mu^2 = C \circ \pi^{-1}_2$, where $\pi_i$ is the projection $\pi_i : X^1 \times X^2 \longrightarrow X^i$.

6 edited body

Let $X = \prod _{s \in S} \Omega_s$, with $\Omega_s$ finite and all the same, $S$ countable. Let $\mu_1$ and $\mu_2$ be two probability measures on the product space (not necessarily the product measure). Let $C$ be a coupling between the two measures and let's define,

$$rift(crift(C) = sup_{s \in S}\lbrace \mbox{ } C \mbox{ } ( \mbox{ } \lbrace \omega^1, \omega^2 \in X\ \text{ s.t. } \omega^1_s \neq \omega^2_s \mbox{ } \rbrace) \mbox{ } \mbox{ } \rbrace.$$

Then we call distance between the two measures $dist(\mu_1, \mu_2)$ the infimum over all the possible couplings $c$ of the previous quantity.

How can I prove that, if A is a cylinder subset of $X$, specified by $r$ components $\omega_i$, then $\forall \mu_1, \mu_2$ probability measures as before, $$|\mu_1(A) - \mu_2(A)| \leq r \mbox{ } dist(\mu_1, \mu_2)$$

Definition: the coupling is not necessarily the product between the two measures. Let's consider two measures $\mu^1$ and $\mu^2$, acting each one on the $\sigma$-algebra of subsets of $X$. The coupling $C$ is any measure acting on the $\sigma$-algebra of subsets of $X^1 \times X^2$, with $X^i = X$, which has as marginals $\mu^1$ and $\mu^2$, i.e. $\mu^1 = C \circ \pi^{-1}_1$, $\mu^2 = C \circ \pi^{-1}_2$, where $\pi_i$ is the projection $\pi_i : X^1 \times X^2 \longrightarrow X^i$.

5 added 70 characters in body
4 deleted 135 characters in body
3 added 583 characters in body
2 rift -> dist
1


text:
# If the last 3 digits of $2012^m$ and $2012^n$ are identical, find the smallest possible value of $m+n$.

Let $m$ and $n$ be positive integers such that $m>n$. If the last 3 digits of $2012^m$ and $2012^n$ are identical, find the smallest possible value of $m+n$.

Since the 100's digit is 0 in both cases, I just did $2012^m \equiv 2012^n \mod 1000$, and got $12^m \equiv 12^n\mod 1000$ but I'm not sure where to go from there. Trying to compute the first few powers of $12$ will only get the numbers larger and the pattern doesn't seem to emerge that soon.

• You can reduce result to last $3$ digits each step: for example, $12^{10}\equiv 224 (\bmod 1000)$; then $12^{11} \equiv 12\cdot 224 \equiv 668 (\bmod 1000)$, $12^{12} \equiv 12\cdot 668 \equiv 256 (\bmod 1000)$ etc. – Oleg567 May 29 '18 at 12:33
• If $m,n$ fulfill $12^m \equiv 12^n\mod 1000$, $1000\mid (12^{m}-12^n)$ and $1000\mid 12^{n}(12^{m-n}-1)$. – poyea May 29 '18 at 12:43

Let find periodicity of last digit: $$1\underline{2}, 14\underline{4}, 172\underline{8}, 2073\underline{6}, 24883\underline{2}, ...$$ Since $12^1 \equiv 12^5 \equiv 2 \bmod(10)$, we conclude that $12^k\equiv 12^{k+4} (\bmod 10)$.

Now find periodicity of last $2$ digits, using this $4$-periodicity of last digit: since $12^4 \equiv 36 (\bmod 100)$,

$12^1 =12 (\bmod 100)$,
$12^5 \equiv 12 \cdot 12^4 \equiv 12\cdot 36 \equiv 32 (\bmod 100)$,
$12^9 \equiv 12^5 \cdot 12^4 \equiv 32\cdot 36 \equiv 52 (\bmod 100)$,
$12^{13} \equiv 12^9 \cdot 12^4 \equiv 52\cdot 36 \equiv 72 (\bmod 100)$,
$12^{17} \equiv 12^{13}\cdot 12^4 \equiv 72\cdot 36 \equiv 92 (\bmod 100)$,
$12^{21} \equiv 92\cdot 36 \equiv 12 (\bmod 100)$;

so, periodicity of last $2$ digits is $20$.

Finally, find periodicity of last $3$ digits: since $12^{20} \equiv 176 (\bmod 1000)$, we have:

$12^2 \equiv 144 (\bmod 1000)$;
$12^{22} \equiv 144 \cdot 176 \equiv 344 (\bmod 1000)$;
$12^{42} \equiv 344 \cdot 176 \equiv 544 (\bmod 1000)$;
$12^{62} \equiv 544 \cdot 176 \equiv 744 (\bmod 1000)$;
$12^{82} \equiv 744 \cdot 176 \equiv 944 (\bmod 1000)$;
$12^{102} \equiv 944 \cdot 176 \equiv 144 (\bmod 1000)$;

So, $$12^2 = 144,$$ $$12^{102} \equiv 144 (\bmod 1000).$$

$$(m+n = 104)$$

• Easy to check the case $n=1, m=1+100$: last digits of $12^n$ and $12^m$ are: $012$ and $512$. – Oleg567 May 29 '18 at 13:05
• I like your solution, but maybe this should be obvious but I don't understand how since $12^4≡36(mod100)$ leads to 4-periodicity (And similarly for $12^20$... – space May 29 '18 at 13:06
• @Helena: Once we noticed that $12^5 \equiv 12^1 (\bmod 10)$, we can claim that $12^{k+4} \equiv 12^k (\bmod 10)$, therefore to have $2$-digital periodicity, we should check powers with step $4$. This $12^4 \equiv 36 (\bmod 100)$ is for fast "jumping" over powers with step $4$. – Oleg567 May 29 '18 at 13:13
• Oh okay. For computing $12^5$ that seems manageable by hand, but getting the last three digits of $12^{20}$ seems a bit troublesome still – space May 29 '18 at 13:39
• To compute last $3$ digits of $12^{20}$, we can do following: $12^5 = 248832$, so $$12^5\equiv 832 (\bmod 1000),$$ then $$12^{10} = (12^5)^2 \equiv 832^2 \equiv 224 (\bmod 1000),$$ and finally $$12^{20 } = (12^{10})^2 \equiv 224^2 \equiv 176 (\bmod 1000).$$ – Oleg567 May 29 '18 at 13:47

You have $12^m\equiv 12^n\pmod{10^3}$ hence $12^m\equiv 12^n\pmod{2^3}$ and $12^m\equiv 12^n\pmod{5^3}$.

For the latter, we have $12^{m-n}\equiv 1\pmod{5^3}$, hence $m\equiv n\pmod{100}$ because the multiplicative order of $12$ modulo $5^3$ is $100$, as computed here.

On the other hand, $12^n(12^{m-n}-1)\equiv 0\pmod{2^3}$ from which $12^n\equiv 0\pmod{2^3}$ which holds for $n\geq 2$.

Thus $n=2$ and $m=102$ is the smallest solution with sum $m+n=104$.

• Actually, $2$ is a primitive root mod $5^n$ for all $n$, and so has order $4\cdot 5^{n-1}$. – lhf May 29 '18 at 13:16

As $12^{m-n}-1$ is odd, $2^3$ must divide $12^n\implies n\ge2$

As $(12^n,5)=1,5^3$ must divide $12^{m-n}-1$

$\iff12^{m-n}\equiv1\pmod{125}$

As $12^2\not\equiv1\pmod5\implies$ord$_512=4$

Now $12^4=(145-1)^2\not\equiv1\pmod{25}\implies$ord$_{25}12=4\cdot5$

So, $12$ is a primitive root $\pmod{5^r},r\ge1$

$\implies m-n$ must be divisible by $\phi(125)$

Reference:

Here Order of numbers modulo $p^2$ I've proved if ord$_pa=d,$ord$_{p^2}a=d$ or $pd$

The last 3 digits repeat periodically, we have to find the period. First of all, let me please write the code to have a certain answer, the human solution follows:

Sage code:

L = []
R = Zmod(1000)
b = R(2012)
a = b
n = 1    # corresponds to a = b^1
while a not in L:
L.append(a)
print "2012^%3s = %3s modulo 1000" % ( n, a )
n += 1
a *= R(2012)
print "n = %s :: Value repeated = %s" % ( n, a )

Results (omissions in the middle...)

2012^  1 =  12 modulo 1000
2012^  2 = 144 modulo 1000
2012^  3 = 728 modulo 1000
2012^  4 = 736 modulo 1000
2012^  5 = 832 modulo 1000
2012^  6 = 984 modulo 1000
2012^  7 = 808 modulo 1000
2012^  8 = 696 modulo 1000
2012^  9 = 352 modulo 1000
2012^ 10 = 224 modulo 1000
2012^ 11 = 688 modulo 1000

::::::::::::::::::::::::::

2012^ 95 = 968 modulo 1000
2012^ 96 = 616 modulo 1000
2012^ 97 = 392 modulo 1000
2012^ 98 = 704 modulo 1000
2012^ 99 = 448 modulo 1000
2012^100 = 376 modulo 1000
2012^101 = 512 modulo 1000
n = 102 :: Value repeated = 144

Now the human solution.

We want $2012^m = 2012^n$ modulo $1000$ with minimal values for $m>n>0$. The equality modulo $1000$ is equivalent to the following two equalities: \begin{aligned} 2012^m &= 2012^n\text { modulo }2^3 = 8\ ,\qquad\text{ and }\\ 2012^m &= 2012^n\text { modulo }5^3 = 125\ . \end{aligned} For $n=1$ we have $2012^n=2012=4$ modulo $8$. For $n>1$ we have of course $2012^n=4^n=0$ modulo $8$. So the first time we can have a repetition is for $n=2$. The repetition occurs - looking now on the side with rests modulo $125$, latest after $$\phi(125)=\phi(5^3)=\frac 45\cdot 5^3=100$$ steps. (Since $2012$ is prime to $125$, here $\phi$ is the Euler indicator function.)

From the above computation we know that $100$ is the minimal period. To show this, it is enough to see that

• $2012^{100/2}$, and

• $2012^{100/5}$,

is not one modulo $125$. One can compute for instance

sage: 2012^10 % 125
99
sage: 2012^20 % 125, 99^2 % 125
(51, 51)
sage: 2012^50 % 125, 99^5 % 125
(124, 124)

So the order of $2012=12$ in the multiplicative group $(\Bbb Z/125)^\times$ of order $\phi(125)=100$ is indeed $100$, the full possible order, since no immediate divisors are. We can also ask

sage: R = Zmod(125)
sage: R(2012).multiplicative_order()
100

So the minimal values are $m=102 >n=2>0$.

We have

$$12^n \equiv 12^{n+100}\Rightarrow n=2,m=102\to n+m=104$$

• Wait how do I know that $12^n \equiv 12^{n+100}$? – space May 29 '18 at 13:08


text:
## Hybridization for elements like S, Xe, Br, etc.

$sp, sp^{2}, sp^{3}, dsp^{3}, d^{2}sp^{3}$

Anisha Chandra 1K
Posts: 118
Joined: Thu Jul 11, 2019 12:17 am

### Hybridization for elements like S, Xe, Br, etc.

How does hybridization work for elements where some or all of the valence electrons are paired? Do the paired electrons get promoted to d orbitals?

MingdaH 3B
Posts: 133
Joined: Thu Jul 11, 2019 12:17 am

### Re: Hybridization for elements like S, Xe, Br, etc.

Hybridization works the same for all elements, although some are very difficult to find in a molecular form. Count the number of bonds between atoms, and then it's just the same process

emwoodc
Posts: 45
Joined: Fri Aug 09, 2019 12:16 am

### Re: Hybridization for elements like S, Xe, Br, etc.

hybridization should be the same for every element.

Daniel Martinez 1k
Posts: 50
Joined: Wed Sep 18, 2019 12:16 am

### Re: Hybridization for elements like S, Xe, Br, etc.

Hybridization works the same for all elements.

Claire Stoecklein 1E
Posts: 49
Joined: Sat Jul 20, 2019 12:15 am

### Re: Hybridization for elements like S, Xe, Br, etc.

Is hybridization just for the central atom? So then is one molecule just one kind of hybridization?


text:
# degreeLength(LieAlgebra) -- get the length of the weight of a generator

## Synopsis

• Function: degreeLength
• Usage:
n=degreeLength(L)
• Inputs:
• Outputs:
• n, an integer, the length of an arbitrary weight

## Description

Observe that the weights of the generators in a Lie algebra will have an extra component 0 if the option LastWeightHomological is false.

 i1 : L=lieAlgebra{a,b} o1 = L o1 : LieAlgebra i2 : M=lieAlgebra({a,b},Weights=>{{1,0},{2,1}},LastWeightHomological=>true) o2 = M o2 : LieAlgebra i3 : degreeLength L o3 = 2 i4 : weight\gens L o4 = {{1, 0}, {1, 0}} o4 : List i5 : degreeLength M o5 = 2


text:
# ImageJ and Python integration

I have a code in python 3.7 and i need to import it as a plugin in Imagej. What should i do?

Morning have a look at this thread for a start:

There’s quite a bit of discussion here on the forum, did you search on ‘python’?

3 Likes

You can have a look https://github.com/imglib/imglyb, A bridge connect imglib and numpy.

And you can try or contribute to https://github.com/Image-Py/imagepy, A framework like ImageJ in Python. There is not many plugins as rich as ImageJ/Fiji now. But you can use numpy/skimage/opencv directly.

And in the future, I would do some work that try to access scijava in ImagePy,

1 Like

Thank you Danielle_Z. I did look there.
Executing Imagej package functions always ends up raising exceptions like

"raise ImportError(‘Unable to import scyjava dependency jnius.’)
ImportError: Unable to import scyjava dependency jnius."

Is there a problem with jnius module?

1 Like

I’m afraid l can’t help. Perhaps a search on that module and python could point you to some folk who you could address specifically.

Myself I’m keen to start combining ImageJ and python too, but I’m rather green in that area right now.

Are you using conda?

Can you be more specific about the steps you took to get set up?
(I presume you’re trying pyimagej but its not clear…)

John

No i am using Python idle, though i think i will get the same error while using conda too.
Steps:
I downloaded the imagej package in python (yes it is pyimagej).
It had certain prerequisites like scyjava and imglyb and jnius. So i also downloaded both the packages too.

this is the exact error i get when i run a function in Imagej package. Is there anything i could do?

1 Like

That’s helpful. Looking at this part of the error message:

PYJNIUS_JAR environment variable not defined

it looks like you’re missing an environment variable which tells imglyb where to find the pyjnius jar.

Make sure you followed all the steps for installing imglyb
Especially this part which shows you how to set the environment variables imglyb needs.

:: Set the appropriate environment variables:
SET "PYJNIUS_JAR=path\to\pyjnius\pyjnius.jar"
SET "JAVA_HOME=path\to\jdk"
SET "JDK_HOME=%JAVA_HOME%"

John

2 Likes

I feel the quickest and simplest (80-20) way to get something going is to just use subprocess in Python and execute the appropriate command line.

First make your macro and save as macro.ijm. You can build a template but just doing Plugins > Macros > Record in Fiji and copying out what you need from your image operations. Put that in a file or construct a function which generates the macro just as you would writing to a text file (useful for iterating through different datasets, for example). Then just run the following:

import subprocess
fiji_path = "/path/to/Fiji.app"
macro_file = "macro.ijm"
fiji_cmd = " ".join([fiji_path, "--headless", "-macro", macro_file])
subprocess.call(fiji_cmd, shell=True)

The only thing to be aware of is the use of double or single quotes. As an example, say you want to subtract background for a list of files in a folder which have a certain string:

def generate_macro(input_dir,output_dir,unique_identifier):
params_list = [
"setBatchMode(true);",
"list = getFileList('%s');" % input_dir,
"for (i = 0; i < list.length; i++) {",
"    idx = indexOf( list[i], '%s' );" % unique_identifier,
"    if ( idx >= 0 ){",
"        print(list[i]);",
"        open('%s' + list[i]);"% input_dir,
"        run('Subtract Background...', 'rolling=50');",
"        saveAs('Tiff','%s' + list[i]);" % output_dir,
"        close();",
"        }",
"}",
"setBatchMode(false);",
]
macro_params = "\n".join(params_list)
return macro_params

Then you just write this to file:

macro_params = generate_macro(*args)
f = open("macro.ijm")
f.write(macro_params)
f.close()

Now you can call it from subprocess as above. Good luck.

1 Like

I had the same problem

my error information as following:

Unable to import scyjava: pyjnius JAR not found.
Traceback (most recent call last):
File "mainWindow.py", line 432, in slotOpenImageJ
File "site-packages\imagej\imagej.py", line 126, in init
File "c:\users\fengzhiheng\anaconda3\envs\pyimagej\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\imglyb\__init__.py", line 38, in <module>
File "site-packages\imglyb\__init__.py", line 33, in _init_jvm_options
File "c:\users\fengzhiheng\anaconda3\envs\pyimagej\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\scyjava\__init__.py", line 142, in <module>
ImportError: Unable to import scyjava dependency jnius.


text:
# What is the materials quantity variance for the month?

The standards for product F28 call for 2.7 pounds of a raw material that costs $16.50 per pound. Last month, 4,100 pounds of the raw material were purchased for$70,520. The actual output of the month was 1,300 units of product F28. A total of 3,500 pounds of the raw material were used to produce this output.

Required:

a. What is the materials price variance for the month?

b. What is the materials quantity variance for the month?

c. Prepare journal entries to record the purchase and use of the raw material during the month. (All raw materials are purchased on account.)

a. Materials price variance = (AQ × AP) – (AQ × SP) = $70,520 – (4,100 ×$16.50) = $2,870 U b. Materials quantity variance = SP(AQ – SQ*) =$16.50(3,500 – 3,510) = \$165 F *SQ = Standard quantity per unit × Actual output = 2.7 × 1,300 = 3,510 c. Journal entries to record the purchase and use of the raw material: Record the...


text:
# BDC Grid

The Albers Equal-Area Conic is the reference map projection for the BDC tiling system, named BDC Grid. Like other normal conics, the Albers Equal-Area Conic projection has concentric arcs of circles for parallels and equally spaced radii as meridians. The parallels are not equally spaced, but they are farthest apart in the latitudes between the standard parallels and closer together to the north and south. The pole is not the center of the circles, but it is normally an arc itself. Scale along the parallels is too small between the standard parallels and too large beyond them. The scale along the meridians is just the opposite and, in fact, the scale factor along meridians is the reciprocal of the scale factor along the parallels to maintain equal area [18].

BDC Grid includes 1°x1.5°, 2°x3°, and 4°x6° tiles, depending on the spatial resolution and the file size of output images of interest. Sentinel-2/MSI images use 1°x1.5° tiles, Landsat-8/OLI images are accommodated in 2°x3° tiles, and CBERS-4/AWFI images operate in 4°x6° tiles. The rationale behind the BDC Grid tiling system follows the concept illustrated below in Figure 1. Tile seeds are initially positioned in a way that their upper left corners coincide at the intersection of the equator with the meridian 54° west. With those initial tile seeds defined, other tiles of the same corresponding sizes, always defined by Albers Equal-Area Conic plane coordinates, are automatically generated to entirely cover the cartesian plane of the reference map projection system. For each tile size, upper boundaries perfectly match lower boundaries of tiles above and left boundaries perfectly match right boundaries of tiles on the left. The hierarchical relation between the different BDC Grids can be seen in Figure 2.

Figure 1 - Tile seeds for BDC Grid.

Figure 2 - BDC Grid.

The Albers Equal-Area Conic projection parameters follow the cartographic standards defined by Instituto Brasileiro de Geografia e Estatística (IBGE), which is the official civilian mapping agency of Brazil [7]. BDC Grid uses parallel 12° south and meridian 54° west as origin and defines two standard parallels at latitudes 2° south and 22° south. Offsets of 5,000,000 meters and 10,000,000 meters are respectively applied to X and Y coordinates at the origin. SIRGAS-2000, the official planimetric datum of Brazil, is the reference geodetic system. In short, the PROJ string for the BDC Grid can be expressed by:

$\begin{split}crs: +proj=aea +lat\_0=-12 +lon\_0=-54 +lat\_1=-2 +lat\_2=-22 \\ +x\_0=5000000 +y\_0 = 10000000 +ellps=GRS80 +units=m +no\_defs.\end{split}$


text:
# compact sets

• Oct 24th 2012, 01:53 AM
bskcase98
compact sets
before I write the problem I just want to clarify that this is not a graded assignment but a practice problem designed to help understand the topic. My professor has limited office hours so I am hoping someone can help me reason this out.

does the set Q intersection [0, 1] in R have an open cover that cannot be replaced by a finite sub-cover?

this is what I know:
(1) the question is asking if Q intersection [0, 1] is compact in R
(2) that [0, 1] is a compact interval
(3) that Q intersection [0, 1] is contained in [0,1] and that by the density of Q the Q intersection [0, 1] will be an open set

my initial thought is that no this intersection is not compact but I am not confident in that answer and I would really appreciate any assistance.

Thank you
• Oct 24th 2012, 02:46 AM
FernandoRevilla
Re: compact sets
Quote:

Originally Posted by bskcase98
I am not confident in that answer and I would really appreciate any assistance.

Denote $A=\mathbb{Q}\cap [0,1]$ then, $\bar{A}=[0,1]\neq A$, that is, $A$ is not a closed set, as a consequence, $A$ is not compact.


text:
In a material hot forging process, rational preform design not only ensures that metal flows properly in die cavity and that final products have excellent quality, but also reduces tooling cost. In the present work, it is proved in theory that the differential equation of electric potential $(∇2ϕ=0)$ in the electrostatic field is similar to the differential equations of velocity potential function $(∇2φ=0)$ and velocity stream function $(∇2ψ=0)$ in velocity field during the material forming process, with all three represented in the form of the Laplace equation. Moreover, the material flow in the plastic stage and the energy in electrostatic field all meet the least-energy principle. Therefore, according to the similarity criteria, an equi-potential line (EPL) method is proposed for the design of the preform shape in material hot forging. Different voltages are applied to the billet shape and the final product shape to generate a proper electrostatic field. One optimal equi-potential line is selected among the innumerable equi-potential lines as the basic shape of the preform shape and is processed into the preform shape following a three-step procedure. The preform design by the EPL method is compared with that by the traditional industrial method. The results show that the proposed method for preform design is feasible and reliable for practical applications.

1.
Johnson
,
W.
,
Sowerby
,
R.
, and
,
J. B.
, 1970,
Plane Strain Slip Line Field: Theory and Bibliography
,
Elsevier
,
New York
.
2.
Kobayashi
,
S.
,
Oh
,
S.
, and
Alatan
,
T.
, 1989,
Metal Forming and the Finite Element Method
,
Oxford University Press
,
Oxford, UK
.
3.
,
S.
, and
Zabaras
,
N.
, 1996, “
A Sensitivity Analysis for the Design of Metal Forming Processes
,”
Comput. Methods Appl. Mech. Eng.
0045-7825,
129
, pp.
319
348
.
4.
Colla
,
D.
,
Peterwen
,
S. B.
,
Balendra
,
R.
et al.
, 1997, “
Injection Forging of Industrial Components From Thick-walled Tubes
,”
ASME J. Manuf. Sci. Eng.
1087-1357,
119
(
4A
), pp.
537
541
.
5.
Chou
,
I. N.
, and
Hung
,
C.
, 1997, “
Three—Dimensional Finite Element Analysis of Sheet-Metal Bending With Complex Die Geometry
,”
ASME J. Manuf. Sci. Eng.
1087-1357,
119
(
3
), pp.
324
331
.
6.
Zhao
,
G.
,
Wright
,
E.
, and
Grandhi
,
R.
, 1997, “
,”
Int. J. Numer. Methods Eng.
0029-5981,
40
, pp.
1213
1230
.
7.
Almohaileb
,
M.
,
Gunasekera
,
J. S.
,
Mehta
,
B. V.
, and
Oyekarmi
,
B.
, 2004, “
Modified Upper Bound Elemental Technique (MUBET) for Preform Design in Closed Die Forging
,”
AIP Conference Proceedings
, No. 712, Part 2,
S.
Ghosh
,
J. C.
Castro
, and
J. K.
Lee
, eds., pp.
2062
2067
.
8.
Dessenberger
,
R. B.
, and
Tucker
,
C. L.
, 2003, “
Ideal Forming Analysis for Random Fiber Preforms
,”
ASME J. Manuf. Sci. Eng.
1087-1357,
125
(
1
), pp.
146
153
.
9.
Oh
,
S. I.
, and
Yoon
,
S. M.
, 1994, “
A New Method to Design Blocker
,”
CIRP Ann.
0007-8506,
43
, pp.
245
248
.
10.
Lee
,
S. R.
,
Lee
,
Y. K.
,
Park
,
C. H.
, and
Yang
,
D. Y.
, 2002, “
A New Method of Preform Design in Hot Forging by Using Electric Field Theory
,”
Int. J. Mech. Sci.
0020-7403,
44
(
4
), pp.
773
792
.
11.
Wang
,
J.
, 1991,
Modern Mechanical Principles of Metal Forming
,
Metallurgical Industry Press
,
Beijing
[in Chinese].
12.
Drucker
,
D. C.
,
Prager
,
W.
, and
Greenberg
,
H. J.
, 1952, “
Extended Limit Design Theorems for Continuous Media
,”
Q. J. Mech. Appl. Math.
0033-5614,
9
, pp.
381
389
.
13.
Feynman
,
R. P.
,
Leighton
,
R. B.
, and
Sands
,
M.
, 1981,
The Feynman Lectures on Physics
,
Shanghai Scientific and Technical Publishers
,
Shanghai
, Vol.
2
, pp.
221
235
[in Chinese].
14.
Liu
,
Y.
, 2004, “
Simulation and Control for Isothermal Forging Process of PM Superalloy
.” Ph.D. dissertation, Northwestern Polytechnical University, China.
15.
Liu
,
Y.
,
Li
,
F.
, and
Wu
,
S.
, 2003, “
Flow Behavior Study on Fine Grain FGH96 P/M Superalloy During Hot Deformation
,”
ACTA Aeronaut. Astronaut. Sinica
1000-6893,
24
(
3
), pp.
278
281
(in Chinese).


text:
### Pandas Data Structures: Series

Pandas is a massively popular python data manipulation and analysis library. It offers data structures and operations that make it easier to manipulate data. One of the fundamental data structures in pandas is Series.

Series is a one-dimensional labeled array capable of holding any data type. The axis labels are collectively referred to as the index.

This post accumulates some of the things that I’ve learned about Series that I’d like to keep in one place for myself for a quick future reference. This is merely a basic intro to Series, and there’s a lot more to this data structure.

Before doing anything with Series, we need to import pandas:

import pandas as pd

## Series Basics

You can create a Series from a list with any data type:

fruit = ['banana', 'apple', 'orange', 42, ['blueberries','raspberries']]
my_fruit_series = pd.Series(fruit)
----------------
0                        banana
1                         apple
2                        orange
3                            42
4    [blueberries, raspberries]
dtype: object
----------------

By default, each item received an index label from 0 to N-1, where N is the length of the Series. You can find out the length of the Series by calling len() or size:

len(my_fruit_series)
----------------
5
----------------

my_fruit_series.size
----------------
5
----------------

If you want to set the indices yourself, you can do that too:

fruit = ['banana', 'apple', 'orange', 42, ['blueberries','raspberries']]
my_fruit_series = pd.Series(fruit, index=list('abcde'))
----------------
a                        banana
b                         apple
c                        orange
d                            42
e    [blueberries, raspberries]
dtype: object
----------------

You can also create a Series from a dictionary, in this case keys will be used to build the index.

GOT_cast = {'Tyrion Lannister': 'Peter Dinklage', 'Cersei Lannister': 'Lena Headey',
'Daenerys Targaryen':'Emilia Clarke','Jon Snow':'Kit Harington'}

GOT_series = pd.Series(GOT_cast)
----------------
Daenerys Targaryen     Emilia Clarke
Jon Snow               Kit Harington
Tyrion Lannister      Peter Dinklage
dtype: object
----------------

Sometimes it’s useful to create a large Series of random numbers, for example, here’s a Series with 10000 numbers with random numbers from 0 to 500.

import numpy as np
random_numbers = pd.Series(np.random.randint(0,500,10000))

If you have a large Series, you may want to use head() or tail() method to, sort of, preview it. By default head() shows the first 5 elements of the Series, and the tail() shows the last 5 elements, however, you can specify any other number.

GOT_cast = {'Tyrion Lannister': 'Peter Dinklage', 'Cersei Lannister': 'Lena Headey',
'Daenerys Targaryen':'Emilia Clarke','Jon Snow':'Kit Harington',
'Sansa Stark':'Sophie Turner', 'Arya Stark':'Maisie Williams',
'Jaime Lannister':'Nikolaj Coster-Waldau', 'Jorah Mormont':'Iain Glen',

GOT_series = pd.Series(GOT_cast)
----------------
Arya Stark            Maisie Williams
Daenerys Targaryen      Emilia Clarke
dtype: object
----------------

If you want to get all the values and don’t really care about the index, you can get the array of values with values:

GOT_series.values
----------------
['Maisie Williams' 'Lena Headey' 'Emilia Clarke' 'Nikolaj Coster-Waldau'
'Kit Harington' 'Iain Glen' 'John Bradley' 'Sophie Turner' 'Alfie Allen'
'Peter Dinklage']
----------------

You can get the Index object too:

GOT_series.index
----------------
Index(['Arya Stark', 'Cersei Lannister', 'Daenerys Targaryen',
'Jaime Lannister', 'Jon Snow', 'Jorah Mormont', 'Samwell Tarly',
'Sansa Stark', 'Theon Greyjoy', 'Tyrion Lannister'],
dtype='object')
----------------

Speaking of indices, let’s see how we can select something out of a Series. If we know the label where the value is we can use .loc, or []

GOT_series.loc['Tyrion Lannister']
----------------
Peter Dinklage
----------------

GOT_series['Tyrion Lannister']
----------------
Peter Dinklage
----------------

If the label isn’t in the index, it’ll raise a KeyError:

GOT_series.loc['Bronn']
----------------
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/indexing.py", line 1434, in _has_valid_type
error()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/indexing.py", line 1429, in error
(key, self.obj._get_axis_name(axis)))
KeyError: 'the label [Bronn] is not in the [index]'
----------------

But you can use a non-existent index to “append” the series:

GOT_series.loc['Bronn'] = 'Jerome Flynn'
GOT_series
----------------
Arya Stark                  Maisie Williams
Daenerys Targaryen            Emilia Clarke
Jaime Lannister       Nikolaj Coster-Waldau
Jon Snow                      Kit Harington
Jorah Mormont                     Iain Glen
Sansa Stark                   Sophie Turner
Theon Greyjoy                   Alfie Allen
Tyrion Lannister             Peter Dinklage
Bronn                          Jerome Flynn
dtype: object
----------------

It’s also possible to refer to integer location based index using .iloc.

GOT_series.iloc[2]
----------------
Kit Harington
----------------

.loc, .iloc, and also [] indexing can accept a callable as indexer, which I find pretty cool. So you can do something like this:

random_numbers = pd.Series(np.random.randint(0,500,10000))
----------------
17    451
19    442
22    488
24    431
32    479
dtype: int64
----------------

At first, it seemed to me that the where() method would return the same as selection by callable, given the same condition, but there’s a big difference. It returns a series of exactly the same shape with those values that match the condition exactly where they are, and the rest is NaN.

random_numbers.loc[lambda s: s > 5]
random_numbers.where(random_numbers>5)
----------------
3    9
6    9
7    6
9    9
dtype: int64
0    NaN
1    NaN
2    NaN
3    9.0
4    NaN
5    NaN
6    9.0
7    6.0
8    NaN
9    9.0
dtype: float64
----------------

By default where() returns a copy and doesn’t modify the original data. There is an optional parameter inplace (inplace=True) so that the original data can be modified without creating a copy.

## Some Math with Series

Let’s take this Series as an example:

s = pd.Series([3,12,1,7,15])
----------------
0     3
1    12
2     1
3     7
4    15
dtype: int64
----------------

You can get the sum of the values with sum() from numpy:

total = np.sum(s)
total
----------------
38
----------------

You can add N to each item in Series using broadcasting (same goes for division, multiplication, subtraction):

s+=2
----------------
0     5
1    14
2     3
3     9
4    17
dtype: int64
----------------

You can do this:

s = pd.Series([3,12,1,7,15])
s1 = pd.Series([1,2,3,4,5,6])
s+s1
----------------
0     4.0
1    14.0
2     4.0
3    11.0
4    20.0
5     NaN
dtype: float64
----------------

It doesn’t matter if the length of two Series is different, or even if the indices are not an exact match. The result of an operation between unaligned Series will have the union of the indexes involved. If a label is not found in one Series or the other, the result will be marked as missing NaN.

With describe() you can get a quick statistic summary of your data:

random_numbers = pd.Series(np.random.randint(0,500,10000))
random_numbers.describe()
----------------
count    10000.000000
mean       251.338500
std        145.344209
min          0.000000
25%        124.750000
50%        252.000000
75%        379.000000
max        499.000000
dtype: float64
----------------

To see if two Series are exactly the same (both indices and values), you can use equals():

s = pd.Series([1,2,3,4,5])
s1 = pd.Series([1,2,3,4,5], index=list('abcde'))
s.equals(s1)
----------------
False
----------------

s = pd.Series([1,2,3,4,5])
s2 = pd.Series([1,2,3,4,5])
s.equals(s2)
----------------
True
----------------

You can do element-wise comparisons with a scalar value:

s = pd.Series(['foo', 'bar', 'baz'])
s == 'foo'
----------------
0     True
1    False
2    False
dtype: bool
----------------

You can locate labels of the minimum and maximum values with the idxmin() and idxmax() functions:

s = pd.Series([3,12,1,7,15], index=list('abcde'))
s.idxmax()
s.idxmin()
----------------
e
c
----------------

## Modifying Data in a Series

Replacing values in a Series with a new value:

s = pd.Series([3,7,12,1,7,15])
s.replace(7,777)
----------------
0      3
1    777
2     12
3      1
4    777
5     15
dtype: int64
----------------

### Modifying data with apply()

Let’s say we have a Series with heights of my imaginary friends in cm:

s = pd.Series([175,168,154,183], index=['Tim', 'Kate', 'Ann', 'Jon'])
----------------
Tim     175
Kate    168
Ann     154
Jon     183
dtype: int64
----------------

If I want to convert their height from cm to inches, I can do it with apply():

s = pd.Series([175,168,154,183], index=['Tim', 'Kate', 'Ann', 'Jon'])
s = s.apply(lambda x: x/2.54)
----------------
Tim     68.897638
Kate    66.141732
Ann     60.629921
Jon     72.047244
dtype: float64
----------------

Or, I can define a function, and pass it:

s = pd.Series([175,168,154,183], index=['Tim', 'Kate', 'Ann', 'Jon'])
def convert_cm_to_inch(x):
return x/2.54
s = s.apply(convert_cm_to_inch)
----------------
Tim     68.897638
Kate    66.141732
Ann     60.629921
Jon     72.047244
dtype: float64
----------------

If the function takes more arguments, you can specify them with args=

s = pd.Series([175,168,154,183], index=['Tim', 'Kate', 'Ann', 'Jon'])


text:
# Math homework help

1. Mar 31, 2005

### gillgill

does this seem right?
lim (sin3x)/(x+3x^2)
x->0

=(sin3x)/[3x^2(1/3x+1)]
=1/[(1/3(0)+1)(sin3(0))]
=undefined

2. Mar 31, 2005

sin(3x) = 0
x-> 0

3. Apr 1, 2005

### Data

do you know l'Hopital's rule?

4. Apr 1, 2005

### Galileo

Can you rewrite your equation in order to use:

$$\lim_{x \to 0}\frac{\sin(3x)}{3x}=1$$?

5. Apr 1, 2005

### BobG

Don't you mean $$\lim_{x \to 0}\frac{3 \sin(x)}{3x}=1$$?

Or are you just taking advantage of the fact, that near zero, sin x = x?

L'Hopital's Rule is certainly the easiest way to solve this. If you haven't learned it yet, check the table of contents and find it. Some books teach it very early on and some wait to teach it until later on. It's easy enough to learn that I'd learn it early even if the course waits until later.

For your equation, it's simply the derivative of the top divided by the derivative of the bottom. You can do that whenever your limit winds up 0/0, or infinity/infinity.

In other words:

$$\lim_{x \to 0}\frac{\sin(3x)}{x+3x^2}=\lim_{x \to 0}\frac{3 \cos(3x)}{1+6x}$$?

Last edited: Apr 1, 2005
6. Apr 1, 2005

### HallsofIvy

Staff Emeritus
No, Galileo meant $$\lim_{x\to 0}\frac{sin(3x)}{3x}= 1$$ just like he said.

Sort of, though I wouldn't say it like that. sin x is NOT equal to x "near zero". They are only equal AT 0. What you meant to say, I am sure, is that sin x is close to x for x close to 0 and the become close as x goes to 0: $$\lim_{x \to 0}\frac{sin x}{x}= 1$$ and $$\frac{sin(3x)}{x}= \frac{3 sin(3x)}{3x}= 3\frac{sin(y)}{y}$$ where y= 3x. In other words, $$\lim_{x \to 0}\frac{sin(3x)}{x}= \lim_{x \to 0}3\frac{sin 3x}{3x}= 3\lim_{y \to 0}\frac{sin(y)}{y}= 3$$.

In my opinion, it is far simpler to use Galileo's idea than to use L'Hopital.

Last edited: Apr 1, 2005
7. Apr 1, 2005

### Data

Yes, it is. L'Hopital's result is too strong for this problem. Although it will of course get you the answer quite readily, it's a lot harder to prove than the things Galileo's method needs

Nevertheless, if he did know l'Hopital's rule, it would be the obvious path~


text:
Mimi_x3 one year ago Write the trigonometric expression as an algebraic expression in u and v. Assume that the variables u and v represent positive real numbers. $\cos(\sin^{−1}(u)-\tan^{−1}(v))$

1. dan815

okay so what exactly are we doing here

2. Mimi_x3

Im unsure myself =_=

3. dan815

you can always eliminate sin and cos with complex versions or power series

4. dan815

|dw:1443141313790:dw|

5. dan815

you can try to figure out the inverse function here, for this complex version of sin and cos

6. dan815

you can also continue to write it in a power series if they prefer that

7. dan815

my last guess would be to start drawing triangles

8. dan815

since they have sin^-1(u) so

9. dan815

u can do the same to the other one

10. dan815

oh wait oops thats not right

11. dan815

|dw:1443141590469:dw|

12. dan815

so ya i think we just gotta do make use of the cos(a-b) indentity

13. dan815

pretty simple from here, work it out

14. dan815

|dw:1443142431740:dw|

15. dan815

=cos(sin^-1(u))*cos(tan^-1(v)) + sin(sin^-1(u)) sin(tan^-1(v)) =sqrt(1-u^2)*1/sqrt(1+u^2) + u* v/sqrt(1+v^2)

16. dan815

cos(α – β) = cos(α)cos(β) + sin(α)sin(β)

17. Mimi_x3


text:
Lemma 4.40.1 (2-Yoneda lemma). Let $\mathcal{S}\to \mathcal{C}$ be fibred in groupoids. Let $U \in \mathop{\mathrm{Ob}}\nolimits (\mathcal{C})$. The functor

$\mathop{Mor}\nolimits _{\textit{Cat}/\mathcal{C}}(\mathcal{C}/U, \mathcal{S}) \longrightarrow \mathcal{S}_ U$

given by $G \mapsto G(\text{id}_ U)$ is an equivalence.

Proof. Make a choice of pullbacks for $\mathcal{S}$ (see Definition 4.32.6). We define a functor

$\mathcal{S}_ U \longrightarrow \mathop{Mor}\nolimits _{\textit{Cat}/\mathcal{C}}(\mathcal{C}/U, \mathcal{S})$

as follows. Given $x \in \mathop{\mathrm{Ob}}\nolimits (\mathcal{S}_ U)$ the associated functor is

1. on objects: $(f : V \to U) \mapsto f^*x$, and

2. on morphisms: the arrow $(g : V'/U \to V/U)$ maps to the composition

$(f \circ g)^*x \xrightarrow {(\alpha _{g, f})_ x} g^*f^*x \rightarrow f^*x$

where $\alpha _{g, f}$ is as in Lemma 4.34.2.

We omit the verification that this is an inverse to the functor of the lemma. $\square$

There are also:

• 1 comment(s) on Section 4.40: Representable 1-morphisms

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).


text:
My Math Forum Calculate monthly goals towards an all-up target
 User Name Remember Me? Password

 Applied Math Applied Math Forum

 October 10th, 2017, 11:00 AM #1 Newbie   Joined: Oct 2017 From: St. Louis Posts: 2 Thanks: 0 Calculate monthly goals towards an all-up target My business has an all-up target for this year's subscription revenue (e.g. $100,000). We came out of last year with revenue (e.g.$50,000) that we expect to maintain, but there's no guarantee that we will. Subscription revenue comes in monthly so I need to be able to measure our year-to-date progress towards monthly goals. Monthly goals will grow linearly since a month's goals will include the previous month plus growth. All of the monthly goals should sum up to the year's revenue target. I'm hoping there is a means by which I can calculate the monthly goals. Thoughts? Last edited by jfattic; October 10th, 2017 at 11:14 AM.
October 10th, 2017, 07:02 PM   #2
Math Team

Joined: Oct 2011
From: Ottawa Ontario, Canada

Posts: 11,664
Thanks: 740

Quote:
 Originally Posted by jfattic My business has an all-up target for this year's subscription revenue (e.g. $100,000). We came out of last year with revenue (e.g.$50,000) that we expect to maintain, but there's no guarantee that we will....
Where does the 100,000 come in...when you expect 50,000 ?
What d'heck is an "all-up target"?
Your post is almost impossible to "follow".
Can you clarify what you're after, using an actual example; thank you.

Last edited by Denis; October 10th, 2017 at 07:05 PM.

October 11th, 2017, 02:35 AM   #3
Senior Member

Joined: Apr 2014
From: Glasgow

Posts: 2,087
Thanks: 700

Math Focus: Physics, mathematical modelling, numerical and computational solutions
Quote:
 Originally Posted by Denis Where does the 100,000 come in...when you expect 50,000 ? What d'heck is an "all-up target"? Your post is almost impossible to "follow". Can you clarify what you're after, using an actual example; thank you.
I guess he has revenue coming in every month and the revenue will eventually lead up to a total. The idea is to create a variable that, month by month, changes depending on the month's revenue which gives the likelihood of hitting or exceeding some target value at the end of the year.

October 11th, 2017, 05:31 AM   #4
Newbie

Joined: Oct 2017
From: St. Louis

Posts: 2
Thanks: 0

Quote:
 Originally Posted by Benit13 I guess he has revenue coming in every month and the revenue will eventually lead up to a total. The idea is to create a variable that, month by month, changes depending on the month's revenue which gives the likelihood of hitting or exceeding some target value at the end of the year.
That's correct, Benit. This is relatively common for companies that sell subscription sales.

100,000 = SUM of all 12 monthly goals
50,000 = last year's revenue; alternatively, I also have the final month revenue from last year (let's say it's 20,000 for this example)

Example:
Month 01 target = 20,000 + new1
Month 02 target = 20,000 + new1 + new2
Month 03 target = 20,000 + new1 + new2 + new3
etc. up to Month 12

I was thinking that I could use y=mx+b, where b=20,000 (slope-intercept), but since I only have the annual target, I'm not sure how to proceed.

 Tags allup, calculate, goals, monthly, target

 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post mattadams84 Probability and Statistics 0 August 23rd, 2015 08:40 AM extjsjquery Algebra 1 December 19th, 2013 01:03 PM Lupeto Applied Math 0 November 6th, 2010 03:48 AM

 Contact - Home - Forums - Cryptocurrency Forum - Top

Copyright © 2018 My Math Forum. All rights reserved.


text:
18.11. Information Theory¶ Open the notebook in Colab Open the notebook in Colab Open the notebook in Colab Open the notebook in SageMaker Studio Lab

The universe is overflowing with information. Information provides a common language across disciplinary rifts: from Shakespeare’s Sonnet to researchers’ paper on Cornell ArXiv, from Van Gogh’s printing Starry Night to Beethoven’s music Symphony No. 5, from the first programming language Plankalkül to the state-of-the-art machine learning algorithms. Everything must follow the rules of information theory, no matter the format. With information theory, we can measure and compare how much information is present in different signals. In this section, we will investigate the fundamental concepts of information theory and applications of information theory in machine learning.

Before we get started, let us outline the relationship between machine learning and information theory. Machine learning aims to extract interesting signals from data and make critical predictions. On the other hand, information theory studies encoding, decoding, transmitting, and manipulating information. As a result, information theory provides fundamental language for discussing the information processing in machine learned systems. For example, many machine learning applications use the cross-entropy loss as described in Section 3.4. This loss can be directly derived from information theoretic considerations.

18.11.1. Information¶

Let us start with the “soul” of information theory: information. Information can be encoded in anything with a particular sequence of one or more encoding formats. Suppose that we task ourselves with trying to define a notion of information. What could be our starting point?

Consider the following thought experiment. We have a friend with a deck of cards. They will shuffle the deck, flip over some cards, and tell us statements about the cards. We will try to assess the information content of each statement.

First, they flip over a card and tell us, “I see a card.” This provides us with no information at all. We were already certain that this was the case so we hope the information should be zero.

Next, they flip over a card and say, “I see a heart.” This provides us some information, but in reality there are only $$4$$ different suits that were possible, each equally likely, so we are not surprised by this outcome. We hope that whatever the measure of information, this event should have low information content.

Next, they flip over a card and say, “This is the $$3$$ of spades.” This is more information. Indeed there were $$52$$ equally likely possible outcomes, and our friend told us which one it was. This should be a medium amount of information.

Let us take this to the logical extreme. Suppose that finally they flip over every card from the deck and read off the entire sequence of the shuffled deck. There are $$52!$$ different orders to the deck, again all equally likely, so we need a lot of information to know which one it is.

Any notion of information we develop must conform to this intuition. Indeed, in the next sections we will learn how to compute that these events have $$0\text{ bits}$$, $$2\text{ bits}$$, $$~5.7\text{ bits}$$, and $$~225.6\text{ bits}$$ of information respectively.

If we read through these thought experiments, we see a natural idea. As a starting point, rather than caring about the knowledge, we may build off the idea that information represents the degree of surprise or the abstract possibility of the event. For example, if we want to describe an unusual event, we need a lot information. For a common event, we may not need much information.

In 1948, Claude E. Shannon published A Mathematical Theory of Communication [Shannon, 1948] establishing the theory of information. In his article, Shannon introduced the concept of information entropy for the first time. We will begin our journey here.

18.11.1.1. Self-information¶

Since information embodies the abstract possibility of an event, how do we map the possibility to the number of bits? Shannon introduced the terminology bit as the unit of information, which was originally created by John Tukey. So what is a “bit” and why do we use it to measure information? Historically, an antique transmitter can only send or receive two types of code: $$0$$ and $$1$$. Indeed, binary encoding is still in common use on all modern digital computers. In this way, any information is encoded by a series of $$0$$ and $$1$$. And hence, a series of binary digits of length $$n$$ contains $$n$$ bits of information.

Now, suppose that for any series of codes, each $$0$$ or $$1$$ occurs with a probability of $$\frac{1}{2}$$. Hence, an event $$X$$ with a series of codes of length $$n$$, occurs with a probability of $$\frac{1}{2^n}$$. At the same time, as we mentioned before, this series contains $$n$$ bits of information. So, can we generalize to a math function which can transfer the probability $$p$$ to the number of bits? Shannon gave the answer by defining self-information

(18.11.1)$I(X) = - \log_2 (p),$

as the bits of information we have received for this event $$X$$. Note that we will always use base-2 logarithms in this section. For the sake of simplicity, the rest of this section will omit the subscript 2 in the logarithm notation, i.e., $$\log(.)$$ always refers to $$\log_2(.)$$. For example, the code “0010” has a self-information

(18.11.2)$I(\text{"0010"}) = - \log (p(\text{"0010"})) = - \log \left( \frac{1}{2^4} \right) = 4 \text{ bits}.$

We can calculate self information as shown below. Before that, let us first import all the necessary packages in this section.

import random
from mxnet import np
from mxnet.metric import NegativeLogLikelihood
from mxnet.ndarray import nansum

def self_information(p):
return -np.log2(p)

self_information(1 / 64)

6.0

import torch
from torch.nn import NLLLoss

def nansum(x):
# Define nansum, as pytorch doesn't offer it inbuilt.
return x[~torch.isnan(x)].sum()

def self_information(p):
return -torch.log2(torch.tensor(p)).item()

self_information(1 / 64)

6.0

import tensorflow as tf

def log2(x):
return tf.math.log(x) / tf.math.log(2.)

def nansum(x):
return tf.reduce_sum(tf.where(tf.math.is_nan(
x), tf.zeros_like(x), x), axis=-1)

def self_information(p):
return -log2(tf.constant(p)).numpy()

self_information(1 / 64)

6.0

18.11.2. Entropy¶

As self-information only measures the information of a single discrete event, we need a more generalized measure for any random variable of either discrete or continuous distribution.

18.11.2.1. Motivating Entropy¶

Let us try to get specific about what we want. This will be an informal statement of what are known as the axioms of Shannon entropy. It will turn out that the following collection of common-sense statements force us to a unique definition of information. A formal version of these axioms, along with several others may be found in [Csiszar, 2008].

1. The information we gain by observing a random variable does not depend on what we call the elements, or the presence of additional elements which have probability zero.

2. The information we gain by observing two random variables is no more than the sum of the information we gain by observing them separately. If they are independent, then it is exactly the sum.

3. The information gained when observing (nearly) certain events is (nearly) zero.

While proving this fact is beyond the scope of our text, it is important to know that this uniquely determines the form that entropy must take. The only ambiguity that these allow is in the choice of fundamental units, which is most often normalized by making the choice we saw before that the information provided by a single fair coin flip is one bit.

18.11.2.2. Definition¶

For any random variable $$X$$ that follows a probability distribution $$P$$ with a probability density function (p.d.f.) or a probability mass function (p.m.f.) $$p(x)$$, we measure the expected amount of information through entropy (or Shannon entropy)

(18.11.3)$H(X) = - E_{x \sim P} [\log p(x)].$

To be specific, if $$X$$ is discrete,

(18.11.4)$H(X) = - \sum_i p_i \log p_i \text{, where } p_i = P(X_i).$

Otherwise, if $$X$$ is continuous, we also refer entropy as differential entropy

(18.11.5)$H(X) = - \int_x p(x) \log p(x) \; dx.$

We can define entropy as below.

def entropy(p):
entropy = - p * np.log2(p)
# Operator nansum will sum up the non-nan number
out = nansum(entropy.as_nd_ndarray())
return out

entropy(np.array([0.1, 0.5, 0.1, 0.3]))

[1.6854753]
<NDArray 1 @cpu(0)>

def entropy(p):
entropy = - p * torch.log2(p)
# Operator nansum will sum up the non-nan number
out = nansum(entropy)
return out

entropy(torch.tensor([0.1, 0.5, 0.1, 0.3]))

tensor(1.6855)

def entropy(p):
return nansum(- p * log2(p))

entropy(tf.constant([0.1, 0.5, 0.1, 0.3]))

<tf.Tensor: shape=(), dtype=float32, numpy=1.6854753>

18.11.2.3. Interpretations¶

You may be curious: in the entropy definition (18.11.3), why do we use an expectation of a negative logarithm? Here are some intuitions.

First, why do we use a logarithm function $$\log$$? Suppose that $$p(x) = f_1(x) f_2(x) \ldots, f_n(x)$$, where each component function $$f_i(x)$$ is independent from each other. This means that each $$f_i(x)$$ contributes independently to the total information obtained from $$p(x)$$. As discussed above, we want the entropy formula to be additive over independent random variables. Luckily, $$\log$$ can naturally turn a product of probability distributions to a summation of the individual terms.

Next, why do we use a negative $$\log$$? Intuitively, more frequent events should contain less information than less common events, since we often gain more information from an unusual case than from an ordinary one. However, $$\log$$ is monotonically increasing with the probabilities, and indeed negative for all values in $$[0, 1]$$. We need to construct a monotonically decreasing relationship between the probability of events and their entropy, which will ideally be always positive (for nothing we observe should force us to forget what we have known). Hence, we add a negative sign in front of $$\log$$ function.

Last, where does the expectation function come from? Consider a random variable $$X$$. We can interpret the self-information ($$-\log(p)$$) as the amount of surprise we have at seeing a particular outcome. Indeed, as the probability approaches zero, the surprise becomes infinite. Similarly, we can interpret the entropy as the average amount of surprise from observing $$X$$. For example, imagine that a slot machine system emits statistical independently symbols $${s_1, \ldots, s_k}$$ with probabilities $${p_1, \ldots, p_k}$$ respectively. Then the entropy of this system equals to the average self-information from observing each output, i.e.,

(18.11.6)$H(S) = \sum_i {p_i \cdot I(s_i)} = - \sum_i {p_i \cdot \log p_i}.$

18.11.2.4. Properties of Entropy¶

By the above examples and interpretations, we can derive the following properties of entropy (18.11.3). Here, we refer to $$X$$ as an event and $$P$$ as the probability distribution of $$X$$.

• H(X) :raw-latex:\geq 0\$ for all discrete :math:X (entropy can be negative for continuous $$X$$).

• If $$X \sim P$$ with a p.d.f. or a p.m.f. $$p(x)$$, and we try to estimate $$P$$ by a new probability distribution $$Q$$ with a p.d.f. or a p.m.f. $$q(x)$$, then

(18.11.7)$H(X) = - E_{x \sim P} [\log p(x)] \leq - E_{x \sim P} [\log q(x)], \text{ with equality if and only if } P = Q.$

Alternatively, $$H(X)$$ gives a lower bound of the average number of bits needed to encode symbols drawn from $$P$$.

• If $$X \sim P$$, then $$x$$ conveys the maximum amount of information if it spreads evenly among all possible outcomes. Specifically, if the probability distribution $$P$$ is discrete with $$k$$-class $$\{p_1, \ldots, p_k \}$$, then

(18.11.8)$H(X) \leq \log(k), \text{ with equality if and only if } p_i = \frac{1}{k}, \forall i.$

If $$P$$ is a continuous random variable, then the story becomes much more complicated. However, if we additionally impose that $$P$$ is supported on a finite interval (with all values between $$0$$ and $$1$$), then $$P$$ has the highest entropy if it is the uniform distribution on that interval.

18.11.3. Mutual Information¶

Previously we defined entropy of a single random variable $$X$$, how about the entropy of a pair random variables $$(X, Y)$$? We can think of these techniques as trying to answer the following type of question, “What information is contained in $$X$$ and $$Y$$ together compared to each separately? Is there redundant information, or is it all unique?”

For the following discussion, we always use $$(X, Y)$$ as a pair of random variables that follows a joint probability distribution $$P$$ with a p.d.f. or a p.m.f. $$p_{X, Y}(x, y)$$, while $$X$$ and $$Y$$ follow probability distribution $$p_X(x)$$ and $$p_Y(y)$$, respectively.

18.11.3.1. Joint Entropy¶

Similar to entropy of a single random variable (18.11.3), we define the joint entropy $$H(X, Y)$$ of a pair random variables $$(X, Y)$$ as

(18.11.9)$H(X, Y) = −E_{(x, y) \sim P} [\log p_{X, Y}(x, y)].$

Precisely, on the one hand, if $$(X, Y)$$ is a pair of discrete random variables, then

(18.11.10)$H(X, Y) = - \sum_{x} \sum_{y} p_{X, Y}(x, y) \log p_{X, Y}(x, y).$

On the other hand, if $$(X, Y)$$ is a pair of continuous random variables, then we define the differential joint entropy as

(18.11.11)$H(X, Y) = - \int_{x, y} p_{X, Y}(x, y) \ \log p_{X, Y}(x, y) \;dx \;dy.$

We can think of (18.11.9) as telling us the total randomness in the pair of random variables. As a pair of extremes, if $$X = Y$$ are two identical random variables, then the information in the pair is exactly the information in one and we have $$H(X, Y) = H(X) = H(Y)$$. On the other extreme, if $$X$$ and $$Y$$ are independent then $$H(X, Y) = H(X) + H(Y)$$. Indeed we will always have that the information contained in a pair of random variables is no smaller than the entropy of either random variable and no more than the sum of both.

(18.11.12)$H(X), H(Y) \le H(X, Y) \le H(X) + H(Y).$

Let us implement joint entropy from scratch.

def joint_entropy(p_xy):
joint_ent = -p_xy * np.log2(p_xy)
# Operator nansum will sum up the non-nan number
out = nansum(joint_ent.as_nd_ndarray())
return out

joint_entropy(np.array([[0.1, 0.5], [0.1, 0.3]]))

[1.6854753]
<NDArray 1 @cpu(0)>

def joint_entropy(p_xy):
joint_ent = -p_xy * torch.log2(p_xy)
# Operator nansum will sum up the non-nan number
out = nansum(joint_ent)
return out

joint_entropy(torch.tensor([[0.1, 0.5], [0.1, 0.3]]))

tensor(1.6855)

def joint_entropy(p_xy):
joint_ent = -p_xy * log2(p_xy)
# Operator nansum will sum up the non-nan number
out = nansum(joint_ent)
return out

joint_entropy(tf.constant([[0.1, 0.5], [0.1, 0.3]]))

<tf.Tensor: shape=(2,), dtype=float32, numpy=array([0.8321928, 0.8532826], dtype=float32)>

Notice that this is the same code as before, but now we interpret it differently as working on the joint distribution of the two random variables.

18.11.3.2. Conditional Entropy¶

The joint entropy defined above the amount of information contained in a pair of random variables. This is useful, but oftentimes it is not what we care about. Consider the setting of machine learning. Let us take $$X$$ to be the random variable (or vector of random variables) that describes the pixel values of an image, and $$Y$$ to be the random variable which is the class label. $$X$$ should contain substantial information—a natural image is a complex thing. However, the information contained in $$Y$$ once the image has been show should be low. Indeed, the image of a digit should already contain the information about what digit it is unless the digit is illegible. Thus, to continue to extend our vocabulary of information theory, we need to be able to reason about the information content in a random variable conditional on another.

In the probability theory, we saw the definition of the conditional probability to measure the relationship between variables. We now want to analogously define the conditional entropy $$H(Y \mid X)$$. We can write this as

(18.11.13)$H(Y \mid X) = - E_{(x, y) \sim P} [\log p(y \mid x)],$

where $$p(y \mid x) = \frac{p_{X, Y}(x, y)}{p_X(x)}$$ is the conditional probability. Specifically, if $$(X, Y)$$ is a pair of discrete random variables, then

(18.11.14)$H(Y \mid X) = - \sum_{x} \sum_{y} p(x, y) \log p(y \mid x).$

If $$(X, Y)$$ is a pair of continuous random variables, then the differential conditional entropy is similarly defined as

(18.11.15)$H(Y \mid X) = - \int_x \int_y p(x, y) \ \log p(y \mid x) \;dx \;dy.$

It is now natural to ask, how does the conditional entropy $$H(Y \mid X)$$ relate to the entropy $$H(X)$$ and the joint entropy $$H(X, Y)$$? Using the definitions above, we can express this cleanly:

(18.11.16)$H(Y \mid X) = H(X, Y) - H(X).$

This has an intuitive interpretation: the information in $$Y$$ given $$X$$ ($$H(Y \mid X)$$) is the same as the information in both $$X$$ and $$Y$$ together ($$H(X, Y)$$) minus the information already contained in $$X$$. This gives us the information in $$Y$$ which is not also represented in $$X$$.

Now, let us implement conditional entropy (18.11.13) from scratch.

def conditional_entropy(p_xy, p_x):
p_y_given_x = p_xy/p_x
cond_ent = -p_xy * np.log2(p_y_given_x)
# Operator nansum will sum up the non-nan number
out = nansum(cond_ent.as_nd_ndarray())
return out

conditional_entropy(np.array([[0.1, 0.5], [0.2, 0.3]]), np.array([0.2, 0.8]))

[0.8635472]
<NDArray 1 @cpu(0)>

def conditional_entropy(p_xy, p_x):
p_y_given_x = p_xy/p_x
cond_ent = -p_xy * torch.log2(p_y_given_x)
# Operator nansum will sum up the non-nan number
out = nansum(cond_ent)
return out

conditional_entropy(torch.tensor([[0.1, 0.5], [0.2, 0.3]]),
torch.tensor([0.2, 0.8]))

tensor(0.8635)

def conditional_entropy(p_xy, p_x):
p_y_given_x = p_xy/p_x
cond_ent = -p_xy * log2(p_y_given_x)
# Operator nansum will sum up the non-nan number
out = nansum(cond_ent)
return out

conditional_entropy(tf.constant([[0.1, 0.5], [0.2, 0.3]]),
tf.constant([0.2, 0.8]))

<tf.Tensor: shape=(2,), dtype=float32, numpy=array([0.43903595, 0.42451128], dtype=float32)>

18.11.3.3. Mutual Information¶

Given the previous setting of random variables $$(X, Y)$$, you may wonder: “Now that we know how much information is contained in $$Y$$ but not in $$X$$, can we similarly ask how much information is shared between $$X$$ and $$Y$$?” The answer will be the mutual information of $$(X, Y)$$, which we will write as $$I(X, Y)$$.

Rather than diving straight into the formal definition, let us practice our intuition by first trying to derive an expression for the mutual information entirely based on terms we have constructed before. We wish to find the information shared between two random variables. One way we could try to do this is to start with all the information contained in both $$X$$ and $$Y$$ together, and then we take off the parts that are not shared. The information contained in both $$X$$ and $$Y$$ together is written as $$H(X, Y)$$. We want to subtract from this the information contained in $$X$$ but not in $$Y$$, and the information contained in $$Y$$ but not in $$X$$. As we saw in the previous section, this is given by $$H(X \mid Y)$$ and $$H(Y \mid X)$$ respectively. Thus, we have that the mutual information should be

(18.11.17)$I(X, Y) = H(X, Y) - H(Y \mid X) − H(X \mid Y).$

Indeed, this is a valid definition for the mutual information. If we expand out the definitions of these terms and combine them, a little algebra shows that this is the same as

(18.11.18)$I(X, Y) = E_{x} E_{y} \left\{ p_{X, Y}(x, y) \log\frac{p_{X, Y}(x, y)}{p_X(x) p_Y(y)} \right\}.$

We can summarize all of these relationships in image Fig. 18.11.1. It is an excellent test of intuition to see why the following statements are all also equivalent to $$I(X, Y)$$.

• $$H(X) − H(X \mid Y)$$

• $$H(Y) − H(Y \mid X)$$

• $$H(X) + H(Y) − H(X, Y)$$

Fig. 18.11.1 Mutual information’s relationship with joint entropy and conditional entropy.

In many ways we can think of the mutual information (18.11.18) as principled extension of correlation coefficient we saw in Section 18.6. This allows us to ask not only for linear relationships between variables, but for the maximum information shared between the two random variables of any kind.

Now, let us implement mutual information from scratch.

def mutual_information(p_xy, p_x, p_y):
p = p_xy / (p_x * p_y)
mutual = p_xy * np.log2(p)
# Operator nansum will sum up the non-nan number
out = nansum(mutual.as_nd_ndarray())
return out

mutual_information(np.array([[0.1, 0.5], [0.1, 0.3]]),
np.array([0.2, 0.8]), np.array([[0.75, 0.25]]))

[0.71946025]
<NDArray 1 @cpu(0)>

def mutual_information(p_xy, p_x, p_y):
p = p_xy / (p_x * p_y)
mutual = p_xy * torch.log2(p)
# Operator nansum will sum up the non-nan number
out = nansum(mutual)
return out

mutual_information(torch.tensor([[0.1, 0.5], [0.1, 0.3]]),
torch.tensor([0.2, 0.8]), torch.tensor([[0.75, 0.25]]))

tensor(0.7195)

def mutual_information(p_xy, p_x, p_y):
p = p_xy / (p_x * p_y)
mutual = p_xy * log2(p)
# Operator nansum will sum up the non-nan number
out = nansum(mutual)
return out

mutual_information(tf.constant([[0.1, 0.5], [0.1, 0.3]]),
tf.constant([0.2, 0.8]), tf.constant([[0.75, 0.25]]))

<tf.Tensor: shape=(2,), dtype=float32, numpy=array([0.60246783, 0.1169925 ], dtype=float32)>

18.11.3.4. Properties of Mutual Information¶

Rather than memorizing the definition of mutual information (18.11.18), you only need to keep in mind its notable properties:

• Mutual information is symmetric, i.e., $$I(X, Y) = I(Y, X)$$.

• Mutual information is non-negative, i.e., $$I(X, Y) \geq 0$$.

• $$I(X, Y) = 0$$ if and only if $$X$$ and $$Y$$ are independent. For example, if $$X$$ and $$Y$$ are independent, then knowing $$Y$$ does not give any information about $$X$$ and vice versa, so their mutual information is zero.

• Alternatively, if $$X$$ is an invertible function of $$Y$$, then $$Y$$ and $$X$$ share all information and

(18.11.19)$I(X, Y) = H(Y) = H(X).$

18.11.3.5. Pointwise Mutual Information¶

When we worked with entropy at the beginning of this chapter, we were able to provide an interpretation of $$-\log(p_X(x))$$ as how surprised we were with the particular outcome. We may give a similar interpretation to the logarithmic term in the mutual information, which is often referred to as the pointwise mutual information:

(18.11.20)$\mathrm{pmi}(x, y) = \log\frac{p_{X, Y}(x, y)}{p_X(x) p_Y(y)}.$

We can think of (18.11.20) as measuring how much more or less likely the specific combination of outcomes $$x$$ and $$y$$ are compared to what we would expect for independent random outcomes. If it is large and positive, then these two specific outcomes occur much more frequently than they would compared to random chance (note: the denominator is $$p_X(x) p_Y(y)$$ which is the probability of the two outcomes were independent), whereas if it is large and negative it represents the two outcomes happening far less than we would expect by random chance.

This allows us to interpret the mutual information (18.11.18) as the average amount that we were surprised to see two outcomes occurring together compared to what we would expect if they were independent.

18.11.3.6. Applications of Mutual Information¶

Mutual information may be a little abstract in it pure definition, so how does it related to machine learning? In natural language processing, one of the most difficult problems is the ambiguity resolution, or the issue of the meaning of a word being unclear from context. For example, recently a headline in the news reported that “Amazon is on fire”. You may wonder whether the company Amazon has a building on fire, or the Amazon rain forest is on fire.

In this case, mutual information can help us resolve this ambiguity. We first find the group of words that each has a relatively large mutual information with the company Amazon, such as e-commerce, technology, and online. Second, we find another group of words that each has a relatively large mutual information with the Amazon rain forest, such as rain, forest, and tropical. When we need to disambiguate “Amazon”, we can compare which group has more occurrence in the context of the word Amazon. In this case the article would go on to describe the forest, and make the context clear.

18.11.4. Kullback–Leibler Divergence¶

As what we have discussed in Section 2.3, we can use norms to measure distance between two points in space of any dimensionality. We would like to be able to do a similar task with probability distributions. There are many ways to go about this, but information theory provides one of the nicest. We now explore the Kullback–Leibler (KL) divergence, which provides a way to measure if two distributions are close together or not.

18.11.4.1. Definition¶

Given a random variable $$X$$ that follows the probability distribution $$P$$ with a p.d.f. or a p.m.f. $$p(x)$$, and we estimate $$P$$ by another probability distribution $$Q$$ with a p.d.f. or a p.m.f. $$q(x)$$. Then the Kullback–Leibler (KL) divergence (or relative entropy) between $$P$$ and $$Q$$ is

(18.11.21)$D_{\mathrm{KL}}(P\|Q) = E_{x \sim P} \left[ \log \frac{p(x)}{q(x)} \right].$

As with the pointwise mutual information (18.11.20), we can again provide an interpretation of the logarithmic term: $$-\log \frac{q(x)}{p(x)} = -\log(q(x)) - (-\log(p(x)))$$ will be large and positive if we see $$x$$ far more often under $$P$$ than we would expect for $$Q$$, and large and negative if we see the outcome far less than expected. In this way, we can interpret it as our relative surprise at observing the outcome compared to how surprised we would be observing it from our reference distribution.

Let us implement the KL divergence from Scratch.

def kl_divergence(p, q):
kl = p * np.log2(p / q)
out = nansum(kl.as_nd_ndarray())
return out.abs().asscalar()

def kl_divergence(p, q):
kl = p * torch.log2(p / q)
out = nansum(kl)
return out.abs().item()

def kl_divergence(p, q):
kl = p * log2(p / q)
out = nansum(kl)
return tf.abs(out).numpy()

18.11.4.2. KL Divergence Properties¶

Let us take a look at some properties of the KL divergence (18.11.21).

• KL divergence is non-symmetric, i.e., there are $$P,Q$$ such that

(18.11.22)$D_{\mathrm{KL}}(P\|Q) \neq D_{\mathrm{KL}}(Q\|P).$
• KL divergence is non-negative, i.e.,

(18.11.23)$D_{\mathrm{KL}}(P\|Q) \geq 0.$

Note that the equality holds only when $$P = Q$$.

• If there exists an $$x$$ such that $$p(x) > 0$$ and $$q(x) = 0$$, then $$D_{\mathrm{KL}}(P\|Q) = \infty$$.

• There is a close relationship between KL divergence and mutual information. Besides the relationship shown in Fig. 18.11.1, $$I(X, Y)$$ is also numerically equivalent with the following terms:

1. $$D_{\mathrm{KL}}(P(X, Y) \ \| \ P(X)P(Y))$$;

2. $$E_Y \{ D_{\mathrm{KL}}(P(X \mid Y) \ \| \ P(X)) \}$$;

3. $$E_X \{ D_{\mathrm{KL}}(P(Y \mid X) \ \| \ P(Y)) \}$$.

For the first term, we interpret mutual information as the KL divergence between $$P(X, Y)$$ and the product of $$P(X)$$ and $$P(Y)$$, and thus is a measure of how different the joint distribution is from the distribution if they were independent. For the second term, mutual information tells us the average reduction in uncertainty about $$Y$$ that results from learning the value of the $$X$$’s distribution. Similarly to the third term.

18.11.4.3. Example¶

Let us go through a toy example to see the non-symmetry explicitly.

First, let us generate and sort three tensors of length $$10,000$$: an objective tensor $$p$$ which follows a normal distribution $$N(0, 1)$$, and two candidate tensors $$q_1$$ and $$q_2$$ which follow normal distributions $$N(-1, 1)$$ and $$N(1, 1)$$ respectively.

random.seed(1)

nd_len = 10000
p = np.random.normal(loc=0, scale=1, size=(nd_len, ))
q1 = np.random.normal(loc=-1, scale=1, size=(nd_len, ))
q2 = np.random.normal(loc=1, scale=1, size=(nd_len, ))

p = np.array(sorted(p.asnumpy()))
q1 = np.array(sorted(q1.asnumpy()))
q2 = np.array(sorted(q2.asnumpy()))

torch.manual_seed(1)

tensor_len = 10000
p = torch.normal(0, 1, (tensor_len, ))
q1 = torch.normal(-1, 1, (tensor_len, ))
q2 = torch.normal(1, 1, (tensor_len, ))

p = torch.sort(p)[0]
q1 = torch.sort(q1)[0]
q2 = torch.sort(q2)[0]

tensor_len = 10000
p = tf.random.normal((tensor_len, ), 0, 1)
q1 = tf.random.normal((tensor_len, ), -1, 1)
q2 = tf.random.normal((tensor_len, ), 1, 1)

p = tf.sort(p)
q1 = tf.sort(q1)
q2 = tf.sort(q2)

Since $$q_1$$ and $$q_2$$ are symmetric with respect to the y-axis (i.e., $$x=0$$), we expect a similar value of KL divergence between $$D_{\mathrm{KL}}(p\|q_1)$$ and $$D_{\mathrm{KL}}(p\|q_2)$$. As you can see below, there is only a less than 3% off between $$D_{\mathrm{KL}}(p\|q_1)$$ and $$D_{\mathrm{KL}}(p\|q_2)$$.

kl_pq1 = kl_divergence(p, q1)
kl_pq2 = kl_divergence(p, q2)
similar_percentage = abs(kl_pq1 - kl_pq2) / ((kl_pq1 + kl_pq2) / 2) * 100

kl_pq1, kl_pq2, similar_percentage

(8470.638, 8664.999, 2.268504302642314)

kl_pq1 = kl_divergence(p, q1)
kl_pq2 = kl_divergence(p, q2)
similar_percentage = abs(kl_pq1 - kl_pq2) / ((kl_pq1 + kl_pq2) / 2) * 100

kl_pq1, kl_pq2, similar_percentage

(8582.0341796875, 8828.3095703125, 2.8290698237936858)

kl_pq1 = kl_divergence(p, q1)
kl_pq2 = kl_divergence(p, q2)
similar_percentage = abs(kl_pq1 - kl_pq2) / ((kl_pq1 + kl_pq2) / 2) * 100

kl_pq1, kl_pq2, similar_percentage

(8498.314, 8730.366, 2.69378457341524)

In contrast, you may find that $$D_{\mathrm{KL}}(q_2 \|p)$$ and $$D_{\mathrm{KL}}(p \| q_2)$$ are off a lot, with around 40% off as shown below.

kl_q2p = kl_divergence(q2, p)
differ_percentage = abs(kl_q2p - kl_pq2) / ((kl_q2p + kl_pq2) / 2) * 100

kl_q2p, differ_percentage

(13536.835, 43.88678828000115)

kl_q2p = kl_divergence(q2, p)
differ_percentage = abs(kl_q2p - kl_pq2) / ((kl_q2p + kl_pq2) / 2) * 100

kl_q2p, differ_percentage

(14130.125, 46.18621024399691)

kl_q2p = kl_divergence(q2, p)
differ_percentage = abs(kl_q2p - kl_pq2) / ((kl_q2p + kl_pq2) / 2) * 100

kl_q2p, differ_percentage

(14020.473, 46.504713510747806)

18.11.5. Cross-Entropy¶

If you are curious about applications of information theory in deep learning, here is a quick example. We define the true distribution $$P$$ with probability distribution $$p(x)$$, and the estimated distribution $$Q$$ with probability distribution $$q(x)$$, and we will use them in the rest of this section.

Say we need to solve a binary classification problem based on given $$n$$ data examples {$$x_1, \ldots, x_n$$}. Assume that we encode $$1$$ and $$0$$ as the positive and negative class label $$y_i$$ respectively, and our neural network is parameterized by $$\theta$$. If we aim to find a best $$\theta$$ so that $$\hat{y}_i= p_{\theta}(y_i \mid x_i)$$, it is natural to apply the maximum log-likelihood approach as was seen in Section 18.7. To be specific, for true labels $$y_i$$ and predictions $$\hat{y}_i= p_{\theta}(y_i \mid x_i)$$, the probability to be classified as positive is $$\pi_i= p_{\theta}(y_i = 1 \mid x_i)$$. Hence, the log-likelihood function would be

(18.11.24)\begin{split}\begin{aligned} l(\theta) &= \log L(\theta) \\ &= \log \prod_{i=1}^n \pi_i^{y_i} (1 - \pi_i)^{1 - y_i} \\ &= \sum_{i=1}^n y_i \log(\pi_i) + (1 - y_i) \log (1 - \pi_i). \\ \end{aligned}\end{split}

Maximizing the log-likelihood function $$l(\theta)$$ is identical to minimizing $$- l(\theta)$$, and hence we can find the best $$\theta$$ from here. To generalize the above loss to any distributions, we also called $$-l(\theta)$$ the cross-entropy loss $$\mathrm{CE}(y, \hat{y})$$, where $$y$$ follows the true distribution $$P$$ and $$\hat{y}$$ follows the estimated distribution $$Q$$.

This was all derived by working from the maximum likelihood point of view. However, if we look closely we can see that terms like $$\log(\pi_i)$$ have entered into our computation which is a solid indication that we can understand the expression from an information theoretic point of view.

18.11.5.1. Formal Definition¶

Like KL divergence, for a random variable $$X$$, we can also measure the divergence between the estimating distribution $$Q$$ and the true distribution $$P$$ via cross-entropy,

(18.11.25)$\mathrm{CE}(P, Q) = - E_{x \sim P} [\log(q(x))].$

By using properties of entropy discussed above, we can also interpret it as the summation of the entropy $$H(P)$$ and the KL divergence between $$P$$ and $$Q$$, i.e.,

(18.11.26)$\mathrm{CE} (P, Q) = H(P) + D_{\mathrm{KL}}(P\|Q).$

We can implement the cross-entropy loss as below.

def cross_entropy(y_hat, y):
ce = -np.log(y_hat[range(len(y_hat)), y])
return ce.mean()

def cross_entropy(y_hat, y):
ce = -torch.log(y_hat[range(len(y_hat)), y])
return ce.mean()

def cross_entropy(y_hat, y):
# tf.gather_nd is used to select specific indices of a tensor.
ce = -tf.math.log(tf.gather_nd(y_hat, indices = [[i, j] for i, j in zip(
range(len(y_hat)), y)]))
return tf.reduce_mean(ce).numpy()

Now define two tensors for the labels and predictions, and calculate the cross-entropy loss of them.

labels = np.array([0, 2])
preds = np.array([[0.3, 0.6, 0.1], [0.2, 0.3, 0.5]])

cross_entropy(preds, labels)

array(0.94856)

labels = torch.tensor([0, 2])
preds = torch.tensor([[0.3, 0.6, 0.1], [0.2, 0.3, 0.5]])

cross_entropy(preds, labels)

tensor(0.9486)

labels = tf.constant([0, 2])
preds = tf.constant([[0.3, 0.6, 0.1], [0.2, 0.3, 0.5]])

cross_entropy(preds, labels)

0.94856

18.11.5.2. Properties¶

As alluded in the beginning of this section, cross-entropy (18.11.25) can be used to define a loss function in the optimization problem. It turns out that the following are equivalent:

1. Maximizing predictive probability of $$Q$$ for distribution $$P$$, (i.e., $$E_{x \sim P} [\log (q(x))]$$);

2. Minimizing cross-entropy $$\mathrm{CE} (P, Q)$$;

3. Minimizing the KL divergence $$D_{\mathrm{KL}}(P\|Q)$$.

The definition of cross-entropy indirectly proves the equivalent relationship between objective 2 and objective 3, as long as the entropy of true data $$H(P)$$ is constant.

18.11.5.3. Cross-Entropy as An Objective Function of Multi-class Classification¶

If we dive deep into the classification objective function with cross-entropy loss $$\mathrm{CE}$$, we will find minimizing $$\mathrm{CE}$$ is equivalent to maximizing the log-likelihood function $$L$$.

To begin with, suppose that we are given a dataset with $$n$$ examples, and it can be classified into $$k$$-classes. For each data example $$i$$, we represent any $$k$$-class label $$\mathbf{y}_i = (y_{i1}, \ldots, y_{ik})$$ by one-hot encoding. To be specific, if the example $$i$$ belongs to class $$j$$, then we set the $$j$$-th entry to $$1$$, and all other components to $$0$$, i.e.,

(18.11.27)$\begin{split}y_{ij} = \begin{cases}1 & j \in J; \\ 0 &\text{otherwise.}\end{cases}\end{split}$

For instance, if a multi-class classification problem contains three classes $$A$$, $$B$$, and $$C$$, then the labels $$\mathbf{y}_i$$ can be encoded in {$$A: (1, 0, 0); B: (0, 1, 0); C: (0, 0, 1)$$}.

Assume that our neural network is parameterized by $$\theta$$. For true label vectors $$\mathbf{y}_i$$ and predictions

(18.11.28)$\hat{\mathbf{y}}_i= p_{\theta}(\mathbf{y}_i \mid \mathbf{x}_i) = \sum_{j=1}^k y_{ij} p_{\theta} (y_{ij} \mid \mathbf{x}_i).$

Hence, the cross-entropy loss would be

(18.11.29)$\begin{split}\mathrm{CE}(\mathbf{y}, \hat{\mathbf{y}}) = - \sum_{i=1}^n \mathbf{y}_i \log \hat{\mathbf{y}}_i = - \sum_{i=1}^n \sum_{j=1}^k y_{ij} \log{p_{\theta} (y_{ij} \mid \mathbf{x}_i)}.\\\end{split}$

On the other side, we can also approach the problem through maximum likelihood estimation. To begin with, let us quickly introduce a $$k$$-class multinoulli distribution. It is an extension of the Bernoulli distribution from binary class to multi-class. If a random variable $$\mathbf{z} = (z_{1}, \ldots, z_{k})$$ follows a $$k$$-class multinoulli distribution with probabilities $$\mathbf{p} =$$ ($$p_{1}, \ldots, p_{k}$$), i.e.,

(18.11.30)$p(\mathbf{z}) = p(z_1, \ldots, z_k) = \mathrm{Multi} (p_1, \ldots, p_k), \text{ where } \sum_{i=1}^k p_i = 1,$

then the joint probability mass function(p.m.f.) of $$\mathbf{z}$$ is

(18.11.31)$\mathbf{p}^\mathbf{z} = \prod_{j=1}^k p_{j}^{z_{j}}.$

It can be seen that the label of each data example, $$\mathbf{y}_i$$, is following a $$k$$-class multinoulli distribution with probabilities $$\boldsymbol{\pi} =$$ ($$\pi_{1}, \ldots, \pi_{k}$$). Therefore, the joint p.m.f. of each data example $$\mathbf{y}_i$$ is $$\mathbf{\pi}^{\mathbf{y}_i} = \prod_{j=1}^k \pi_{j}^{y_{ij}}.$$ Hence, the log-likelihood function would be

(18.11.32)\begin{split}\begin{aligned} l(\theta) = \log L(\theta) = \log \prod_{i=1}^n \boldsymbol{\pi}^{\mathbf{y}_i} = \log \prod_{i=1}^n \prod_{j=1}^k \pi_{j}^{y_{ij}} = \sum_{i=1}^n \sum_{j=1}^k y_{ij} \log{\pi_{j}}.\\ \end{aligned}\end{split}

Since in maximum likelihood estimation, we maximizing the objective function $$l(\theta)$$ by having $$\pi_{j} = p_{\theta} (y_{ij} \mid \mathbf{x}_i)$$. Therefore, for any multi-class classification, maximizing the above log-likelihood function $$l(\theta)$$ is equivalent to minimizing the CE loss $$\mathrm{CE}(y, \hat{y})$$.

To test the above proof, let us apply the built-in measure NegativeLogLikelihood. Using the same labels and preds as in the earlier example, we will get the same numerical loss as the previous example up to the 5 decimal place.

nll_loss = NegativeLogLikelihood()
nll_loss.update(labels.as_nd_ndarray(), preds.as_nd_ndarray())
nll_loss.get()

('nll-loss', 0.9485599994659424)

# Implementation of cross-entropy loss in PyTorch combines nn.LogSoftmax()
# and nn.NLLLoss()
nll_loss = NLLLoss()
loss = nll_loss(torch.log(preds), labels)
loss

tensor(0.9486)

def nll_loss(y_hat, y):
# Convert labels to one-hot vectors.
y = tf.keras.utils.to_categorical(y, num_classes= y_hat.shape[1])
# We will not calculate negative log-likelihood from the definition.
# Rather, we will follow a circular argument. Because NLL is same as
# cross_entropy, if we calculate cross_entropy that would give us NLL
cross_entropy = tf.keras.losses.CategoricalCrossentropy(
from_logits = True, reduction = tf.keras.losses.Reduction.NONE)
return tf.reduce_mean(cross_entropy(y, y_hat)).numpy()

loss = nll_loss(tf.math.log(preds), labels)
loss

0.94856

18.11.6. Summary¶

• Information theory is a field of study about encoding, decoding, transmitting, and manipulating information.

• Entropy is the unit to measure how much information is presented in different signals.

• KL divergence can also measure the divergence between two distributions.

• Cross-entropy can be viewed as an objective function of multi-class classification. Minimizing cross-entropy loss is equivalent to maximizing the log-likelihood function.

18.11.7. Exercises¶

1. Verify that the card examples from the first section indeed have the claimed entropy.

2. Show that the KL divergence $$D(p\|q)$$ is nonnegative for all distributions $$p$$ and $$q$$. Hint: use Jensen’s inequality, i.e., use the fact that $$-\log x$$ is a convex function.

3. Let us compute the entropy from a few data sources:

• Assume that you are watching the output generated by a monkey at a typewriter. The monkey presses any of the $$44$$ keys of the typewriter at random (you can assume that it has not discovered any special keys or the shift key yet). How many bits of randomness per character do you observe?

• Being unhappy with the monkey, you replaced it by a drunk typesetter. It is able to generate words, albeit not coherently. Instead, it picks a random word out of a vocabulary of $$2,000$$ words. Let us assume that the average length of a word is $$4.5$$ letters in English. How many bits of randomness per character do you observe now?

• Still being unhappy with the result, you replace the typesetter by a high quality language model. The language model can currently obtain a perplexity as low as $$15$$ points per word. The character perplexity of a language model is defined as the inverse of the geometric mean of a set of probabilities, each probability is corresponding to a character in the word. To be specific, if the length of a given word is $$l$$, then $$\mathrm{PPL}(\text{word}) = \left[\prod_i p(\text{character}_i)\right]^{ -\frac{1}{l}} = \exp \left[ - \frac{1}{l} \sum_i{\log p(\text{character}_i)} \right].$$ Assume that the test word has 4.5 letters, how many bits of randomness per character do you observe now?

4. Explain intuitively why $$I(X, Y) = H(X) - H(X|Y)$$. Then, show this is true by expressing both sides as an expectation with respect to the joint distribution.

5. What is the KL Divergence between the two Gaussian distributions $$\mathcal{N}(\mu_1, \sigma_1^2)$$ and $$\mathcal{N}(\mu_2, \sigma_2^2)$$?


text:
# Multiplication of cardinal numbers

Let $a_i$ be a cardinal number for every $i \in\ I$.

Let $\{A_i\}$ and $\{A'_i\}$ be families of sets and let $A_i$, $A'_i$ and $a_i$ be equipotent for every $i \in I$.

Then show that $\prod_i\ A_i$ is equipotent with $\prod_i\ A'_i$.

This seems obviously true but I don't know how to actually show the bijection between them..

-
Hint: Since you are given that $A_i$ and $A_i\!'$ are equipotent for each $i$, you can assume that you have a collection of bijections $f_i$, where $f_i$ is a bijection between $A_i$ and $A_i\!'$. These are your raw materials. Your job is to figure out how to build the bijection for the product out of these raw materials. –  MJD May 14 '12 at 18:59
It really feels that you are afraid to try things on your own. You should know that without chewing a lot on problems and trying hard you will not learn how to do this on your own. I say that because you ask questions which often appear in a rather similar form on this site before, and you often accept the answer in minutes. This signals me that you haven't really tried to tackle the problem on your own before asking. –  Asaf Karagila May 14 '12 at 19:27
Note that this is basically a reformulation of this question –  Martin Sleziak May 15 '12 at 7:22

For each $i\in I$ you have a bijection $\varphi_i:A_i\to A'_i$. Define $$\varphi:\prod_{i\in I}A_i\to\prod_{i\in I}A'_i:\langle a_i:i\in I\rangle\mapsto\Big\langle\varphi_i(a_i):i\in I\Big\rangle$$ and prove that it’s a bijection.
This is what I call a follow-your-nose proof: there really is only one reasonable thing to try. All you’re given is the equipotence of $A_i$ and $A'_i$ for $i\in I$. All that gives you is the existence of the bijections $\varphi_i$, so either the result is very hard (unlikely) or somehow it must be possible to use those bijections to get the one that you want. Since a typical element of $\prod_iA_i$ is just a function $\langle a_i:i\in I\rangle$ from $I$ to $\bigcup_iA_i$, about the only thing to try is to apply the bijections $\varphi_i$ to the components of $\langle a_i:i\in I\rangle$.


text:
Image Details

Choose export citation format:

Neutrino Emissions in All Flavors up to the Pre-bounce of Massive Stars and the Possibility of Their Detections

• Authors: Chinami Kato, Hiroki Nagakura, Shun Furusawa, Koh Takahashi, Hideyuki Umeda, Takashi Yoshida, Koji Ishidoshiro, and Shoichi Yamada

2017 The Astrophysical Journal 848 48.

• Provider: AAS Journals

Caption: Figure 5.

Time evolution of the neutrino number luminosity for the ﹩15\ {M}_{\odot }﹩ progenitor model. The origin of the horizontal axis corresponds to the time the dynamical simulation is started. Dotted and solid lines show the results for ﹩{{\nu }}_{{e}}﹩ and ﹩{\bar{{\nu }}}_{{e}}﹩ , respectively. Colors distinguish the different reactions. In the collapse phase, only the total luminosity is shown for ﹩{\nu }_{e}﹩ (pink dotted), since it is the quantity that the dynamical simulation provides. Note that the same number of ﹩{\nu }_{e}﹩ and ﹩{\bar{\nu }}_{e}﹩ is produced from electron–positron pair annihilations (red solid).

Show More