text:
Assuming reference data is all on forward strand, check if the GWAS is also. Use some threshold e.g. if more than 90 need to be flipped then it's likely that the dataset is on the forward strand

is_forward_strand(
gwas_snp,
gwas_a1,
gwas_a2,
ref_snp,
ref_a1,
ref_a2,
threshold = 0.9
)

## Arguments

gwas_snp Vector of SNP names for the dataset being checked Vector of alleles Vector of alleles Vector of SNP names for the reference dataset Vector of alleles Vector of alleles =0.9 If the proportion of allele strands match is above this threshold, then declare the dataset to be on the forward strand

## Value

1 = Forward strand; 2 = Not on forward strand

## Details

This function can be used to evaluate how strict harmonisation should be The trade off if you assume we are not on the forward strand then palindromic SNPs are dropped within a particular frequency range But you could instead have some small probability of error for whether palindromic SNPs are on the forward strand, and avoid dropping too many variants.


text:
### Cache's blog

By Cache, history, 19 months ago, ,

Hello CodeForces Community!

We’re excited to announce the September Long Challenge sponsored by ShareChat. Along with the opportunity to boost your ratings and win some cool laddus, there are some exciting full-time job opportunities with ShareChat for professionals across the globe. More details about the job opportunities can be found on the contest page.

• Problem Tester: teja349 (Teja Vardhan Reddy)

• Problem Setters: (Shivam Gupta ), XORier (Priyanshi Gupta), adamant (Oleksandr Kulkov ), step_by_step (Stepan Filippov), bciobanu (Bogdan Ciobanu), rajat1603 (Rajat De), DOlaBMOon (Max Hsia)

• Problem Editorialist: vijju123 (Abhishek Pandey)

• Statement Verifier: Xellos (Jakub Safin)

• Russian Translator: Fedosik (Fedor Korobeinikov)

• Mandarin Translator: huzecong (Hu Zecong)

• Vietnamese Translator: VNOI Team

I hope you will enjoy solving them. Please give your feedback on the problem set in the comments below, after the contest.

### Contest Details:

Time: 7th September 2018 (1500 hrs) to 17th September (1500 hrs). (Indian Standard Time — +5:30 GMT) — Check your timezone.).

Registration: You just need to have a CodeChef handle to participate. For all those, who are interested and do not have a CodeChef handle, are requested to register in order to participate.

Prizes: Top 10 performers in Global and Indian category will get CodeChef laddus, with which the winners can claim cool CodeChef goodies. Know more here: discuss.codechef.com/questions/51999/how-do-i-win-a-codechef-goodie.
(For those who have not yet got their previous winning, please send an email to winners@codechef.com). First to solve each problem individually: 100 laddus (For problems common to both Divisions, only one user will get laddus for that problem).

Good Luck!
Hope to see you participating!!

• +111

 » 19 months ago, # |   0 Auto comment: topic has been updated by teja349 (previous revision, new revision, compare).
 » 19 months ago, # |   0 I hope no one solves the last question. :P
•  » » 19 months ago, # ^ |   0 Hope for something better. ;P
 » 19 months ago, # |   0 How to solve TAB GAME subtask 2, (with proof )
•  » » 19 months ago, # ^ | ← Rev. 7 →   +3 Hint: For all points in the set S = {(i, j) | i >= 3 and j >= 3}, (i, j) = 0 if and only if (i-1, j-1) = 0. You can prove this by contradiction. Proof that if (i, j) = 0, (i-1, j-1) = 0: Let(i, j) = 0. Assume that (i-1, j-1) = 1. Since (i, j) = 0, (i-1, j) = 1 and (i, j-1) = 1.Since (i-1, j) = 1 and (i-1, j-1) = 1, (i-2, j) = 0. Similarly (i, j-2) = 0.Since (i-2, j) = 0, (i-2, j-1) = 1. Similarly, since (i, j-2) = 0, (i-1, j-2) = 1.Since (i-2, j-1) = 1 and (i-1, j-2) = 1, (i-1, j-1) = 0.This contradicts our assumption.So if (i, j) = 0, (i-1, j-1) = 0.The converse:If (i-1, j-1) = 0, then (i, j-1) = (i-1, j) = 1. So (i, j) = 0.So if (i-1, j-1) = 0, (i, j) = 0. Rest of the solution should be simple.
•  » » » 19 months ago, # ^ |   0 if (i-1, j-1) = 0, then (i, j) = 0 is obvious by contradiction, but how to prove the converse?
•  » » » » 19 months ago, # ^ |   0 Added the converse.
•  » » » » » 19 months ago, # ^ |   0 May be I'm missing something but how did you get this If (i-1, j-1) = 1, then (i, j-1) = (i-1, j) = 1. So (i, j) = 0.
•  » » » » » » 19 months ago, # ^ |   0 Sorry, that was a typo. It should be If (i-1, j-1) = 0.
 » 19 months ago, # |   0 Can someone explain the logic behind Bad Shuffle problem?. I tried running the algorithm given in the problem 100000 times and then finding the permutation with maximum and minimum frequency but obviously, it will barely made through the first subtask. As it seems there is propper algorithmic solution to the problem as I saw in this solution here. Can someone explain the proof of this solution.
