text:
rsctrl {eRm} R Documentation

## Controls for the Sampling Function

### Description

Various parameters that control aspects of the random generation of binary matrices.

### Usage

rsctrl(burn_in = 100, n_eff = 100, step = 16, seed = 0, tfixed = FALSE)

### Arguments

 burn_in the number of sampled matrices to come close to a stationary distribution. The default is burn_in = 100. (The actual number is 2 * burn_in * step.) n_eff the number of effective matrices, i.e., the number of matrices to be generated by the sampling function rsampler. n_eff must be positive and not larger than 8191 (2^{13}-1). The default is n_eff = 100. step controls the number number of void matrices generated in the the burn in process and when effective matrices are generated (see note below). The default is step = 16. seed is the indicator for the seed of the random number generator. Its value must be in the range 0 and 2147483646 (2**31-2). If the value of seed equals zero, a seed is generated by the sampling function rsampler (dependent on the system's clock) and its value is returned in the output. If seed is not equal to zero, its value is used as the seed of the random number generator. In that case its value is unaltered at output. The default is seed = 0. tfixed logical, – specifies if in case of a quadratic input matrix the diagonal is considered fixed (see note below). The default is tfixed = FALSE.

### Value

A list of class RSctr with components burn_in, n_eff, step, seed, tfixed.,

### Note

If one of the components is incorrectly specified the error function rserror is called and some informations are printed. The ouput object will not be defined.

The specification of step controls the sampling algorithm as follows: If , e.g., burn_in = 10, n_eff = 5, and step = 2, then during the burn in period step * burn_in = 2 * 10 matrices are generated. After that, n_eff * step = 5 * 2 matrices are generated and every second matrix of these last ten is returned from link{rsampler}.

tfixed has no effect if the input matrix is not quadratic, i.e., all matrix elements are considered free (unrestricted). If the input matrix is quadratic, and tfixed = TRUE, the main diagonal of the matrix is considered as fixed. On return from link{rsampler} all diagonal elements of the generated matrices are set to zero. This specification applies, e.g., to analyzing square incidence matrices representing binary asymmetric relation in social network theory.

The summary method (summary.RSctr) prints the current definitions.

rsampler

### Examples

ctr <- rsctrl(n_eff = 1, seed = 987654321)  # specify new controls
summary(ctr)

## Not run:
# incorrect specifications will lead to an error
ctr2 <- rsctrl(step = -3, n_eff = 10000)
## End(Not run)

[Package eRm version 1.0-2 Index]


text:
This topic is 4040 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

There was suggestion made in this thread http://www.gamedev.net/community/forums/topic.asp?topic_id=432679 to have the client-side javascript create the repetitive map tiles. I implemented this approach, and my page size was reduced dramtically, which is really good for my server bandwith usage. But now the map loads each tile individually, it seems, ignoring the fact that most of the tiles are duplicates (and are already in the browser cache). I'm sure I'm missing something elementary. Or, is the javascript really taking 30 seconds to create about 700 image tags in the page? A tidbit of data that might help: the tiles are created dynamically with a php script (the expires header is set to ten days), and these are the ones that load really slowly. The static graphics (such as trees) load almost instantly. Any ideas? If you want source, I could post a snippet or two.

Share on other sites
Snippets or a link to the page would indeed help.

Share on other sites
Here's the JS code:
function init_map(editable) {  // Thumb doesnt need this code  if (scale > 3) return;  var folders = ['dungeon','tactical','region','world'];  var div_map = \$('div_map');  for (var x = 0; x < 25; x++)    for (var y = 0; y < 25; y++) {      terr = document.createElement('img');      terr.src = 'tile.php?t=' + map[x][y][0];      terr.id = 't_'+x+'_'+y;      terr.style.border = 0;      terr.style.position = 'absolute';      terr.style.left = x * 32;      terr.style.top = terrain_scrn_y(x,y);      terr.style.zIndex = y * 10;      var topmost = terr;      var feature = map[x][y][1];      if (feature.length == 0 && editable == 0) {        feat = null;      } else if (feature.length || editable) {        feat = document.createElement('img');        feat.id = 'f_'+x+'_'+y;        var y_adj = 0;        feat.src = './grafix/world/hum/' + feature + '.png';        feat.style.border = 0;        feat.style.position = 'absolute';        feat.style.left = x * 32;        feat.style.top = feature_scrn_y(x,y) + y_adj;        feat.style.zIndex = y * 10 + 1;        var topmost = feat;      }      // if (x==0 && y<=6) alert("Cell:"+cell.id+" usemap:"+cell.getAttribute('useMap'));      topmost.setAttribute('useMap', '#m_'+x+'_'+y);      var elm = document.createElement('map');      elm.setAttribute('id', 'm_'+x+'_'+y);      if (y > 0) { // this provides clickability for the hex above because of overlap        var area = document.createElement('area');        area.setAttribute('href', 'javascript:do_click('+x+','+(y-1)+')');        area.setAttribute('shape', 'rect');        area.setAttribute('coords', '3,0,28,9');        elm.appendChild(area);      }      var area = document.createElement('area');      area.setAttribute('href', 'javascript:do_click('+x+','+y+')');      area.setAttribute('shape', 'rect');      area.setAttribute('coords', '3,11,28,38');      elm.appendChild(area);      div_map.appendChild(terr);      if (typeof feat != "undefined") div_map.appendChild(feat);      div_map.appendChild(elm);    }}

http://interactivedungeon.com/aragon

Share on other sites
There are several things I can recommend:

1. As you're serving the tiles by a PHP script, ensure that it's sending headers which are compatible with client-side caching of those tiles.
2. Make sure that you always use the same URL for the same tile- it's not clear from this example whether you are doing this.
3. Consider preloading the tiles into the browser cache (This only works if you've got the right cache headers).

If your PHP script serving the tiles uses sessions, this automatically makes it uncacheable- don't do this!

I can't accept that there is any real need to have your tile images served by PHP in the first place - I recommend that you change to flat files if possible.

You can adjust caching behaviour by setting the "Expires:" header typically. If you set "Expires" some way in the future (Weeks, maybe), the browser shouldn't go and get the tiles so often.

I can't find where on your web site this is happening; your link above tells me to register, which I'm not going to do just to try to diagnose this problem.

Mark

Share on other sites
Quote:

Thank you. That helps.

The tile script doesn't use sessions, but the main page does. That is probably it - as it seems to load the tiles the first time I visit the page. Expires is set to 864000 - ten days.

I'll probably go to static images. The only reason php is used is that there are a zillion combinations, and I got tired of "drawing" them manually.

(Sorry about the register redirect -- I forgot that it redirected unregistered users.)

Share on other sites
I fixed the register redirect, but it seems to vary from user to user. I ues IE 6.x, and have no trouble. My partner also uses IE 6, and the images don't cache. One other tester uses Avant, and images don't cache for him, either.

Is there a browser secret I am unaware of?

Share on other sites
I've registered but it still tells me to register.

Also the tile drawing script doesn't work properly at all - all the tiles are on top of each other in the top left hand corner of the play field.

You seem to have failed to notice that a style definition for "top" or "left" needs to be in pixel units (e.g. 50px) not just a number "50".

You haven't tested this in multiple browsers, have you?

The integration with the bulletin board authentication is screwed up - I'm registered and logged on and it still asks me to register.

The whole application smells like it's been poorly tested. Before you open it to the public you should at least test it locally on every browser you intend to support. No javascript errors should be produced by any of them.

Mark

Share on other sites
I also recommend:

1. Use an external style sheet rather than an inline one
2. Put all javascript code in an external .js file - you'll find that makes it easier to write (as it won't be mixed with PHP) and more maintainable, as well as being cached by the browser
3. If you're going to render some of the map by javascript, do the whole lot this way. Consider passing some kind of data structure through from the PHP to javascript (e.g. in JSON), then having it interpret that.

But the essential problem is lack of testing I feel

Mark

Share on other sites
Quote:
 I'll probably go to static images. The only reason php is used is that there are a zillion combinations, and I got tired of "drawing" them manually.

You can use PHP to generate static images. Simply give a filename as second argument to the imagegif or imagepng functions. Generate them once on the server and use the generated static images from the map editor.

Share on other sites
Quote:
 Original post by markrI also recommend:1. Use an external style sheet rather than an inline one2. Put all javascript code in an external .js file - you'll find that makes it easier to write (as it won't be mixed with PHP) and more maintainable, as well as being cached by the browser3. If you're going to render some of the map by javascript, do the whole lot this way. Consider passing some kind of data structure through from the PHP to javascript (e.g. in JSON), then having it interpret that.But the essential problem is lack of testing I feelMark

1. The style sheet comes from vBulletin, which is rendered inside the page for some reason. (I'd guess so the style can be changed by the user?)
2. Most of the js is in external files -- the map code is somewhat chaotic right now as I'm working out the performance issues.
3. I'm in the process of doing that right now, which leads to some of the problems you see now. When it was straight HTML, the map worked fine, but the file was huge.

What browser are you using? And yes, I haven't advertised this at all, except a couple of pleas for help here, because I have yet to test on a non-IE browser.

Share on other sites
Quote:
Original post by Sander
Quote:
 I'll probably go to static images. The only reason php is used is that there are a zillion combinations, and I got tired of "drawing" them manually.

You can use PHP to generate static images. Simply give a filename as second argument to the imagegif or imagepng functions. Generate them once on the server and use the generated static images from the map editor.

Yes, that is the solution that I used. I added a file_exists test and image save to my existing code and browsed the map to create the images. About 1,200 images later, all is good as far as I can tell.

• 10
• 12
• 10
• 10
• 11
• Similar Content

• By GytisDev
Hello,
without going into any details I am looking for any articles or blogs or advice about city building and RTS games in general. I tried to search for these on my own, but would like to see your input also. I want to make a very simple version of a game like Banished or Kingdoms and Castles,  where I would be able to place like two types of buildings, make farms and cut trees for resources while controlling a single worker. I have some problem understanding how these games works in the back-end: how various data can be stored about the map and objects, how grids works, implementing work system (like a little cube (human) walks to a tree and cuts it) and so on. I am also pretty confident in my programming capabilities for such a game. Sorry if I make any mistakes, English is not my native language.
• By Ovicior
Hey,
So I'm currently working on a rogue-like top-down game that features melee combat. Getting basic weapon stats like power, weight, and range is not a problem. I am, however, having a problem with coming up with a flexible and dynamic system to allow me to quickly create unique effects for the weapons. I want to essentially create a sort of API that is called when appropriate and gives whatever information is necessary (For example, I could opt to use methods called OnPlayerHit() or IfPlayerBleeding() to implement behavior for each weapon). The issue is, I've never actually made a system as flexible as this.
My current idea is to make a base abstract weapon class, and then have calls to all the methods when appropriate in there (OnPlayerHit() would be called whenever the player's health is subtracted from, for example). This would involve creating a sub-class for every weapon type and overriding each method to make sure the behavior works appropriately. This does not feel very efficient or clean at all. I was thinking of using interfaces to allow for the implementation of whatever "event" is needed (such as having an interface for OnPlayerAttack(), which would force the creation of a method that is called whenever the player attacks something).

Here's a couple unique weapon ideas I have:
Explosion sword: Create explosion in attack direction.
Cold sword: Chance to freeze enemies when they are hit.
Electric sword: On attack, electricity chains damage to nearby enemies.

I'm basically trying to create a sort of API that'll allow me to easily inherit from a base weapon class and add additional behaviors somehow. One thing to know is that I'm on Unity, and swapping the weapon object's weapon component whenever the weapon changes is not at all a good idea. I need some way to contain all this varying data in one Unity component that can contain a Weapon field to hold all this data. Any ideas?

I'm currently considering having a WeaponController class that can contain a Weapon class, which calls all the methods I use to create unique effects in the weapon (Such as OnPlayerAttack()) when appropriate.

• Hi fellow game devs,
First, I would like to apologize for the wall of text.
As you may notice I have been digging in vehicle simulation for some times now through my clutch question posts. And thanks to the generous help of you guys, especially @CombatWombat I have finished my clutch model (Really CombatWombat you deserve much more than a post upvote, I would buy you a drink if I could ha ha).
Now the final piece in my vehicle physic model is the differential. For now I have an open-differential model working quite well by just outputting torque 50-50 to left and right wheel. Now I would like to implement a Limited Slip Differential. I have very limited knowledge about LSD, and what I know about LSD is through readings on racer.nl documentation, watching Youtube videos, and playing around with games like Assetto Corsa and Project Cars. So this is what I understand so far:
- The LSD acts like an open-diff when there is no torque from engine applied to the input shaft of the diff. However, in clutch-type LSD there is still an amount of binding between the left and right wheel due to preload spring.
- When there is torque to the input shaft (on power and off power in 2 ways LSD), in ramp LSD, the ramp will push the clutch patch together, creating binding force. The amount of binding force depends on the amount of clutch patch and ramp angle, so the diff will not completely locked up and there is still difference in wheel speed between left and right wheel, but when the locking force is enough the diff will lock.
- There also something I'm not sure is the amount of torque ratio based on road resistance torque (rolling resistance I guess)., but since I cannot extract rolling resistance from the tire model I'm using (Unity wheelCollider), I think I would not use this approach. Instead I'm going to use the speed difference in left and right wheel, similar to torsen diff. Below is my rough model with the clutch type LSD:
speedDiff = leftWheelSpeed - rightWheelSpeed; //torque to differential input shaft. //first treat the diff as an open diff with equal torque to both wheels inputTorque = gearBoxTorque * 0.5f; //then modify torque to each wheel based on wheel speed difference //the difference in torque depends on speed difference, throttleInput (on/off power) //amount of locking force wanted at different amount of speed difference, //and preload force //torque to left wheel leftWheelTorque = inputTorque - (speedDiff * preLoadForce + lockingForce * throttleInput); //torque to right wheel rightWheelTorque = inputTorque + (speedDiff * preLoadForce + lockingForce * throttleInput); I'm putting throttle input in because from what I've read the amount of locking also depends on the amount of throttle input (harder throttle -> higher  torque input -> stronger locking). The model is nowhere near good, so please jump in and correct me.
Also I have a few questions:
- In torsen/geared LSD, is it correct that the diff actually never lock but only split torque based on bias ratio, which also based on speed difference between wheels? And does the bias only happen when the speed difference reaches the ratio (say 2:1 or 3:1) and below that it will act like an open diff, which basically like an open diff with an if statement to switch state?
- Is it correct that the amount of locking force in clutch LSD depends on amount of input torque? If so, what is the threshold of the input torque to "activate" the diff (start splitting torque)? How can I get the amount of torque bias ratio (in wheelTorque = inputTorque * biasRatio) based on the speed difference or rolling resistance at wheel?
- Is the speed at the input shaft of the diff always equals to the average speed of 2 wheels ie (left + right) / 2?
• By Estra
Memory Trees is a PC game and Life+Farming simulation game. Harvest Moon and Rune Factory , the game will be quite big. I believe that this will take a long time to finish
Looking for
Programmer
1 experience using Unity/C++
2 have a portfolio of Programmer
3 like RPG game ( Rune rune factory / zelda series / FF series )
4 Have responsibility + Time Management
and friendly easy working with others Programmer willing to use Skype for communication with team please E-mail me if you're interested
Split %: Revenue share. We can discuss. Fully Funded servers and contents
and friendly easy working with others willing to use Skype for communication with team please E-mail me if you're interested
we can talk more detail in Estherfanworld@gmail.com Don't comment here
Thank you so much for reading

format: plain


text:
# How do you integrate xe^(2x)dx?

Mar 7, 2015

I would use Integration by Parts:

Jun 7, 2017

$\int \setminus x {e}^{2 x} \setminus \mathrm{dx} = \frac{1}{4} {e}^{2 x} \left(2 x - 1\right) + C$

#### Explanation:

We can use the formula for Integration By Parts (IBP):

$\int \setminus u \frac{\mathrm{dv}}{\mathrm{dx}} \setminus \mathrm{dx} = u v - \int \setminus v \frac{\mathrm{du}}{\mathrm{dx}} \setminus \mathrm{dx}$, or less formally
$\text{ } \int \setminus u \setminus \mathrm{dv} = u v - \int \setminus v \setminus \mathrm{du}$

I was taught to remember the less formal rule in word; "The integral of udv equals uv minus the integral of vdu". If you struggle to remember the rule, then it may help to see that it comes a s a direct consequence of integrating the Product Rule for differentiation.

Essentially we would like to identify one function that simplifies when differentiated, and identify one that simplifies when integrated (or is at least is integrable).

So for the integrand $x {e}^{2 x}$, hopefully you can see that $x$ simplifies when differentiated and ${e}^{2 x}$ effectively remains unchanged.

Let $\left\{\begin{matrix}u & = x & \implies & \frac{\mathrm{du}}{\mathrm{dx}} & = 1 \\ \frac{\mathrm{dv}}{\mathrm{dx}} & = {e}^{2 x} & \implies & v & = \frac{1}{2} {e}^{2 x}\end{matrix}\right.$

Then plugging into the IBP formula:

$\int \setminus \left(u\right) \left(\frac{\mathrm{dv}}{\mathrm{dx}}\right) \setminus \mathrm{dx} = \left(u\right) \left(v\right) - \int \setminus \left(v\right) \left(\frac{\mathrm{du}}{\mathrm{dx}}\right) \setminus \mathrm{dx}$

gives us

$\int \setminus \left(x\right) \left({e}^{2 x}\right) \setminus \mathrm{dx} = \left(x\right) \left(\frac{1}{2} {e}^{2 x}\right) - \int \setminus \left(\frac{1}{2} {e}^{2 x}\right) \left(1\right) \setminus \mathrm{dx}$
$\int \setminus x {e}^{2 x} \setminus \mathrm{dx} = \frac{1}{2} x {e}^{2 x} - \frac{1}{2} \int \setminus {e}^{2 x} \setminus \mathrm{dx}$
$\text{ } = \frac{1}{2} x {e}^{2 x} - \frac{1}{4} {e}^{2 x} + C$
$\text{ } = \frac{1}{4} {e}^{2 x} \left(2 x - 1\right) + C$


text:
# Check if two hexadecimal numbers are complementary in a location of a given number of bytes.

Check, using complementary code rules, if:

• if $$(9A7D)_{16}$$ and $$(7583)_{16}$$ are complementary in a location of $$2$$ bytes
• if $$(000F095D)_{16}$$ and $$(FFF0F6A3)_{16}$$ are complementary in a location of 4 bytes

I am not sure what the problem statement means exactly. What am I supposed to check? In the case of the first subpoint, I converted the two numbers into binary to see if they are complementary over a location of $$16$$ bits ($$2$$ bytes). Again, I have no idea if I am supposed to do this.

$$(9A7D)_{16} = 1001 \hspace{0.1cm} 1010 \hspace{0.1cm} 0111 \hspace{0.1cm} 1101 _ {2}$$

$$(7583)_{16} = 0111 \hspace{0.1cm} 0101 \hspace{0.1cm} 1000 \hspace{0.1cm} 0011 _ {2}$$

But in order for the two to be complementary in a location of $$2$$ bytes we would need the two numbers to be complementary as a whole, since the whole number representations have $$2$$ bytes. This looks to be false. The second subpoint of the problem reaches the same conclusion. This is what I don't think that it's right what I'm doing. It doesn't feel like I did much. So what exactly is the problem statement asking for?

• The first two bytes of the second problem are complementary: $000F_{16}+FFF0_{16}=FFFF_{16}$. Sep 30 '20 at 16:37

## 1 Answer

The problem is asking to check the two values using 1's complement and 2's complement rules.

To calculate 1's complement, subtract each digit from $$15\space(=F_{16})$$.

To calculate 2's complement, add 1 to one's complement.

$$1$$'s complement of $$9A7D_{16} = 6582_{16}$$ and not $$7583_{16}$$

$$2$$'s complement of $$9A7D_{16} = 6582_{16} + 1 = 6583_{16}$$ which is also not $$7583_{16}$$.

So, the values are neither one's complements not two's complements of each other.

Repeat the same for the 4 byte value. A cursory check shows they are 2's complements of each other.

• Can you please clarify something for me? So, in order to find $1$'s complement we take the largest value in the given base and subtract each digit from that largest value (e.g., $15$ in base $16$, $1$ in base $2$, $9$ in base $10$, and so on)? Also isn't the first digit of $1$'s complement in the exercise you solved actually $6$ and not $7$? I might be wrong, but you said to subtract each digit from 15, so we would have $15 - 9 = 6$. Am I wrong?
– user592938
Oct 1 '20 at 10:41
• Yes. That is correct. I made a math error in the first digit. My bad. So, they are not 1's or 2's complements for the first answer. But the rules are correct.
– vvg
Oct 1 '20 at 10:52


text:
# Tag Info

1

Conjugate by CNOTs to reduce to a case where the two states differ by exactly one bit, and conjugate by NOTs to make all the controls look for 1s instead of 0s. Find a bit position t where the two states disagree about a bit. Let s be the state where the bit at t is 0. For each bit position p other than t where the bit is 0 in s, apply a NOT to qubit p. For ...

8

For any controlled-$U$, if the input state is $|+\rangle|\phi\rangle$ where $|\phi\rangle$ is not an eigenstate of $U$, then the output state is entangled. This immediately deals with trivial cases such as $U=I$ because in that case all states $|\phi\rangle$ are eigenstates, and so it is not entangling. For any other $U$, there is an input state that is ...

4

It cannot be the case that $H=e^{i\pi/4}\sqrt{iNOT}$. Whatever your interpretation of $iNOT$ (I'd agree with your definition), just square the thing. $H^2=I$, the identity, and so it is certainly not the case that $$I=e^{i\pi/2}iNOT.$$ It is true, however, that if you perform the sequence that would give you an operation such as $NOT$ or $iNOT$, and you ...

0

This isn't supported in qiskit-terra yet with parametrized circuits. There is an open issue to add support for adding a parameter sweep with trig functions here: https://github.com/Qiskit/qiskit-terra/issues/3908

0

I think these gates only accept float or np.float as a parameter. Try casting to one of these types, for example phase = float(phase) and it should work.

2

The application of Hadamard gate on the first qubit is correct. Since CNOT is two qubit gate, it has to be described by matrix 4x4, so far you have only 2x2 matrix. However, there is a identity operator $I$ described by unit matrix on the second qubit. Hence the first step in you circuit can be described by matrix $H \otimes I$. Resulting matrix is of type ...

2

For the way round that you've got your inequalities, I don't think there's much that can be said. To see why, let's consider the first expression $$\|U-V\|_1=\text{Tr}(\sqrt{2I-VU^\dagger-UV^\dagger}).$$ Now, $VU^\dagger$ is a unitary, and hence as a spectral decomposition. Let the eigenvectors be $|\lambda_i\rangle$ with eigenvalues $e^{i\lambda_i}$. $UV^\... 1 There are many possible ways to encode data into a quantum neural network (QNN). In one of the first papers to suggest the use of variational circuits to classify data [1], the authors suggest the following general architecture for a QNN: The circuit starts with the$|0\rangle$state, encodes a data point$\textbf{x}$using a circuit$S_\textbf{x}$, and ... 2 I asked Sergio Boxio about this and he noted that this is discussed in the supplementary information of the Supremacy paper. In particular, Figure S47 has a plot of the speedup you get due to imbalance in the Schmidt coefficients as the rotation angle drifts: and equations 103, 104, and 105 show how to compute the relevant coefficients: 0 You can use a method described in Transformation of quantum states using uniformly controlled rotations. Authors of the article introduced method how to change an arbitrary state$|a\rangle$to state$|b\rangle$with so-called uniformly controlled rotation, i.e. a rotation which rotational angle depends on combination of zeros and ones in controlling ... 0 What you seem to be asking for is the general construction of an arbitrary permutation. There’s nothing quantum about this; the equivalent question in classical is how to construct an arbitrary reversible circuit of n bits. There are$2^n!$such circuits, from which it is hopefully obvious that there is not a compact description for the vast majority. I ... 1 I tried to simulate on IBM Q. I realized that input states$|01\rangle$and$|10\rangle$have oposite phase in comparison with others. This is desired behavior of the algorithm because these states have to be marked. Phase of other two states is intact. Because two states are marked and two do not, average amplitude is zero. When you rotate amplitudes around ... 4 Your states differ in global phase only, hence they are indistinguishable (or in other words they are equivalent). Therefore you do not need to apply gate$-I$. Note that the global phase is$\pi$as$-1 = \mathrm{e}^{i\pi}$However, in case the state is produced by controlled gate, global phase cannot be neglected. In that case you can implement ... 1 Please have a look at article Transformation of quantum states using uniformly controlled rotations, chapters 1 and 2. These provides you with construction of general rotation gate controlled by$n$qubits with different rotations angles for each basis state$|x\rangle$. You also might be interested in some of these articles on quantum computers application ... 4 You want to implement $$e^{i3\pi/4}e^{iX\pi/4}.$$ I would rewrite this as $$e^{i3\pi/4}He^{iZ\pi/4}H.$$ This is the same as $$-HS^\dagger H$$ in standard gate terminology. If you're only implementing the gate$e^{iAt}$, then you can neglect the global phase and just implement$HS^\dagger H$. Both of these gates are readily implemented in qiskit as sdg ... 4 There is actually a nice way to do this in Qiskit, since it has decompositions for single-qubit unitaries built in. The QuantumCircuit.squ method takes a unitary 2x2 matrix$U$and a qubit and computes the decomposition $$U = R_Z(\alpha) R_Y(\beta) R_Z(\gamma)$$ This is a common decomposition, you can find a proof here https://arxiv.org/pdf/quant-ph/... 1 There is no measurement in the picture; the picture shows how to construct 4 Bell states$|\Phi^+\rangle$,$|\Phi^-\rangle$,$|\Psi^+\rangle$and$|\Psi^-\rangle$using Hadamard-CNOT circuit. 3 Denoting phase gate by$P$probably comes from its name Phase Phase gate is usually denoted by$S$as you can see from your Nielsen and Chuang book example. Moreoer, symbol$S$is used also on IBM Q. To sum up, it is a matter of a paper's author decission. As I remember, I have seen phase gate denoted by$S$only. 2 I think this is enough$e^{iAt}= e^{i(1.5I)t} e^{i(0.5X)t}$for constructing the circuit. From rx and u3: $$R_x(-t) = e^{i(0.5X)t} \qquad R_x(\theta) = u3(\theta, -\pi/2, \pi/2)$$ The$e^{i(1.5I)t}$is a global phase gate that can be implemented via the following circuit for q[0] qubit. Here is the whole circuit for the$e^{iAt}$: # Rx part circuit.u3(-t, -... 2 $$R_y(\theta) = e^{-i\frac{\theta}{2}Y} = \begin{bmatrix} \cos\frac{\theta}{2} & -\sin\frac{\theta}{2} \\ \sin\frac{\theta}{2} & \cos\frac{\theta}{2} \end{bmatrix}$$ This gate might be named slightly differently depending on the source; Wikipedia doesn't seem to know it but this primer on rotations on Bloch sphere lists all rotation gates nicely. 4 The coefficient$\frac{1}{\sqrt{2^3}}$is the normalization factor: if you have a 3-qubit state that is an equal superposition of 8 basis states, its norm still has to be 1; thus the squared amplitude of each basis state has to be$\frac{1}{8}$, and the amplitude will be square root of that, i.e. exactly$\frac{1}{\sqrt{2^3}}$. You can also obtain that ... 1 Firstly, I think there's a reason why the bit in the textbook before the question is using$\delta$instead of$\epsilon$for the results. So, replacing what you've written, it should really be $$E<\sqrt{2(1-\cos(\delta/2))}$$ Now, start with a double-angle formula:$1-\cos(\delta/2)=2\sin^2(\delta/4)$. Thus, $$E<2\sin(\delta/4)$$ Now if you apply ... 3 This depends on the context in which you're using the operators. You're talking about multiplying them, so I guess you're thinking of, for example, unitaries (and other circuit model elements). In this case, not only are terms$A\otimes I$local operators, but$A\otimes B$is also a local operator. For example, on a quantum circuit, two Hadamard gates ... 1 There are two inequivalent definitions of "local operator" used in quantum information theory. The first definition is used in the context of communication over a classical channel (e.g. LOCC). In this context, you have a fixed partition of the complete Hilbert space into a tensor product of$k$different subsystems, and the subsystems are assumed to be so ... 5 Martin Vesely's answer is the way to go in general, and especially if you know more than one column. However, if you're given just one column, there's an easier trick for generating a suitable unitary. Note that$V=2|v\rangle\langle v|-I$is a unitary ($V=V^\dagger$and$V^2=I$). So, the question is whether you can select a$|v\rangle$such that the first ... 6 Take your vector$\frac{1}{\sqrt{5}}(0, 1, 1, 1, 1, 1)^T$and five other arbitrary ones but at the same time these vectors have to be linearly independent. After that apply Gram-Schmidt process which produces orthonormal vectors. Put these vectors to a matrix and you will get a unitary matrix with the first column equal to$\frac{1}{\sqrt{5}}(0, 1, 1, 1, 1, ...

5

I am going to assume that $|0\rangle$ is represented by , and $|1\rangle$ by . Then, represents the bit-flip, or NOT gate. What it does is: $|x\rangle\mapsto |x\oplus1\rangle$. This can be verified easily in the graphical calculus, using the "spider" rule: and Now, by definition, CNOT controls NOT: $|x_1,x_2\rangle\mapsto|x_1,x_1\oplus x_2\rangle$. In ...

-2

firstly write CNOT⊗𝐼2 matrix, then change the order of index2 and index3 with matlab. in this way, you can do any number of qubits.

2

An example of constructing (with help of Qiskit) a controlled version of some simple 4x4 unitary matrix: $$U = \begin{pmatrix} \mathrm{e}^{i g_1} & 0 & 0 & 0 \\ 0 & \mathrm{e}^{i g_2} & 0 & 0 \\ 0 & 0 & \mathrm{e}^{i g_3} & 0 \\ 0 & 0 & 0 & \mathrm{e}^{i g_4} \\ \end{pmatrix}$$ where $g_s$ are some given ...

1

If you are using the QFT inside a bigger circuit you really can't avoid the swaps in the QFT and/or the invQFT the reason being that the value of qubit x1 dictates the symmetry of the phases in your entire superposition. Pay attention at how the phases look like in the following images: I think your intuition in question 1 is correct but it will only work ...

Top 50 recent answers are included


text:
## Cox point process

In previous posts I have stressed the importance of the Poisson point process, but it can be unsuitable for certain mathematical models.  We can generalize this point process by first considering a non-negative random measure, called a driving or directing measure. Then a Poisson point process, which is independent of the random driving measure, is generated by using the random measure as its intensity or mean measure. This doubly stochastic construction gives what is called a Cox point process.

Typically, we don’t observe the driving measure, so it’s impossible to distinguish a Cox point process from a Poisson point if there’s only one realization available. The properties of a Cox point process are derived by conditioning on the random driving measure, and then using the properties of the Poisson point process.

Cox point processes are also known as doubly stochastic Poisson point processes. Guttorp and Thorarinsdottir argue that it should be called the Quenouille point process, as Maurice Quenouille introduced an example of it before Sir David Cox, but I opt for the more common name.

In this post I’ll cover a couple examples of Cox point processes, but first I’ll give a more precise mathematical definition.

## Definition

We consider a point process defined on some underlying mathematical space $$\mathbb{S}$$, which is sometimes called the carrier space or state space.  For applications, the underlying space is often the real line $$\mathbb{R}$$, the plane $$\mathbb{R}^2$$, or some other familiar mathematical space like a square lattice.

For the first definition, we use the concept of a random measure.

Let $$M$$ be a non-negative random measure on $$\mathbb{S}$$. Then a point process $$\Phi$$ defined on some underlying space $$\mathbb{S}$$ is a Cox point process driven by the intensity measure $$M$$ if the conditional distribution of $$\Phi$$ is a Poisson point process with intensity function $$M$$.

Alternatively, we can give a slightly less general definition of a Cox  point process by using a random intensity function.

Let $$Z=\{Z(x):x\in\mathbb{S} \}$$ be a non-negative random field such that with probability one, $$x\rightarrow Z(x)$$ is a locally integrable function. Then a point process $$\Phi$$ defined on some underlying space $$\mathbb{S}$$ is a Cox point process driven by $$Z$$ if the conditional distribution of $$\Phi$$ is a Poisson point process with intensity function $$Z$$.

The random driving measure $$M$$ is then simply the integral
$$M(B)=\int_B Z(x)\, dx , \quad B\subseteq S.$$

## Over-dispersion

We will soon see that the random driving measures take different forms, giving different Cox point processes. But there is a general observation that can be made for all Cox point processes. For any region $$B \subseteq S$$, it can be shown that the number of points $$\Phi (B)$$ adheres to the inequality
$$\mathbb{Var} [\Phi (B)] \geq \mathbb{E} [\Phi (B)],$$

where $$\mathbb{Var} [\Phi (B)]$$ is the variance of the random variable $$\Phi (B)$$.  As a comparison, for a Poisson point process $$\Phi’$$, the variance of $$\Phi’ (B)$$ is simply $$\mathbb{Var} [\Phi’ (B)] =\mathbb{E} [\Phi’ (B)]$$.  Due to its greater variance, the Cox point process is said to be over-dispersed compared to the Poisson point process.

## Special cases

There is an virtually unlimited number of ways to define a random driving measure, where each one yields a different a Cox point process. But in general mathematicians are and practitioners are restricted by examining only tractable and interesting Cox point processes. I will give some common examples of such Cox point processes, but I stress that the Cox point process family is very large.

### Mixed Poisson point process

For the random driving measure $$M$$, an obvious example is the product form $$M= Y \mu$$,  where $$Y$$ is some independent non-negative random variable and $$\mu$$ is the Lebesgue measure on $$\mathbb{S}$$, meaning $$Y$$ is the only source of randomness. This driving measure gives the mixed Poisson point process.

### Log-Gaussian Cox point process

Instead of a random variable, we can use a non-negative random field to define a random driving measure.  We then have the product form $$M= Y \mu$$, where $$Y$$ is now some independent non-negative random field. (A random field is a collection of random variables indexed by some set, which in this case is the underlying space $$\mathbb{S}$$.)

Arguably the most tractable and used random field is the Gaussian random field. This random field, like Gaussian or normal random variables, takes negative and positive values, but if we define the random field such that its logarithm is a Gaussian field $$Z$$, then we obtain the non-negative random driving measure $$M=\mu e^Z$$, which gives the log-Gaussian Cox point process.

This point process has found applications in spatial statistics.

### Cox-Poisson line-point process

To construct this Cox point process, we first consider a Poisson line process, which I discussed previously.  Given a Poisson line process, we then place an independent one-dimensional Poisson point process on each line, then we obtain an example of a Cox point process, which we could call a Cox line-point process orCox-Poisson line-point process, but I am not sure of the name.

Researchers have recently used this point process to study wireless communication networks in cities, where the streets correspond to Poisson lines. For example, see these two preprints:

### Shot-noise Cox point process

We construct the next Cox point process by first considering a Poisson point process on the space $$\mathbb{S}$$ to create a shot noise term, which we then use as the driving measure of the Cox point process.

More specifically, we first introduce a kernel function $$k(\cdot,\cdot)$$ on $$\mathbb{S}$$, where $$k(x,\cdot)$$ is a probability density function for all points $$x\in \mathbb{S}$$. We then consider a Poisson point process $$\Phi’$$ on $$\mathbb{S}\times (0,\infty)$$, which we assume has a locally integrable intensity function $$\mu$$. (We can interpret  the point process $$\Phi’$$ as a spatially-dependent marked Poisson point process,  where the unmarked Poisson point process is defined on $$\mathbb{S}$$, and each point $$X$$ of this unmarked point process has a mark  $$T \in (0,\infty)$$ with probability density $$\mu(X,t)$$.) The resulting shot noise

$$Z(x)= \sum_{(Y,T)\in \Phi’} T \, k(Y,x)\,.$$

gives the random field, which we then use as the random intensity function to drive the shot-noise Cox point process.

In previous posts, I have detailed how to simulate non-Poisson point processes such as the Matérn and Thomas cluster point processes. These are, more specifically, examples of a Neyman-Scott point process, which is a special case of a shot noise Cox point process. All these point processes find applications in spatial statistics.

## Simulation

Unfortunately, there is no universal way to simulate all Cox point processes — and even if there were one, it would not be the most optimal way for every Cox point process. The simulation method depends on how the Cox point process is constructed, which usually means how its directing or driving measure is defined.

In previous posts I have presented ways (with code) to simulate the following Cox point processes:

In addition to the Matérn and Thomas point processes, there are ways to simulate to more general shot noise Cox point processes, which I will cover in another post.

For general Cox point processes, I suggest the following: Chapter 6 in the monograph Poisson processes by Kingman; Chapter 5 in Statistical Inference and Simulation for Spatial Point Processes by Møller and Waagepetersen; and Section 5.2 in Stochastic Geometry and its Applications by Chiu, Stoyan, Kendall and Mecke. For a much more mathematical treatment, see Chapter 13 in Lectures on the Poisson Process by Last and Penrose. Grandell wrote two detailed monographs titled Mixed Poisson Process and Doubly Stochastic Poisson Processes.

Motivated by applications in spatial statistics, Jesper Møller has (co)-written papers on specific Cox point processes. For example:

• 2001, Møller, Syversveen, and Waagepetersen, Log Gaussian Cox Processes;
• 2003, Møller, Shot noise Cox Processes;
• 2005, Møller and Torrisi,Generalised shot noise Cox processes.

I also suggest the survey article:

• 2003, Møller and Waagepetersen, Modern statistics for spatial point processes.

## Shot noise

Given a mathematical model based on a point process, a quantity of possible interest is the sum of some function applied to each point of the point process. This random sum is called shot noise, where the name comes from developing mathematical models of the noise measured in old electronic devices, which was likened to shot (used in guns) hitting a surface.

Researchers have long studied shot noise induced by a point process. One particularly application is wireless network models, in which the interference term is an example of shot noise. It is also possible to construct new point processes, called shot noise Cox point processes, by using based on the shot noise of some initial point process.

For such applications, we need a more formal definition of shot noise.

## Definition

### Shot noise of a point process

We consider a point processes $$\Phi=\{X_i\}_i$$ defined on some space $$\mathbb{S}$$, which is often $$\mathbb{R}^n$$, and a non-negative function $$f$$ with the domain $$\mathbb{S}$$, so $$f:\mathbb{S} \rightarrow [0,\infty)$$. This function $$f$$ is called the response function.

Then the shot noise is defined as
$$I= \sum_{X_i\in \Phi} f(X_i)\,.$$

### Shot noise of a marked point process

The previous definition of shot noise can be generalized by considering a marked point process $$\Phi’=\{(X_i, M_i)\}_i$$, where each point $$X_i$$ now has a random mark $$M_i$$, which can be a random variable some other random object taking values in some space $$\mathbb{M}$$. Then for a response function $$g:\mathbb{S}\times \mathbb{M} \rightarrow [0,\infty)$$ , the shot noise is defined as
$$I’= \sum_{(X_i, M_i)\in \Phi’} g(X_i,M_i)\,.$$

## Properties

Given a point process on a space, like the plane, at any point the shot noise is simply a random variable. If we consider a subset of the space, then shot noise forms a random field, where we recall that a random field is simply a collection of random variables indexed by some set. (By convention, the set tends to be Euclidean space or a manifold). The shot noise can also be considered as a random measure, for example
$$I(B)= \sum_{X_i\in \Phi\cap B} f(X_i)\,,$$
where $$B\subseteq \mathbb{S}$$. This makes sense as the point process $$\Phi$$ is an example of a random (counting) measure.

For Poisson point processes, researchers have studied resulting shot noise random variable or field. For example, given a homogeneous Poisson point process on $$\mathbb{R}^d$$, if the response function is a simple power-law $$f(x)=|x|^{-\beta}$$, where $$\beta> d$$ and $$|x|$$ denotes the Euclidean distance from the origin, then the resulting shot noise is alpha stable random variable with parameter $$\alpha=d/\beta$$.

For a general point process $$\Phi$$ with intensity measure $$\Lambda$$, the first moment of the shot noise is simply
$$\mathbb{E}(I)= \int_{\mathbb{S}} f(x) \Lambda (dx) \,.$$

This is a result of Campbell’s theorem or formula. A similar expression exists for the shot noise of a marked point process.

## Some history

Shot noise has been studied for over a century in science. In physics, Walter Schottky did research on shot noise in Germany at the beginning of the 20th century. In the same era, Norman R. Campbell studied shot noise in Britain and wrote two key papers, where one of them contains a result now called Campbell’s theorem or Campbell’s formula, among other names, which is a fundamental result in point process theory. Campbell was a physicist, but his work contains this mathematical result for which he credited the famed pure mathematician G. H. Hardy.

(It’s interesting to note that Hardy claimed years later that, given he did pure mathematics, none of his work would lead to applications, but that claim is simply not true for this and other reasons.)

The work on the physical process of shot noise motivated more probability-oriented papers on shot noise, including:

• 1944, S. O. Rice, Mathematical Analysis of Random Noise;
• 1960, Gilbert and Pollak. Amplitude distribution of shot noise;
• 1971, Daley, The definition of a multi-dimensional generalization of shot noise;
• 1977, J. Rice, On generalized shot noise;
• 1990 Lowen and Teich, Power-law shot noise.

As a model for interference in wireless networks, shot noise is covered in books such as the two-volume textbooks Stochastic Geometry and Wireless Networks by François Baccelli and Bartek Błaszczyszyn, where the first volume is on theory and the second volume is on applications. Martin Haenggi wrote a very readable introductory book called Stochastic Geometry for Wireless networks.

## Simulating a Cox point process based on a Poisson line process

In the previous post, I described how to simulate a Poisson line process, which in turn was done by using insight from an earlier post on the Bertrand paradox.

Now, given a Poisson line process, for each line, if we generate an independent one-dimensional Poisson point point process on each line, then we obtain an example of a Cox point process. Cox point processes are also known as doubly stochastic Poisson point processes. On the topic of names, Guttorp and Thorarinsdottir argue that it should be called the Quenouille point process, as Maurice Quenouille introduced an example of it before Sir David Cox, but I opt for the more common name.

## Cox point proceesses

A Cox point process is a generalization of a Poisson point process. It is created by first considering a non-negative random measure, sometimes called a driving measure. Then a Poisson point process, which is independent of the random driving measure, is generated by using the random measure as its intensity or mean measure.

The driving measure of a Cox point process can be, for example, a non-negative random variable or field multiplied by a Lebesgue measure. In our case, the random measure is the underlying Poisson line process coupled with the Lebesgue measure on the line (that is, length).

Cox processes form a very large and general family of point processes, which exhibit clustering. In previous posts, I have covered two special cases of Cox point processes: the Matérn and Thomas cluster point processes. These are, more specifically, examples of a Neyman-Scott point process, which is a special case of a shot noise Cox point process. These two point processes are fairly easy to simulate, but that’s not the case for Cox point processes in general. Some are considerably easier than others.

## Motivation

I will focus on simulating the Cox point process formed from a Poisson line process with homogeneous Poisson point processes. I do this for two reasons. First, it’s easy to simulate, given we can simulate a Poisson line process. Second, it has been used and studied recently in the mathematics and engineering literature for investigating wireless communication networks in cities, where the streets correspond to Poisson lines; for example, see these two preprints:

Incidentally, I don’t know what to call this particular Cox point process. A Cox line-point process? A Cox-Poisson line-point process? But it doesn’t matter for simulation purposes.

## Method

We will simulate the Cox (-Poisson line-) point process on a disk. Why a disk? I suggest reading the previous posts on the Poisson line process the Bertrand paradox for why the disk is a natural simulation window for line processes.

Provided we can simulate a Poisson line process, the simulation method is quite straightforward, as I have essentially already described it.

##### Line process

First simulate a Poisson line process on a disk. We recall that for each line of the line process, we need to generate two independent random variables $$\Theta$$ and $$P$$ describing the position of the line. The first random variable $$\Theta$$ gives the line orientation, and it is a uniform random variable on the interval $$(0,2\pi)$$.

The second random variables $$P$$ gives the distance from the origin to the disk edge, and it is a uniform random variable on the interval $$(0,r)$$, where $$r$$ is the radius of the disk. The distance from the point $$(\Theta, P)$$ to the disk edge (that is, the circle) along the chord is:

$$Q=\sqrt{r^2-P^2}.$$

The endpoints of the chord (that is, the points on the disk edge) are then:

Point 1: $$X_1=P \cos \Theta+ Q\sin \Theta$$, $$Y_1= P \sin \Theta- Q\cos \Theta$$,

Point 2: $$X_2=P \cos \Theta- Q\sin \Theta$$, $$Y_2= P \sin \Theta+Q \cos \Theta$$.

The length of the line segment is $$2 Q$$. We can say this random line is described by the point $$(\Theta,P)$$.

##### One-dimensional Poisson point process

For each line (segment) in the line process, simulate a one-dimensional Poisson point process on it. Although I have never discussed how to simulate a one-dimensional (homogeneous) Poisson point process, it’s essentially one dimension less than simulating a homogeneous Poisson point process on a rectangle.

More specifically, given a line segment $$(\Theta,P)=(\theta,p)$$, you simulate a homogeneous Poisson point process with intensity $$\mu$$ on a line segment with length $$2 q$$, where $$q=\sqrt{r^2-p^2}$$. (I am now using lowercase letters to stress that the line is no longer random.) To simulate the homogeneous Poisson point process, you generate a Poisson random variable with parameter $$2 \mu q$$.

Now you need to place the points uniformly on the line segment. To do this, consider a single point on a single line. For this point, generate a single uniform variable $$U$$ on the interval $$(-1,1)$$. The tricky part is now getting the Cartesian coordinates right. But the above expressions for the endpoints suggest that the single random point has the Cartesian coordinates:

$$x=p \cos \theta+ U q\sin \theta$$, $$y=p \sin \theta- U q\cos \theta$$.

The two extreme cases of the uniform random variable $$U$$ (that is, $$U=-1$$ and $$U=1$$) correspond to the two endpoints of the line segment. We recall that $$Q$$ is the distance from the midpoint of the line segment to the disk edge along the line segment, so it makes sense that we want to vary this distance uniformly in order to uniformly place a point on the line segment. This uniform placement step is done for all the points of the homogeneous Point process on that line segment.

You repeat this procedure for every line segment. And that’s it: a Cox point process built upon a Poisson line process.

## Code

As always, the code from all my posts is online. For this post, I have written the code in MATLAB, R and Python.

For the first step, the reading material is basically the same as that for the Poisson line process, which overlaps with that of the Bertrand paradox. For the one-dimensional Poisson point process, we can use the reading material on the homogeneous Poisson point process on a rectangle.

For general Cox point processes, I recommend starting with the following: Chapter 6 in the monograph Poisson processes by Kingman; Chapter 5 in Statistical Inference and Simulation for Spatial Point Processes by Møller and Waagepetersen; and Section 5.2 in Stochastic Geometry and its Applications by Chiu, Stoyan, Kendall and Mecke. For a much more mathematical treatment, see Chapter 13 in Lectures on the Poisson Process by Last and Penrose.

For this particularly Cox point process, see the two aforementioned preprints, located here and here.

## Simulating a Thomas cluster point process

Sometimes with just a little tweaking of a point process, you can get a new  point process. An example of this is the Thomas point process, which is a type of cluster point process, meaning that its randomly located points tend to form random clusters.  This point process is an example of a family of cluster point processes known as Neyman-Scott point processes, which have been used as models in spatial statistics and telecommunications. If that sounds familiar, that is because this point process is very similar to the Matérn point cluster process, which I covered in the previous post

The only difference between the two point processes is how the points are randomly located. In each cluster of a Thomas point process, each individual point is located according to two independent zero-mean normal variables with variance $$\sigma^2$$, describing the $$x$$ and $$y$$ coordinates relative to the cluster centre, whereas each point of a Matérn point process is located uniformly in a disk.

Working in polar coordinates, an equivalent way to simulate a Thomas point process is to use independent and identically-distributed Rayleigh random variables for the radial (or $$\rho$$) coordinates, instead of using random variables with a triangular distribution, which are used to simulate the Matérn point process. This method works because in polar coordinates a uniform random variable for the angular (or $$\theta$$ ) coordinate and a Rayleigh random variable for the angular (or $$\rho$$) is equivalent to in Cartesian coordinates two independent zero-mean normal variables. This is exactly the trick behind the Box-Muller transform for generating normal random variables using just uniform random variables.

If you’re familiar with simulating the Matérn point process, you can skip the next couple sections, and just read how the points are located.

## Overview

Simulating a Thomas cluster point process requires first simulating a homogeneous Poisson point process with intensity $$\lambda>0$$ on some simulation window, such as a rectangle, which is the simulation window I will use here. Then for each point of this underlying point process, simulate a Poisson number of points with mean $$\mu>0$$, and for each point simulate two independent zero-mean normal variables with variance $$\sigma^2$$, corresponding to the (relative) Cartesian coordinates .

The underlying  point process is sometimes called the parent (point) process, and its points are centres of the cluster disks. The subsequent point process on all the disks is called daughter (point) process and it forms the clusters. I have already written about simulating the homogeneous Poisson point processes on a rectangle and a disk, so  those posts are good starting points, and I will not focus  too much on details for these steps steps.

Importantly, like the Matérn point process, it’s possible for daughter points to appear in the simulation window that come from parents points outside the simulation window. To handle these edge effects, the point processes must be first simulated on an extended version of the simulation window. Then only the daughter points within the simulation window are kept and the rest are removed.

We can add a strip of some width $$d$$ all around the simulation window. But what value does $$d$$ take? Well, in theory, it is possible that a daughter point comes from a parent point that is very far from the simulation window. But that probability becomes vanishingly small as the distance increases, due to the daughter points being located according to zero-mean normal random variables.

For example, if a single parent is at a distance $$d=6 \sigma$$ from the simulation, then there is about a $1/1 000 000 000$ chance that a single daughter point will land in the simulation window. The probability is simply $$1-\Phi(6 \sigma)$$, where $$\Phi$$ is the cumulative distribution function of a normal variable with zero mean and standard deviation $$\sigma>0$$.  This is what they call a six sigma event.  In my code, I set $$d=6 \sigma$$, but $$d=4 \sigma$$ is good enough, which is the value that the R library spatstat uses by default.

Due to this approximation, this simulation cannot be called a perfect simulation, despite the approximation being highly accurate. In practice, it will not have no measurable effect on simulation results, as the number of simulations will rarely be high enough for (hypothetical) daughter points to come from (hypothetical) parent points outside the window.

## Steps

##### Number of points

Simulate the underlying or parent Poisson point process on the rectangle with $$N_P$$ points. Then for each point, simulate a Poisson number of points, where each disk now has $$D_i$$ number of points. Then the total number of points is simply $$N=D_1+\dots +D_{P}=\sum_{i=1}^{N_P}D_i$$. The random variables $$P$$ and $$D_i$$ are Poisson random variables with respective means $$\lambda A$$ and $$\mu$$, where $$A$$ is the area of the rectangular simulation window. To simulate these random variables in MATLAB, use the poissrnd function. To do this in R, use the  standard function rpois. In Python, we can use either functions scipy.stats.poisson or numpy.random.poisson from the SciPy or NumPy libraries.

##### Locations of points

The points of the parent point process are randomly positioned by using Cartesian coordinates. For a homogeneous Poisson point process, the $$x$$ and $$y$$ coordinates of each point are independent uniform points, which is also the case for the binomial point process, covered in an earlier post.

As mentioned in the introduction of this post, the points of all the daughter point process are randomly positioned by either using polar  coordinates or Cartesian coordinates, due to the Box-Muller transform. But because we ultimately convert back to Cartesian coordinates (for example, to plot the points), we will work entirely in this coordinate system.  Each point is then simply positioned with two independent zero-mean normal random variables, representing the $$x$$ and $$y$$ coordinates relative to the original parent point.

##### Shifting all the points in each cluster disk

In practice (that is, in the code), all the daughter points are simulated relative to the origin. Then for each cluster disk, all the points need to be shifted, so the origin coincides with the parent point, which completes the simulation step.

To use vectorization in the code,  the coordinates of each cluster point are repeated by the number of daughters in the corresponding cluster by using the functions repelem in MATLAB, rep in R, and repeat in Python.

## Code

I have implemented the simulation procedure in MATLAB, R and Python, which as usual are all very similar. The code can be downloaded here.

##### MATLAB
 %Simulation window parameters xMin=-.5; xMax=.5; yMin=-.5; yMax=.5; %Parameters for the parent and daughter point processes lambdaParent=10;%density of parent Poisson point process lambdaDautgher=100;%mean number of points in each cluster sigma=0.05;%sigma for normal variables (ie random locations) of daughters %Extended simulation windows parameters rExt=7*sigma; %extension parameter -- use factor of deviation %for rExt, use factor of deviation sigma eg 6 or 7 xMinExt=xMin-rExt; xMaxExt=xMax+rExt; yMinExt=yMin-rExt; yMaxExt=yMax+rExt; %rectangle dimensions xDeltaExt=xMaxExt-xMinExt; yDeltaExt=yMaxExt-yMinExt; areaTotalExt=xDeltaExt*yDeltaExt; %area of extended rectangle %Simulate Poisson point process for the parents numbPointsParent=poissrnd(areaTotalExt*lambdaParent,1,1);%Poisson number %x and y coordinates of Poisson points for the parent xxParent=xMinExt+xDeltaExt*rand(numbPointsParent,1); yyParent=yMinExt+yDeltaExt*rand(numbPointsParent,1); %Simulate Poisson point process for the daughters (ie final poiint process) numbPointsDaughter=poissrnd(lambdaDautgher,numbPointsParent,1); numbPoints=sum(numbPointsDaughter); %total number of points %Generate the (relative) locations in Cartesian coordinates by %simulating independent normal variables xx0=normrnd(0,sigma,numbPoints,1); yy0=normrnd(0,sigma,numbPoints,1); %replicate parent points (ie centres of disks/clusters) xx=repelem(xxParent,numbPointsDaughter); yy=repelem(yyParent,numbPointsDaughter); %translate points (ie parents points are the centres of cluster disks) xx=xx(:)+xx0; yy=yy(:)+yy0; %thin points if outside the simulation window booleInside=((xx>=xMin)&(xx<=xMax)&(yy>=yMin)&(yy<=yMax)); %retain points inside simulation window xx=xx(booleInside); yy=yy(booleInside); %Plotting scatter(xx,yy);
##### R

Note: it is a bit tricky to write “<-” in the R code (as it automatically changes to the html equivalent in the HTML editor I am using), so I have usually used “=” instead of the usual “<-”.

 #Simulation window parameters xMin=-.5; xMax=.5; yMin=-.5; yMax=.5; #Parameters for the parent and daughter point processes lambdaParent=10;#density of parent Poisson point process lambdaDaughter=100;#mean number of points in each cluster sigma=0.05; #sigma for normal variables (ie random locations) of daughters #Extended simulation windows parameters rExt=7*sigma; #extension parameter #for rExt, use factor of deviation sigma eg 6 or 7 xMinExt=xMin-rExt; xMaxExt=xMax+rExt; yMinExt=yMin-rExt; yMaxExt=yMax+rExt; #rectangle dimensions xDeltaExt=xMaxExt-xMinExt; yDeltaExt=yMaxExt-yMinExt; areaTotalExt=xDeltaExt*yDeltaExt; #area of extended rectangle #Simulate Poisson point process for the parents numbPointsParent=rpois(1,areaTotalExt*lambdaParent);#Poisson number of points #x and y coordinates of Poisson points for the parent xxParent=xMinExt+xDeltaExt*runif(numbPointsParent); yyParent=yMinExt+yDeltaExt*runif(numbPointsParent); #Simulate Poisson point process for the daughters (ie final poiint process) numbPointsDaughter=rpois(numbPointsParent,lambdaDaughter); numbPoints=sum(numbPointsDaughter); #total number of points #Generate the (relative) locations in Cartesian coordinates by #simulating independent normal variables xx0=rnorm(numbPoints,0,sigma); yy0=rnorm(numbPoints,0,sigma); #replicate parent points (ie centres of disks/clusters) xx=rep(xxParent,numbPointsDaughter); yy=rep(yyParent,numbPointsDaughter); #translate points (ie parents points are the centres of cluster disks) xx=xx+xx0; yy=yy+yy0; #thin points if outside the simulation window booleInside=((xx>=xMin)&(xx<=xMax)&(yy>=yMin)&(yy<=yMax)); #retain points inside simulation window xx=xx[booleInside]; yy=yy[booleInside]; #Plotting par(pty="s") plot(xx,yy,'p',xlab='x',ylab='y',col='blue');

Of course, as I have mentioned before, simulating a spatial point processes in R is even easier with the powerful spatial statistics library spatstat. The Thomas cluster point process is simulated by using the function rThomas, but other cluster point processes, including Neyman-Scott types, are possible.

##### Python

Note: in previous posts I used the SciPy functions for random number generation, but now use the NumPy ones, but there is little difference, as SciPy builds off NumPy.

 import numpy as np;  # NumPy package for arrays, random number generation, etc import matplotlib.pyplot as plt  # For plotting # Simulation window parameters xMin = -.5; xMax = .5; yMin = -.5; yMax = .5; # Parameters for the parent and daughter point processes lambdaParent = 10; # density of parent Poisson point process lambdaDaughter = 100; # mean number of points in each cluster sigma = 0.05; # sigma for normal variables (ie random locations) of daughters #Extended simulation windows parameters rExt=7*sigma; #extension parameter #for rExt, use factor of deviation sigma eg 6 or 7 xMinExt = xMin - rExt; xMaxExt = xMax + rExt; yMinExt = yMin - rExt; yMaxExt = yMax + rExt; # rectangle dimensions xDeltaExt = xMaxExt - xMinExt; yDeltaExt = yMaxExt - yMinExt; areaTotalExt = xDeltaExt * yDeltaExt; # area of extended rectangle # Simulate Poisson point process for the parents numbPointsParent = np.random.poisson(areaTotalExt * lambdaParent);# Poisson number of points # x and y coordinates of Poisson points for the parent xxParent = xMinExt + xDeltaExt * np.random.uniform(0, 1, numbPointsParent); yyParent = yMinExt + yDeltaExt * np.random.uniform(0, 1, numbPointsParent); # Simulate Poisson point process for the daughters (ie final poiint process) numbPointsDaughter = np.random.poisson(lambdaDaughter, numbPointsParent); numbPoints = sum(numbPointsDaughter); # total number of points # Generate the (relative) locations in Cartesian coordinates by # simulating independent normal variables xx0 = np.random.normal(0, sigma, numbPoints); # (relative) x coordinaets yy0 = np.random.normal(0, sigma, numbPoints); # (relative) y coordinates # replicate parent points (ie centres of disks/clusters) xx = np.repeat(xxParent, numbPointsDaughter); yy = np.repeat(yyParent, numbPointsDaughter); # translate points (ie parents points are the centres of cluster disks) xx = xx + xx0; yy = yy + yy0; # thin points if outside the simulation window booleInside=((xx>=xMin)&(xx<=xMax)&(yy>=yMin)&(yy<=yMax)); # retain points inside simulation window xx = xx[booleInside]; yy = yy[booleInside]; # Plotting plt.scatter(xx, yy, edgecolor='b', facecolor='none', alpha=0.5); plt.xlabel("x"); plt.ylabel("y"); plt.axis('equal');
##### Julia

After writing this post, I later wrote the code in Julia. The code is here and my thoughts about Julia are here.

## Results

The results show that the clusters of Thomas point process tend to be more blurred than those of Matérn point process, which has cluster edges clearly defined by the disks.  The points of of a Thomas point process can be far away from the centre of each cluster, depending on the variance of the normal random variables used in the simulation.

##### Python

Thomas (and Matérn) cluster point processes and more generally Neyman-Scott point processes are covered in standard books on the related fields of spatial statistics, point processes and stochastic geometry, such as the following: Spatial Point Patterns: Methodology and Applications with R by  Baddeley, Rubak and Turner, on page 461; Statistical Analysis and Modelling of Spatial Point Patterns Statistics by Illian, Penttinen, Stoyan, amd Stoyan, page 370 and Section 6.3.2; Stochastic Geometry and its Applications by Chiu, Stoyan, Kendall and Mecke,  on page 173; and; Statistical Inference and Simulation for Spatial Point Processes by Møller and Waagepetersen, in Section 5.3. I would probably recommend the first two books for beginners.

The Thomas point process has also appeared in models of wireless networks, which we covered in the book Stochastic Geometry Analysis of Cellular Networks by Błaszczyszyn, Haenggi, Keeler, and Mukherjee, Section 8.1.8.

More generally, Neyman-Scott point processes belong to a family of point processes called shot noise Cox point processes; see the paper by Møller.

There is the book Spatial Point Patterns: Methodology and Applications with R written by spatial statistics experts Baddeley, Rubak and Turner, which covers the spatial statistics (and point process simulation) R-package spatstat.

In my travels on the web, I found this post where the writer also simulates the Thomas and Matérn point processes in Python, independent of my code.  That code is a bit different to mine because I use the repeat function and simulate all the Poisson variables at once, instead of using a for-loop and simulating a Poisson variable for each iteration.  I also think it’s not quite correct because I do not see how they account for edge effects.

## Simulating a Matérn cluster point process

A Matérn cluster point process is a type of cluster point process, meaning that its randomly located points tend to form random clusters. (I skip the details here, but by using techniques from spatial statistics, it is possible to make the definition of clustering more precise.) This point process is an example of a family of cluster point processes known as Neyman-Scott point processes, which have been used in spatial statistics and telecommunications.

I should point out that the Matérn cluster point process should not be confused with the Matérn hard-core point process, which is a completely different type of point process. (For a research article, I have actually written code in MATLAB that simulates this type of point process.) Bertril Matérn proposed at least four types of point processes, and his name also refers to a specific type of covariance function used to define Gaussian processes.

## Overview

Simulating a Matérn cluster point process requires first simulating  a homogeneous Poisson point process with an intensity $$\lambda>0$$ on some simulation window, such as a rectangle, which is the simulation window I will use here. Then for each point of this underlying point process, simulate a Poisson number of points with mean $$\mu>0$$ uniformly on a disk with a constant radius $$r>0$$. The underlying  point process is sometimes called the parent (point) process, and its points are centres of the cluster disks.

The subsequent point process on all the disks is called daughter (point) process and it forms the clusters. I have already written about simulating the homogeneous Poisson point processes on a rectangle and a disk, so those posts are good starting points, and I will not focus  too much on details for these steps.

### Edge effects

The main challenge behind sampling this point process, which I originally forgot about in an earlier version of this post, is that it’s possible for daughter points to appear in the simulation window that come from parents points outside the simulation window. In other words, parents points outside the simulation window contribute to points inside the window.

To remove these edge effects, the point processes must be simulated on an extended version of the simulation window. Then only the daughter points within the simulation window are kept and the rest are removed.  Consequently, the points are simulated on an extended window, but we only see the points inside the simulation window.

To create the extended simulation window, we can add a strip of width $$r$$ all around the simulation window. Why? Well, the distance $$r$$ is the maximum distance from the simulation window that a possibly contributing parent point (outside the simulation window) can exist, while still having daughter points inside the simulation window. This means it is impossible for a hypothetical parent point beyond this distance (outside the extended window) to generate a daughter point that can fall inside the simulation window.

## Steps

##### Number of points

Simulate the underlying or parent Poisson point process on the rectangle with $$N_P$$ points. Then for each point, simulate a Poisson number of points, where each disk now has $$D_i$$ number of points. Then the total number of points is simply $$N=D_1+\dots +D_{P}=\sum_{i=1}^{N_P}D_i$$. The random variables $$P$$ and $$D_i$$ are Poisson random variables with respective means $$\lambda A$$ and $$\mu$$, where $$A$$ is the area of the rectangular simulation window. To simulate these random variables in MATLAB, use the poissrnd function. To do this in R, use the  standard function rpois. In Python, we can use either functions scipy.stats.poisson or numpy.random.poisson from the SciPy or NumPy libraries.

##### Locations of points

The points of the parent point process are randomly positioned by using Cartesian coordinates. For a homogeneous Poisson point process, the $$x$$ and $$y$$ coordinates of each point are independent uniform points, which is also the case for the binomial point process, covered in a previous post. The points of all the daughter point process are randomly positioned by using polar  coordinates. For a homogeneous Poisson point process, the $$\theta$$ and $$\rho$$ coordinates of each point are independent  variables,  respectively with uniform and triangle distributions, which was covered in a previous post. Then we  convert coordinates back to Cartesian form, which is easily done in MATLAB with the pol2cart function. In languages without such a function: $$x=\rho\cos(\theta)$$ and $$y=\rho\sin(\theta)$$.

##### Shifting all the points in each cluster disk

In practice (that is, in the code), all the daughter points are simulated in a disk with its centre at the origin. Then for each cluster disk, all the points have to be shifted to the origin is the center of the cluster, which completes the simulation step.

To use vectorization in the code,  the coordinates of each cluster point are repeated by the number of daughters in the corresponding cluster by using the functions repelem in MATLAB, rep in R, and repeat in Python.

## Code

I’ll now give some code in MATLAB, R and Python, which you can see are all very similar. It’s also located here.

##### MATLAB

The MATLAB code is located here.

#### R

The R code is located here.

Of course, as I have mentioned before, simulating a spatial point processes in R is even easier with the powerful spatial statistics library spatstat. The Matérn cluster point process is simulated by using the function rMatClust, but other cluster point processes, including Neyman-Scott types, are possible.

##### Python

The Pyyhon code is located here.

Note: in previous posts I used the SciPy functions for random number generation, but now use the NumPy ones, but there is little difference, as SciPy builds off NumPy.

##### Julia

After writing this post, I later wrote the code in Julia. The code is here and my thoughts about Julia are here.


text:
# subsamp v0.1.0

0

0th

Percentile

## Subsample Winner Algorithm for Variable Selection in Linear Regression with a Large Number of Variables

This subsample winner algorithm (SWA) for regression with a large-p data (X, Y) selects the important variables (or features) among the p features X in explaining the response Y. The SWA first uses a base procedure, here a linear regression, on each of subsamples randomly drawn from the p variables, and then computes the scores of all features, i.e., the p variables, according to the performance of these features collected in each of the subsample analyses. It then obtains the 'semifinalist' of the features based on the resulting scores and determines the 'finalists', i.e., the important features, from the 'semifinalist'. Fan, Sun and Qiao (2017) <http://sr2c.case.edu/swa-reg/>.

## Functions in subsamp

 Name Description subsamp Subsample Winner Algorithm for Variable Selection in Linear Regression with a Large Number of Variables No Results!


text:
# Need Some Disjoint Sets? (A Measure Theory Trick)

Here's a quick "trick" that arises early on in a study of measure theory:

Trick: Given a countable collection of measureable sets $E_1,E_2,\ldots$ in some set $X$, consider their union $\bigcup_{i=1}^\infty E_i$. There exists an algorithm which allows us to create a new countable collection of measurable sets $F_1,F_2,\ldots$ such that the $F_i$ are pairwise disjoint and  have the same union as the original, i.e. $\cup_i F_i = \cup_i E_i$.

Here's how:

• Step 1: Given $\{E_i\}_{i=1}^\infty$, set $F_1=E_1$.
• Step 2: For each $i>1$, define $F_i=E_i\smallsetminus \bigcup_{j=1}^{i-1}E_j$.
• Step 3: Observe that the $F_i,F_j$ are pairwise disjoint and that $\bigcup_{i=1}^{\infty}E_i=\bigcup_{i=1}^{\infty}F_i$. Voila!

To illustrate, suppose we have five sets: $E_1$ through $E_5$, represented by the five (very lopsided) "ovals" below. Then:

Each shade of blue represents one of the $F_i$, showing they are indeed disjoint. Also, their union $\bigcup_{i=1}^5 F_i$ is equal to $\bigcup_{i=1}^5 E_i$ as claimed.

As far as application goes, one place you might find this little trick is in the proof that if $X$ is a measure space with measure $\lambda$, then $\lambda$ is continuous from below. That is, if $\{E_i\}_{i=1}^\infty\subset X$ is a collection of measurable sets such that $E_1\subset E_2\subset\cdots$, then $$\lambda\left(\bigcup_{i=1}^\infty E_i\right)=\sum_{i=1}^\infty \lambda(E_i).$$

Side Comment: This trick is almost like the "measure theory version" of the Gram-Schmidt Process from linear algebra!

Gram-Schmidt: If $\mathscr{A}=\{v_1,\ldots,v_n\}$ is a set of linearly independent vectors in some vector space $V$, then there is an algorithm which converts $\mathscr{A}$ to an orthonormal set (so the $v_i$, $v_j$ are "disjoint" in the sense that their inner product is zero) with the same span (i.e. the new collection of vectors has the same "cover" as the original).

Share
Related Posts


text:
+21 votes
2.1k views

Match the following NFAs with the regular expressions they correspond to:

1. $\epsilon + 0\left(01^*1+00\right)^*01^*$

2. $\epsilon + 0\left(10^*1+00\right)^*0$

3. $\epsilon + 0\left(10^*1+10\right)^*1$

4. $\epsilon + 0\left(10^*1+10\right)^*10^*$

1. $P-2, Q-1, R-3, S-4$
2. $P-1, Q-3, R-2, S-4$
3. $P-1, Q-2, R-3, S-4$
4. $P-3, Q-2, R-1, S-4$
asked
edited | 2.1k views

## 4 Answers

+21 votes
Best answer

$S-4$ is confirmed

$R-3$ is true coz everything it accepts ends with $1$; this is made mandatory only by $3$
this rules out option B and option D

use string $01010$ and compare $P$ Vs $Q$; this makes $Q-2$ as confirmed.

Hence, option C is correct.

answered by Boss (30.7k points)
edited
+2
1.   0010 should be accepted , only P is possible for it...

2. 0110 should be accepted , only Q is possible for it...

4 . 010 should be accepted.. Only possible by S.

So option C is Right..
0
the minimum value accepted by P is  0

but that isnt accepted by any of the options

where did i go wrong ?
0
The minimum value accepted by p is not 0. It's empty string.

Moreover p doesn't even accept "0".

Second minimal length string is "00".
0
@nymeria

in the diagram

only on input 0 it goes to accepting state right ?

to accept empty string the start state must be an accepting state , which is not so
+2 votes
Correct Ans is (C)

Trace the given regular expressions with the diagrams
answered by Loyal (6.1k points)
+2 votes
Lets go step by step by step, eliminating the given options:

Min string accepted by P is 00 , therefore 3, and 4 cant be the RE for it as they say 01 must be included.

Min string accepted by Q is 00 , therefore again 3, 4 cant be RE for Q for the same reason mentioned above.

So by now, we left only 2 options, answer has to be A or C.

2nd min accepted by P is 001, but RE in 2 says string start and end with 0. Therefore RE for P is 1 making 2 as RE for Q.

Therefore answer is Option C.
answered by Active (1.5k points)
0
nice!
–2 votes
for these kind of qst its better to go with trail and error (i.e by taking a valid string and by checking each FA but not to go with method) bcz this method takes lots of time which will kill around 5 mins

and i did like that (trail and error)
it takes
me only 2 mins.

OPTION IS C
answered by Junior (743 points)
edited
Answer:

+27 votes
4 answers
1
+28 votes
4 answers
2
+14 votes
3 answers
3


text:
Lemma 16.3.4. Let $R \to A$ be a smooth ring map. Then there exists a smooth $R$-algebra map $A \to B$ with a retraction such that $B$ is standard smooth over $R$, i.e.,

$B \cong R[x_1, \ldots , x_ n]/(f_1, \ldots , f_ c)$

and $\det (\partial f_ j/\partial x_ i)_{i, j = 1, \ldots , c}$ is invertible in $B$.

Proof. Apply Lemma 16.3.3 to get a smooth $R$-algebra map $A \to C$ with a retraction such that $C = R[x_1, \ldots , x_ n]/(f_1, \ldots , f_ c)$ is a relative global complete intersection over $R$. As $C$ is smooth over $R$ we have a short exact sequence

$0 \to \bigoplus \nolimits _{j = 1, \ldots , c} C f_ j \to \bigoplus \nolimits _{i = 1, \ldots , n} C\text{d}x_ i \to \Omega _{C/R} \to 0$

Since $\Omega _{C/R}$ is a projective $C$-module this sequence is split. Choose a left inverse $t$ to the first map. Say $t(\text{d}x_ i) = \sum c_{ij} f_ j$ so that $\sum _ i \frac{\partial f_ j}{\partial x_ i} c_{i\ell } = \delta _{j\ell }$ (Kronecker delta). Let

$B' = C[y_1, \ldots , y_ c] = R[x_1, \ldots , x_ n, y_1, \ldots , y_ c]/(f_1, \ldots , f_ c)$

The $R$-algebra map $C \to B'$ has a retraction given by mapping $y_ j$ to zero. We claim that the map

$R[z_1, \ldots , z_ n] \longrightarrow B',\quad z_ i \longmapsto x_ i - \sum \nolimits _ j c_{ij} y_ j$

is étale at every point in the image of $\mathop{\mathrm{Spec}}(C) \to \mathop{\mathrm{Spec}}(B')$. In $\Omega _{B'/R[z_1, \ldots , z_ n]}$ we have

$0 = \text{d}f_ j - \sum \nolimits _ i \frac{\partial f_ j}{\partial x_ i} \text{d}z_ i \equiv \sum \nolimits _{i, \ell } \frac{\partial f_ j}{\partial x_ i} c_{i\ell } \text{d}y_\ell \equiv \text{d}y_ j \bmod (y_1, \ldots , y_ c)\Omega _{B'/R[z_1, \ldots , z_ n]}$

Since $0 = \text{d}z_ i = \text{d}x_ i$ modulo $\sum B'\text{d}y_ j + (y_1, \ldots , y_ c)\Omega _{B'/R[z_1, \ldots , z_ n]}$ we conclude that

$\Omega _{B'/R[z_1, \ldots , z_ n]}/ (y_1, \ldots , y_ c)\Omega _{B'/R[z_1, \ldots , z_ n]} = 0.$

As $\Omega _{B'/R[z_1, \ldots , z_ n]}$ is a finite $B'$-module by Nakayama's lemma there exists a $g \in 1 + (y_1, \ldots , y_ c)$ that $(\Omega _{B'/R[z_1, \ldots , z_ n]})_ g = 0$. This proves that $R[z_1, \ldots , z_ n] \to B'_ g$ is unramified, see Algebra, Definition 10.151.1. For any ring map $R \to k$ where $k$ is a field we obtain an unramified ring map $k[z_1, \ldots , z_ n] \to (B'_ g) \otimes _ R k$ between smooth $k$-algebras of dimension $n$. It follows that $k[z_1, \ldots , z_ n] \to (B'_ g) \otimes _ R k$ is flat by Algebra, Lemmas 10.128.1 and 10.140.2. By the critère de platitude par fibre (Algebra, Lemma 10.128.8) we conclude that $R[z_1, \ldots , z_ n] \to B'_ g$ is flat. Finally, Algebra, Lemma 10.143.7 implies that $R[z_1, \ldots , z_ n] \to B'_ g$ is étale. Set $B = B'_ g$. Note that $C \to B$ is smooth and has a retraction, so also $A \to B$ is smooth and has a retraction. Moreover, $R[z_1, \ldots , z_ n] \to B$ is étale. By Algebra, Lemma 10.143.2 we can write

$B = R[z_1, \ldots , z_ n, w_1, \ldots , w_ c]/(g_1, \ldots , g_ c)$

with $\det (\partial g_ j/\partial w_ i)$ invertible in $B$. This proves the lemma. $\square$

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:
# Article

 Title: Weyl algebra and a realization of the unitary symmetry (English) Author: Strasburger, Aleksander Language: English Journal: Proceedings of the 17th Winter School "Geometry and Physics" Volume: Issue: 1997 Year: Pages: [101]-111 . Category: math . Summary: In the paper the origins of the intrinsic unitary symmetry encountered in the study of bosonic systems with finite degrees of freedom and its relations with the Weyl algebra (1979, Jacobson) generated by the quantum canonical commutation relations are presented. An analytical representation of the Weyl algebra formulated in terms of partial differential operators with polynomial coefficients is studied in detail. As a basic example, the symmetry properties of the $d$-dimensional quantum harmonic oscillator are considered. In this case the usual set of the creation and annihilation operators is used as basis of the Weyl algebra under consideration. From this model are deduced the underlying symplectic structure and some of its consequences. In particular, the transitions from the initial $\text{Sp}(d,\bbfC)$-invariant model to the $\text{GL}(d,\bbfC)$- and, at last, $\text{U}(d)$-invariant models are performed. (English) MSC: 16S32 MSC: 17B45 MSC: 22E60 MSC: 22E70 MSC: 33C80 MSC: 81R05 idZBL: Zbl 0992.16019 idMR: MR1662731 . Date available: 2009-07-13T21:40:08Z Last updated: 2012-09-18 Stable URL: http://hdl.handle.net/10338.dmlcz/701620 .

## Files

Files Size Format View
WSGP_17-1997-1_13.pdf 798.3Kb application/pdf View/Open

Partner of


text:
Khalid Saifullah

# Intuitions for the Simpson's Paradox

Let's say you've got two doctors, Doctor Hilbert and Doctor Nick. Now, to decide who's better, you've got the following data before you (look at the tables below). (Let's not get into the definition of "better" at this moment)

Both of them have performed 100 surgeries in total and they were about Heart surgery and Band-aid removal (Doctors, don't get offended, it's totally an imaginary situation).

Now, after looking at the data, who would rather go with Doctor Hilbert than Doctor Nick? Would anyone prefer Doctor Nick? If so, why?

by the way, I'd definitely choose Doctor Hilbert...

#### Doctor Hilbert

Heart SurgeryBand-Aid Removal
Success7010
Failure200

#### Doctor Nick

Heart SurgeryBand-Aid Removal
Success281
Failure89

### Intuition

Now, if you're wondering I'll probably do some hairy math stuff and will show you that Doctor Nick is actually better, then no, I'm not gonna do anything like that, Doctor Hilbert is indeed better than Doctor Nick in Heart Surgery and also in Band-aid removal. But still, Doctor Nick may claim to people that he's better, how?

Well, if you calculate the success rate of both the doctors, then you'd get:

$SuccessRate_{DoctorHilbert} = 70 + 10 = 80\%$

$SuccessRate_{DoctorNick} = 2 + 81 = 83\%$

As you can see, Doctor Nick has a higher success rate than Doctor Hilbert!!!

But how can this even happen you may ask, as we clearly saw, Doctor Hilbert had better numbers for each surgery...

This is what we call the Simpson's Paradox. It says, the sign of inequality can get flipped when you aggregate the data. Which means, even if person A is better than person B in every possible category, yet when you aggregate it can somehow get flipped! It seems very counterintuitive, and most people would even say that's not possible, yet Simpson's paradox says it is.

In our case, for individual surgery Doctor Hilbert was better than Doctor Nick, it is what we call conditional. It means, when you condition on the surgery, Doctor Hilbert is better. However, unconditionally, Doctor Nick has a higher success rate.

If you look closely at the data, you would understand why it happens, as you can see, $90\%$ of Doctor Nick's surgery was about Band-aid removal, well, that's so much trivial than heart surgery, so it's easier for him to get higher success rate because he's performing easier surgeries. Obviously, the data was made up, but you can imagine in real world case, a world renowned doctor may not have the great success rate, well that's because he/she deals with the most extreme cases.

### Simpson's paradox expressed in terms of conditional probability

Let's just map our example with some probabilistic events:

$A: successful\ surgery$
$B: treated\ by\ Doctor\ Nick$
$B': treated\ by\ Doctor\ Hilbert$
$C: heart\ surgery$
$C': band-aid\ removal$

From the table's data above, we can write the following statements:

$P(A|B, C) < P(A|B', C) \\ P(A|B, C') < P(A|B', C') \\$

But, when we aggregate (i.e. not condition on the surgery):

$P(A|B) > P(A|B')$

### Conclusion:

If you're wondering, "well, that stuff probably isn't very common", you'd be surprised that it is. The most recent example that comes to my mind is the Covid-19 case fatality rates. There're lots of other great examples of simpson's paradox in wikipedia as well, you should definitely check them out.

### Acknowledgments:

Please hit me up on twitter or comment below for any feedback or corrections.


text:
# 5.2 Lab 4: lab  (Page 6/7)

 Page 6 / 7

A working program can be produced by compiling the C code and linking assembly modules and the core module. The compilertranslates C code to a relocatable assembly form. The linker assigns physical addresses on the DSP to the relocatable dataand code segments, resolves .global references and links runtime libraries.

The procedure for compiling C code and linking assembly modules has been automated for you in the batch file v:\ece420\54x\dsptools\c_asm.bat . The name of the first file becomes the name of the executable. Once you havecompleted lab4main.c and c_fft_given.asm , type c_asm lab4main.c c_fft_given.asm to produce a lab4main.out file to be loaded onto the DSP. For the C FFT type c_asm lab4main.c lab4fft.c to produce lab4main.out . Load the output file onto the DSP as usual and confirm that validFFTs are calculated. Once valid output is obtained, measure how many clock cycles it takes to compute both the assembly and C FFT.

## Quiz information

From your prelab experiments, you should be able to describe the effect of windowing and zero-padding on FFT spectralanalysis. In your DSP system, experiment with differentinputs, changing $N$ and the type of window. Can you explain what happens as the input frequency is increased beyond the Nyquist rate? Does the $\left|X(k)\right|^{2}$ coincide with what you expect from Matlab? What is the relationship between the observed spectrum and the DTFT?What would happen if the FFT calculation takes longer than it takes to fill inputs with $N$ samples? How long does it take to compute each FFT? What are the tradeoffs between writing code in C versus assembly?

## Appendix a:

1 /* v:/ece420/54x/dspclib/lab4main.c */ 2 /* dgs - 9/14/2001 */ 3 /* mdk - 2/10/2004 C FFT update */ 4 5 #include "v:/ece420/54x/dspclib/core.h" 6 7 /* comment the next line to use assembly fft */ 8 #define C_FFT 9 10 #ifdef C_FFT /* Use C FFT */ 11 12 #include "window.h" 13 #include "lab4.h" /* Number of C FFT points defined here */ 14 15 /* function defined in lab4fft.c */ 16 void fft(void); 17 18 /* FFT data buffers */ 19 int real[N]; /* Real part of data */ 20 int imag[N]; /* Imaginary part of data */ 21 22 #else /* Use assembly FFT */ 23 24 #define N 1024 /* Number of assembly FFT points */ 25 26 /* Function defined by c_fft_given.asm */ 27 void bit_rev_fft(void); 28 29 /* FFT data buffers (declared in c_fft_given.asm) */ 30 extern int bit_rev_data[N*2]; /* Data input for bit-reverse function */ 31 extern int fft_data[N*2]; /* In-place FFT & Output array */ 32 extern int window[N]; /* The Hamming window */ 33 34 #endif /* C_FFT */ 35 36 37 /* Our input/output buffers */ 38 int inputs[N]; 39 int outputs[N]; 40 41 volatile int input_full = 0; /* volatile means interrupt changes it */ 42 int count = 0; 43 44 45 interrupt void irq(void) 46 { 47 int *Xmitptr,*Rcvptr; /* pointers to Xmit & Rcv Bufs */ 48 int i; 49 50 static int in_irq = 0; /* Flag to prevent reentrance */ 51 52 /* Make sure we're not in the interrupt (should never happen) */ 53 if( in_irq ) 54 return; 55 56 /* Mark we're processing, and enable interrupts */ 57 in_irq = 1; 58 enable_irq(); 59 60 /* The following waitaudio call is guaranteed not to 61 actually wait; it will simply return the pointers. */ 62 WaitAudio(&Rcvptr,&Xmitptr); 63 64 /* input_full should never be true... */ 65 if( !input_full ) 66 { 67 for (i=0; i<BlockLen; i++) 68 { 69 /* Save input, and echo to channel 1 */ 70 inputs[count] = Xmitptr[6*i] = Rcvptr[4*i]; 71 72 /* Send FFT output to channel 2 */ 73 Xmitptr[6*i+1] = outputs[count]; 74 75 count++; 76 } 77 } 78 79 /* Have we collected enough data yet? */ 80 if( count >= N ) 81 input_full = 1; 82 83 /* We're not in the interrupt anymore... */ 84 disable_irq(); 85 in_irq = 0; 86 } 87 88 89 main() 90 { 91 /* Initialize IRQ stuff */ 92 count = 0; 93 input_full = 0; 94 SetAudioInterrupt(irq); /* Set up interrupts */ 95 96 while (1) 97 { 98 while( !input_full ); /* Wait for a data buffer to collect */ 99 100 /* From here until we clear input_full can only take * 101 * BlockLen sample times, so don't do too much here. */ 102 103 /* First, transfer inputs and outputs */ 104 105 #ifdef C_FFT /* Use C FFT */ 106 /* I n s e r t c o d e t o f i l l */ 107 /* C F F T b u f f e r s */ 108 109 #else /* Use assembly FFT */ 110 /* I n s e r t c o d e t o f i l l */ 111 /* a s s e m b l y F F T b u f f e r s */ 112 113 #endif /* C_FFT */ 114 115 /* Done with that... ready for new data collection */ 116 count = 0; /* Need to reset the count */ 117 input_full = 0; /* Mark we're ready to collect more data */ 118 119 /**********************************************************/ 120 /* Now that we've gotten the data moved, we can do the */ 121 /* more lengthy processing. */ 122 123 #ifdef C_FFT /* Use C FFT */ 124 125 /* Multiply the input signal by the Hamming window. */ 126 /* . . . i n s e r t C / a s m code . . . */ 127 128 /* Bit-reverse and compute FFT in C */ 129 fft(); 130 131 /* Now, take absolute value squared of FFT */ 132 /* . . . i n s e r t C / a s m code . . . */ 133 134 /* Last, set the DC coefficient to -1 for a trigger pulse */ 135 /* . . . i n s e r t C / a s m code . . . */ 136 137 /* done, wait for next time around! */ 138 139 140 #else /* Use assembly FFT */ 141 142 /* Multiply the input signal by the Hamming window. */ 143 /* . . . i n s e r t C / a s m code . . . */ 144 145 /* Bit-reverse and compute FFT in assembly */ 146 bit_rev_fft(); 147 148 /* Now, take absolute value squared of FFT */ 149 /* . . . i n s e r t C / a s m code . . . */ 150 151 /* Last, set the DC coefficient to -1 for a trigger pulse */ 152 /* . . . i n s e r t C / a s m code . . . */ 153 154 /* done, wait for next time around! */ 155 156 157 #endif /* C_FFT */ 158 159 } 160 }

where we get a research paper on Nano chemistry....?
what are the products of Nano chemistry?
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
Preparation and Applications of Nanomaterial for Drug Delivery
revolt
da
Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
I only see partial conversation and what's the question here!
what about nanotechnology for water purification
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Is there any normative that regulates the use of silver nanoparticles?
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
why we need to study biomolecules, molecular biology in nanotechnology?
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
why?
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
how did you get the value of 2000N.What calculations are needed to arrive at it
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!


text:
Anil Satpute
193 followers -
Encourage Students & Parents to build the entire World with Powerful Thinking Level
Encourage Students & Parents to build the entire World with Powerful Thinking Level

193 followers
Communities and Collections
View all
Posts
Post has attachment
Happy 72nd Independence Day with two different types of Magic squares.
https://youtu.be/Cz8X4aSEi9Q
Post has attachment
Happy 72nd Independence Day with two different types of Magic squares.
https://youtu.be/Cz8X4aSEi9Q
Post has attachment
Happy 72nd Independence Day with two different types of Magic squares.
https://youtu.be/Cz8X4aSEi9Q
Post has attachment
Happy 72nd Independence Day with two different types of Magic squares.
https://youtu.be/Cz8X4aSEi9Q
Post has attachment
Happy 72nd Independence Day with two different types of Magic squares.
https://youtu.be/Cz8X4aSEi9Q
Post has attachment
Happy 72nd Independence Day with two different types of Magic squares.
https://youtu.be/Cz8X4aSEi9Q
Post has attachment
Happy 72nd Independence Day with two different types of Magic squares.
https://youtu.be/Cz8X4aSEi9Q
Post has attachment
Happy 72nd Independence Day with two different types of Magic squares.