•  » » 19 months ago, # ^ | ← Rev. 3 →   0 I haven't tried yet, but I guess it can be proved by considering a graph just similar to this
•  » » 19 months ago, # ^ |   0 Don't know the proof, but it's similar to my solution. Found out how it works after backtracking for small cases.
•  » » 19 months ago, # ^ |   0 It reduces to a pattern finding problem. As DrumpfTheGodEmperor said, you brute force it for for all cases from n = 1 to 8, write down the permutations which have minimum and maximum frequencies and try to find a pattern between them, that gives you a generalized solution for any n.
 » 19 months ago, # |   +8 Not very important, but did codechef reduce the number of Indian participants getting laddus from 20 to 10?
 » 19 months ago, # |   0 How to solve ANDSQR ? I know that it must be solved with datastructure segment tree or something like that ,but i don't know how to use it in this task . Can someone to explain me solution?
•  » » 19 months ago, # ^ |   0 Maximum number of set bits in a number will be 30. Hence the bitwise and value starting from any particular a[i] will change at most 30 times. Go backwards starting from any i and check where the and value (initial value = a [i]) changes . You should be able to do it in 30 iterations max. For this just keep track of the index where the the particular bit was unset for each bit . This way you will be able to find no. Of good sequences in whole array . Use segment trees to find the count of good sequences in range . If you are not clear mention which part.
•  » » » 19 months ago, # ^ |   0 thanks very much for explain to me shaanknight !
 » 19 months ago, # |   0 Can anyone provide the prerequisites and idea for the FCTR question ?
•  » » 19 months ago, # ^ |   +3 algmyr was kind enough to write an editorial here.
 » 19 months ago, # | ← Rev. 5 →   +5 I checked the top submission for CHEFLST question . The implementation and complexity is understandable but can anyone explain how are all numbers guaranteed to picked by this algo, please . Link in Traxexeuler's reply .
•  » » 19 months ago, # ^ | ← Rev. 3 →   +20 That solution is wrong. The test cases are pretty weak. 1 3 0 0 0 0 0 1 0 1 0 The correct answer is 0 1 but the code prints 0.Your link is broken btw: https://www.codechef.com/viewsolution/20056532
•  » » » 19 months ago, # ^ | ← Rev. 2 →   +2 Thanks for pointing out. If you have solved the question can you please help what is the actual solution for the question ? Is it something related to finding determinant for a matrix as it looks we need to pick up elements from every row , every column , basically what a determinant for a matrix does .
•  » » » » 19 months ago, # ^ |   +18 After some more investigation, about half of the 100pt submissions seem to be wrong. That's ridiculous, CHEFLST was the hardest problem!I did not solve it myself, and now I feel sad for the people who did come up with proper solutions.I was told that this approach is correct: https://www.codechef.com/viewsolution/20118711
•  » » » » » 19 months ago, # ^ | ← Rev. 2 →   -6 Deleted. As it hurts some
 » 19 months ago, # |   +2 What is the idea behind problem Chef and Lost Story?
•  » » 19 months ago, # ^ |   +65 Let s = 10, such that all entries of M are  < 2sConsider a matrix H whose entries are polynomials Hij = xMij. Now, if we find the permanent of this matrix under xor convolution, then the answer would be powers with non-zero coefficients. But sadly, we can't find permanent in polynomial time. Instead, multiply each entry of H by a random integer, and find the determinant, and by Schwartz–Zippel lemma, we would get the right answer with a high probability.To find the determinant, we can use evaluation and interpolation in a XOR-FFT fashion (considering the resultant as a multivariate polynomial in s variables, and evaluating determinant at roots of unity, (in this case, { - 1, 1}s). Overall complexity is O(n32s)Link to solution

format: plain


text:
# Wavetable and Nyquist: which size do I need?

I was reading this tutorial by the master earlevel, while trying to build some sort of wavetable.

He says First, let’s back up and figure out how long our tables need to be. Recalling that we need to sample a signal at greater than twice the highest frequency component, that means that for 368 harmonics, we need at least 368 x 2 + 1 samples, or a table length of at least 737 samples., refering to a 40hz (lowest wavetable frequency) and the following harmonics (up to 14720 hz).

Not really sure about those 737 samples keeping the sampling theorem by Nyquist. Should be 40 * 368 * 2 + 1 samples needed? That's the real "highest frequency component" of the signal. Why 368 * 2 + 1?

Not really sure why I just need a 737 samples to express a signal that reach ~15khz.

• If you want a fundamental at 40 Hz, you need one complete sine/cosine at 40Hz to be covered by the table. This table could be played back-to-back at 40 times/second in order to produce a continous 40Hz sinoid waveform. As sines are boring in the long run, you might want to add harmonics. The more samples in the table (still repeated at 40 times/s), the more harmonics you can add. This translates into a higher samplerate. 737x40=29480 samples/second, sufficient for a tone of ~15kHz? – Knut Inge Mar 16 at 19:54

The wavetable is ignorant or agnostic about the playback rate and the sample rate in Hz. What the wavetable knows about is how many points or samples define the waveform, $$N$$. All it knows is the amplitude and phase of every harmonic (which are two numbers for each harmonic), and with a little bit of nuance regarding the DC component and, if the number of wavetable samples is even, the Nyquist component.

There is no phase property of the DC component, just a bipolar amplitude, which is fully described by one real number.

Because of aliasing, the Nyquist component must be a cosine component with no sine component to it at all.

So if $$N$$ is odd, you can fully define the DC component and both the amplitude and phase of $$\frac{N-1}{2}$$ harmonics, all below Nyquist.

If $$N$$ is even, you can fully define the DC component, the amplitude and phase of $$\frac{N}{2}-1$$ harmonics below Nyquist, and only the bipolar amplitude of the harmonic at Nyquist.

In all cases, $$N$$ real numbets fully define the wavetable and the DFT maps these $$N$$ numbers to the harmonic amplitude and phase data which are also fully defined by $$N$$ real numbers.

The fundamental frequency is fixed at $$40Hz$$, that means you will sample a period of 1/40 second.

The Nyquist frequency says that you must sample your signal twice every period for any relevant frequency.

If you take $$737$$ samples, you have 736 periods (the first sample is at time zero). If you take these samples at a constant rate in a period of $$1/40$$ second, it means that the sampling period is $$1/40/736=1/1/29440$$ second (29440 samples per second), and the corresponding nyquist frequency is $$(29440/s)/2 = 14720Hz$$

• I really don't get it :) Let me iterate in another way. How many samples do I need for sampling a signal of 22050hz? 44100 right? (as the minimun sample rate in any daw, for example). Not sure why I just need 737 samples here for sampling a signal of 14720hz :O It doesn't make sense... – markzzz Mar 15 at 16:29
• I mean: 44100 : 22050 = 29440 : 14720, not 44100 : 22050 = 29440 : 736 :O – markzzz Mar 15 at 16:47
• Notice that he is talking about number of samples in a period of 1/40 second, not samples per second. – Bob Mar 15 at 18:20
• I see. But in any case, he sample a signal of near 15khz into a table with 2048 samples :O Can't understand how this is sufficient... – markzzz Mar 15 at 18:28
• The number of samples is independent of the sampling frequency. You could have 10 samples of a signal of 20kHz at sample rate of 100kHz, that would correspond to 0.1ms, there is nothing wrong with this, but in this case you would be unable to detect low frequencies. – Bob Mar 15 at 18:37


text:
measure zero point in differentiable “almost everywhere”

I am a new student in leaning real analysis and still confused about "almost everywhere.

Definition:

Points $x\in \mathcal{X}$ is true except for $x$ in some null set (with measure $0$) ", we way it is true a.e.

Example:

"Differentiable almost everywhere" means differentiable at every point outside a set of (Lebesgue) measure zero $\mu = 0$.

My question is:

Where is the set with measure zero in real line for example?

Hope to construct correct concept.

• What do you mean the measure at 0 is 0? $\mu$ is a set function, so you are measuring sets. It only makes sense to talk of $\mu(\{0\})$, which does make sense and is 0 if $\mu$ is Lebesgue. Secondly, what do you mean measure zero in the real line? Are you asking for a subset of $ℝ$ with measure 0? It makes no sense to talk of $\mu(\{±∞\})$ with $\mu$ a measure on $ℝ$, and you specifically mentioned the real line. – Calvin Khor Oct 7 '15 at 6:39
• I should ask where is the null set (measure 0) when discussing a function $f: \mathbb{R} \mapsto \mathbb{R}$. For example, $f(x) = x^2$ – sleeve chen Oct 7 '15 at 6:44
• Forget about measure zero for the moment, first do you understand what is a measure? – user99914 Oct 7 '15 at 6:46
• What prior knowledge do you have? From the question it sounds that you're out on deep water here. Do you know the Lebesgue Integral? Do you know what a measure is? If you don't you should probably start there. – skyking Oct 7 '15 at 6:53
• @sleevechen there are sets (some very weird) other than intervals with measure 0. I think it might be useful for you to work towards is the construction of Lebesgue measure via the infimum of open covers definition. – Calvin Khor Oct 7 '15 at 6:58

Differentiability a.e. means that there is some null set $N$ such that your function (say) $f$ is differentiable on $ℝ \setminus N$. This null set depends on $f$. One example is $$f(x) = |x|$$ This function has $N=\{0\}$. Another is the Cantor function, and it is differentiable a.e. with derivative $0$, and is not differentiable on the Cantor set. Yet another example is $$f(x) = 1$$ This function is differentiable a.e., in fact its differentiable everywhere but this doesn't stop you from setting $N=∅$.
• @sleevechen It means that every function that is "differentiable everywhere" is also "differentiable a.e.", going strictly by the definition. Why? Because we can find an $N$ that works in the definition of "differentiable a.e."; that $N$ is the empty set. – Calvin Khor Oct 7 '15 at 6:53


text:
# If A=((-4, 5),(3, 2)) and B=((-6, 2), (1/2, 3/4)), what is AB?

Oct 18, 2014

Multiply each row of the first matrix by each column of the second matrix.

$\left(- 4 \cdot - 6\right) + \left(5 \cdot \frac{1}{2}\right)$ will be the upper left element
$\left(- 4 \cdot 2\right) + \left(5 \cdot \frac{3}{4}\right)$ will be the upper right element
$\left(3 \cdot - 6\right) + \left(2 \cdot \frac{1}{2}\right)$ will be the lower left element
and
$\left(3 \cdot 2\right) + \left(2 \cdot \frac{3}{4}\right)$ will be the lower right element.

Cleaning up we get $\left(24 + \frac{5}{2} = \frac{52}{2}\right)$ upper left
$\left(- 8 + \frac{15}{4} = - \frac{17}{4}\right)$ upper right,
$\left(- 18 + 1 = - 17\right)$ lower left and,
$\left(6 + \frac{1}{2} = \frac{15}{2}\right)$ for lower right.

$\left(\frac{53}{2} , - \frac{17}{4}\right)$
$\left(- 17 , \frac{15}{2}\right)$


text:
# ________ is observation through research and the scientific investigation.

###### Question:

________ is observation through research and the scientific investigation.

### 2x+3y=12 what is this in slope intercpet form? 3x+2y=-8 what is this in slope intercept form?

2x+3y=12 what is this in slope intercpet form? 3x+2y=-8 what is this in slope intercept form?...

### Read this excerpt from "The All-American Slurp." Father, being an engineer, was always systematic. He took out a pocket French dictionary. "They told me that most of the items would be in French, so I came prepared." He even had a pocket flashlight, the size of a marking pen. While Mother held the flashlight over the menu, he looked up the items that were in French. What story element does the author develop in this excerpt?

Read this excerpt from "The All-American Slurp." Father, being an engineer, was always systematic. He took out a pocket French dictionary. "They told me that most of the items would be in French, so I came prepared." He even had a pocket flashlight, the size of a marking pen. While Mother held the f...

### 3. What document, adopted July 4, 1776, set forth a philosophy of human freedom that would become a dynamic force throughout the world?

3. What document, adopted July 4, 1776, set forth a philosophy of human freedom that would become a dynamic force throughout the world?...

### Explain how Korean was divided between the northern half and the southern half. how did this division occur? where did this division occur

Explain how Korean was divided between the northern half and the southern half. how did this division occur? where did this division occur...

### What would be the kinetic energy of an arrow having a potential energy of 50 J after it is shot from a bow?

What would be the kinetic energy of an arrow having a potential energy of 50 J after it is shot from a bow?...

### Share £60 in the ratio 3:1

share £60 in the ratio 3:1...

### Part A In "Ocean Noise," what can be inferred about noise pollution in the ocean? A. A single instance of noise pollution can affect marine life over great distances. B. Even the smallest amounts of noise pollution kill large numbers of marine life. C. Certain sounds are quiet enough to not be amplified in the ocean. D. Small amounts of noise pollution are not dangerous to marine life at all. Part B Which evidence from the text best supports the answer to Part A? A. "Many of us think of the ocea

Part A In "Ocean Noise," what can be inferred about noise pollution in the ocean? A. A single instance of noise pollution can affect marine life over great distances. B. Even the smallest amounts of noise pollution kill large numbers of marine life. C. Certain sounds are quiet enough to not be ampli...

### What is a Permission?

what is a Permission?...

### 1. The following question refers to the section "I am Laertes' son...": King Alcinous invites Odysseus to what function? A meeting A banquet A war A funeral

1. The following question refers to the section "I am Laertes' son...": King Alcinous invites Odysseus to what function? A meeting A banquet A war A funeral...

### Pls help me answer number 2.

pls help me answer number 2....

### How are Free and Latin elements used to create words in English

How are Free and Latin elements used to create words in English...

### If someone had five cookies and decided to divide it by four people how much cookies would each person get.

If someone had five cookies and decided to divide it by four people how much cookies would each person get....

### Question  4What is the ideal amount of time for a dementia patient to spendon a single activity before moving on to something new?45 minutes20 minutes30 minutes15 minutes

Question  4What is the ideal amount of time for a dementia patient to spendon a single activity before moving on to something new?45 minutes20 minutes30 minutes15 minutes...

### I am a alkaline earth metal. A. Chromium B. Molybdenum C. Tungsten D. Seaborgium

I am a alkaline earth metal. A. Chromium B. Molybdenum C. Tungsten D. Seaborgium...

### Where was oil first discovered in Texas?

Where was oil first discovered in Texas?...

### I need help.............

I need help................

### If A and B are independent events, P(A and B) = A. P(A)B. P(B)C. P(A) * P(B)D. P(A) + P(B)

If A and B are independent events, P(A and B) = A. P(A)B. P(B)C. P(A) * P(B)D. P(A) + P(B)...


text:
COMMUTING POWERS AND EXTERIOR DEGREE OF FINITE GROUPS

Title & Authors
COMMUTING POWERS AND EXTERIOR DEGREE OF FINITE GROUPS
Niroomand, Peyman; Rezaei, Rashid; Russo, Francesco G.;

Abstract
Recently, we have introduced a group invariant, which is related to the number of elements $\small{x}$ and $\small{y}$ of a finite group $\small{G}$ such that $\small{x{\wedge}y=1_{G{\wedge}G}}$ in the exterior square $\small{G{\wedge}G}$ of $\small{G}$. This number gives restrictions on the Schur multiplier of $\small{G}$ and, consequently, large classes of groups can be described. In the present paper we generalize the previous investigations on the topic, focusing on the number of elements of the form $\small{h^m{\wedge}k}$ of $\small{H{\wedge}K}$ such that $\small{h^m{\wedge}k=1_{H{\wedge}K}}$, where $\small{m{\geq}1}$ and $\small{H}$ and $\small{K}$ are arbitrary subgroups of $\small{G}$.
Keywords
m-th relative exterior degree;commutativity degree;exterior product;Schur multiplier;homological algebra;
Language
English
Cited by
1.
THE PROBABILITY THAT AND COMMUTE IN A COMPACT GROUP, Bulletin of the Australian Mathematical Society, 2013, 87, 03, 503
2.
Probabilistic properties of the relative tensor degree of finite groups, Indagationes Mathematicae, 2016, 27, 1, 147
3.
The Influence of the Complete Nonexterior Square Graph on some Infinite Groups, Lithuanian Mathematical Journal, 2016, 56, 4, 492
4.
Problems of Connectivity between the Sylow Graph,the Prime Graph and the Non-Commuting Graph of a Group, Advances in Pure Mathematics, 2012, 02, 06, 391
References
1.
F. R. Beyl, U. Felgner, and P. Schmid, On groups occurring as center factor groups, J. Algebra 61 (1979), no. 1, 161-177.

2.
R. Brown, D. L. Johnson, and E. F. Robertson, Some computations of nonabelian tensor products of groups, J. Algebra 111 (1987), no. 1, 177-202.

3.
R. Brown and J.-L. Loday, Van Kampen theorems for diagrams of spaces, Topology 26 (1987), no. 3, 311-335.

4.
J. H. Conway, R. T. Curtis, S. P. Norton, R. A. Parker, and R. A. Wilson, Atlas of Finite Groups, Oxford University Press, Oxford, 1985.

5.
A. K. Das and R. K. Nath, On the generalized relative commutative degree of a finite group, Int. Electr. J. Algebra 7 (2010), 140-151.

6.
G. Ellis, The Schur multiplier of a pair of groups, Appl. Categ. Structures 6 (1998), no. 3, 355-371.

7.
A. Erfanian, P. Lescot, and R. Rezaei, On the relative commutativity degree of a subgroup of a finite group, Comm. Algebra 35 (2007), no. 12, 4183-4197.

8.
P. Lescot, Isoclinism classes and commutativity degrees of finite groups, J. Algebra 177 (1995), no. 3, 847-869.

9.
P. Lescot, Central extensions and commutativity degree, Comm. Algebra 29 (2001), no. 10, 4451-4460.

10.
P. Niroomand and R. Rezaei, On the exterior degree of finite groups, Comm. Algebra 39 (2011), no. 1, 335-343.

11.
P. Niroomand and R. Rezaei, The exterior degree of a pair of finite groups, E-print, Cornell University Library, arXiv:1101.4312v1, 2011.

12.
P. Niroomand and F. G. Russo, A note on the exterior centralizer, Arch. Math. (Basel) 93 (2009), no. 6, 505-512.


text:
Browse Questions

# In which of the following remote sensing technique is not used

$\begin{array}{1 1}(a)\; \text{Forest density}\\(b)\; \text{Pollution}\\(c)\;\text{Mapping}\\(d)\;\text{Medical treatment}\end{array}$

Can you answer this question?

Remote sensing technique is not used in medical treatment.
Hence (d) is the correct option.
answered Mar 17, 2014


text:
# Compactifications of the moduli space of plane quartics and two lines

European Journal of Mathematics, Apr 2018

We study the moduli space of triples $$(C, L_1, L_2)$$ consisting of quartic curves C and lines $$L_1$$ and $$L_2$$. Specifically, we construct and compactify the moduli space in two ways: via geometric invariant theory (GIT) and by using the period map of certain lattice polarized K3 surfaces. The GIT construction depends on two parameters $$t_1$$ and $$t_2$$ which correspond to the choice of a linearization. For $$t_1=t_2=1$$ we describe the GIT moduli explicitly and relate it to the construction via K3 surfaces.

This is a preview of a remote PDF: https://link.springer.com/content/pdf/10.1007%2Fs40879-018-0248-7.pdf

Patricio Gallardo, Jesus Martinez-Garcia, Zheng Zhang. Compactifications of the moduli space of plane quartics and two lines, European Journal of Mathematics, 2018, 1-35, DOI: 10.1007/s40879-018-0248-7


text:
# Statistical Mixture of N States in the Hartree-method.

1. Jan 3, 2007

### Jezuz

In the Hartree model of interacting electrons one assumes that the wave function is in the form
$$\Psi(x_1, x_2, ..., x_N,t) = \psi_1(x_1,t) \psi_2(x_2, t) ... \psi_N(x_N,t)$$
which of course is a quite crude approximation since it for example does not take into account Pauli principle.

I have studied some recent articles in plasma physics which starts from this expression and then derives a fluid equation (for example, G. Manfredi, arxiv:quant-ph/0505004).

From the form above it is then claimed that this can be represented by a one-particle density matrix
$$\rho(x,y) = \sum_{i=1}^N p_i \psi_i^*(x) \psi_i(y)$$
where $$p_i$$ are the "occupation probabilities".

Does any one know how to obtain this form of the density matrix?

If one would have started with a completely anti-symmetric wave function and calculated the density matrix (by tracing over $$N-1$$ particles) then I can guess that the result would be similar to this, but then I think that the probabilites would be $$1/N$$.

Does the form of the density matrix above possible to derive from that the particles are intdistinguishable or is it just some plausible arguments which gives the form above?

2. Jan 3, 2007

### mlukowski

It is iteration method, see in: P. Ring, P. Schuck: The nuclear Many-Body Problem, Springer Verlag, New York 1980. Really good book!

3. Jan 3, 2007

### Jezuz

Thx for the tips!

4. Jan 3, 2007

### Dr Transport

If memory serves me corectly, use a Slater Determinant for the wave function and it take care of the Exlusion Principle.

5. Jan 3, 2007

### Jezuz

Yes, the exclusion principle can be accounted for. It is called Hartree-Fock theory, but I don not need do consider the antisymmetry for the moment.

The thing is that I don't understand how they get the density matrix. Usually, if you have a distribution for different states that a particle may have $$\{ \psi_i(x) \}$$ with probabilities $$p_i$$ then the density matrix is
defined as the one above.

However, I am dealing with many particles, but the density matrix is a one-particle density matrix. (?)

6. Jan 3, 2007

### mlukowski

1. As You probably know it is impossible to solve many-body (more than 4) with interactions. That's why HF procedure leads to one-body problem i.e. many particles (but without interactions between them) embeded into ,,avarage" potential. You can then treat particle as if it has no neighbour. HF procedure works, but in my opinion is not physical.
2. If memory serves me corectly, old interpretation of density matrix is that it represents ensemble of particles. It is no difference between density matrix which represents one particle in fixed state and density matrix which represents many particles, all in the same state! (see: Feynmann, ,,Statistical Mechanics")

7. Jan 18, 2007

### Jezuz

Hmm, the reason to introduce the density matrix is allways to allow for a statistical distribution of states. In some cases however you may use the single or two-particle density matrix when doing calculations on a many-particle system.

The density matrix for a particle in a fixed state $$\psi$$ is
$$\rho = \left| \psi \right> \left< \psi \right|$$

and the density matrix for a many particle system where the particles are all in the same state (and hence has to be bosons) is given by
$$\rho = \left| \psi \right> \left< \psi \right| \otimes \left| \psi \right> \left< \psi \right| \otimes \dots \otimes \left| \psi \right> \left< \psi \right|$$,
so apparently there is a difference. However, since all particles are in the same state you can trace out all particles but one som the single particle density matrix above can be used.


text:
## Expression simplification

I have this term

Sqrt[(B Bc)/(A^2-B Bc)]Sqrt[B Bc+A(-A+Sqrt[A^2-B Bc])]Sqrt[-B Bc+A(A + Sqrt[A^2-B Bc])],

which actually can be simplified to B*Bc. However, it seems Mathematica cannot simplify it. Any suggestions on how I’d be able to do that? Thanks.

## Cannot assign raw object 2

My objective is to build a function using modules that runs the bisection method. I have a working bisection method but when I try to implement it as a module I keep getting this error and I can’t figure out why.

F[z_]:=3 + z + z^2 * Cos[z]   bisectionMethod[f_, a_, b_, n_] := Module[   {},   For[i = 0, i < n, i++,    Print[StringForm["Loop #: ", i + 1]];    c = (a + b)/2;    y = f[c];    If[y < 0, a = c];    If[y > 0, b = c];    Print[StringForm["a = ", N[a]]];    Print[StringForm["b  = ", N[b]]];    c = (a + b)/2;    Print[StringForm["c = ", N[c]]];    Print[N[f[c]]];    ]      ] bisectionMethod[F, -4 , 2 , 10]

After being run

  Loop #: 1  Set::setraw: Cannot assign to raw object 2.  a = -4.  b  = 2.  c = -1.  2.5403  Loop #: 2  Set::setraw: Cannot assign to raw object 2.  a = -4.  b  = 2.  c = -1.  2.5403

The issue appears to be specifically variable b but I have no idea how b is any different from the others and how to tackle this.

I did a little bit of experimentation and it seems like the line If[y > 0, b = c]; is problematic

## How to write code for left hand rule

Find an example of a function f(x) on an interval [a,b] so that the left (or right) rule gives zero error. Show the left/right hand rule computation, computation of the exact value of the integral, the maximum error estimate, and the actual error.

## Replacing $x,y$ in $f(x,y,z)$ with values from a list

I’m sure there is a simple solution to this using map or apply, but its not occurring to me.

Suppose I have a function $$f(x,y,z)= x+y+z)$$

And I want to evaluate $$f(x,y,1)$$ for $$\{x,y\} ∈ \{\{1,2\},\{3,4\}\}$$

What is the best way to do this?

Examples:

If I use f[x_,y_,z_]:= x+y+z; f[#1,#2,1]&/@ {{1,2},{3,4}}

this will give me things like {{2+#2,3+#2}}.

On the other hand, Apply works on a single element f[#1,#2,1]& @@ {1,2} but not on a list such as {{1,2},{3,4}}. On the list it gives me {f[1,3,1],f[2,4,1]

I am not sure how to go from the case of a single pair to a list of pairs

## Animate ellipse drawing

$$(x/3)^2+(y/5)^2=1$$, $$x=3\sin[t]$$, $$y=5 \cos[t]$$

I want to draw a phase trajectory with time-lapse using manipulate or animate.

Manipulate[ParametricPlot[(x/3)^2 + (p/5)^2 == 1, {x, -3, 3}, {p, -5, 5}], {t, 0, 10}] I tried this code. It is not working. What is the proper version?

## Optimizing a slow For loop

I know that this is a "beginner question", and, in fact, I am. I want to improve my code, as it takes really too much time to run. I have already read some other discussions, like here, but I am struggling in translating the simplifications with Table or Do into my example.

The For cycle I want to improve is the following:

zh = 0.4; list = {}; eqdiff = phi''[x] + 2*phi'[x]/x + (2*(zg + zh*Exp[-zh*x/dh])/x + 1)*phi[x] == 0; For[i = 0, i < 10000, i++,      With[{zg = -0.6, dh = i*10^-2},           nsol = Block[{eps = \$  MachineEpsilon},           NDSolve[{eqdiff, phi[eps] == 1, phi'[eps] == -(zg + zh)}, phi, {x, eps, 20000},                   WorkingPrecision->MachinePrecision, AccuracyGoal->15, PrecisionGoal->8, MaxSteps->Infinity]]];       AppendTo[list, 1/Evaluate[(15000*phi[15000])^2 + ((15000-Pi/2)*phi[15000-Pi/2])^2 /. nsol[[1]]]];]

Clearly, this code, written in this way, is highly inefficient. Also, I need to do more of these, with different values for zg inside With, and make some plots out of the lists.

Anyone that can help me with this noob question? Thanks a lot!

## How do i use Streamplot to plot a non homogenous differential equation

I have the following equations:

x’ = x-y y’ = x+y-2xy

I used the following code to do the streamplot: I apologize for only having an image, as I am using Mathematica through my school servers I cannot copy and paste the data.

But I do not get any results, so then I linearize the equations and plot them separately, but I cannot figure out how to combine the plots to show in one plot.:

Is there any way to use Streamplot with nonhomogenous DE’s or a better way to combine the equations?

## What is the syntax for using Reap and Sow and WhenEvent with derivative = 0 with interpolating function?

I have a system of three ODEs. This system oscillates. I need to determine the frequency of each of the three solutions.

My file. You can download and modify this.

I’m new to Mathematica and I know this question has been asked multiple times, but I can’t get it working.

{xSol, ySol, zSol} = NDSolveValue[{ode1, ode2, ode3, ic2}, {x, y, z}, {t, 0, 200}]

Plotting xSol, ySol and zSol (three interpolating functions) gives:

Can anyone show me how to determine the frequency of this thing using Reap and Sow or FFT. I’ve been instructed already how to do this using EcoEvo package, but I’m also wondering how to do it without such a package.

Both the Reap/Sow solution and the FFT come pretty close to what I have and need. But I fail in modifying the mentioned solutions so that it works with my code.

How do I individually determine the frequency of xSol, ySol and zSol?

My implementation of WhenEvent

For example, when I try to use WhenEvent, I used it like this:

{xSol, ySol, zSol} = NDSolveValue[{ode1, ode2, ode3, ic2, WhenEvent[x'[t] == 0, Sow[t]]}, {x, y, z}, {t, 0, 200}]

This gives me an error (which I presume to be about the WhenEvent) and my regular solutions. Because the solutions are correct, I think that the problem here is in the WhenEvent.

Error: Event location failed to converge to the requested accuracy or precision within 100 iterations between t = … and t = ….

All suggestions and solutions are highly appreciated! Many thanks😊

## How do I manipulate a list so the elements within the sublist are sorted from greatest to largest?

Imagine I have this sublist. [1]: https://i.stack.imgur.com/SqsDJ.png I want to sort it in an order so that [{Larger Number, Smaller Number}, {Larger Number, Smaller Number}, et cetera]. Any help would be appreciated Thanks

## Numerical contour integral

I am trying to compute the double integral for fixed $$m,z>0$$:

   Integrate[(Gamma[y/2] Sqrt[Gamma[3 - y]/Gamma[y]])/   Gamma[(3 - y)/2] z^(3 - y)    (Exp[-m x] - 1) x^(y - 3)/x, {x, 0, \[Infinity]},{y,    3/2 - I \[Infinity], 3/2 + I \[Infinity]}]

The integral over $$x$$ can be done analytically, and the result depends on the product $$mz$$, so there is effectively just one parameter. The $$x$$ integral needs to be split into two regions I suspect, and in one region the contour of the $$y$$ integral would need to be deformed so that it remains convergent. Since the $$y$$ integral involves complicated branch cuts, I wanted to be able to do it numerically for a range of $$mz$$, to get a least a few digits of precision. I am having difficulty getting stable results numerically tho.