text:
# Find neighbors of point in matrix

I am trying to make a simulation of Conway's Game Of Life with my matrix blocks (shameless plug) and I need to find the values of each point's neighbors to change it. This is how I am doing it now:

I know I made this, but I know there are many people on here who are much smarter than I am, and could figure this out easily. Thanks!

You could use a variable that changes by 1 if the point exists, so just do change sides by (point (x) (y) exists in matrix (world)? This would only work if the vale it reports is a boolean, or 1/0.

There's many,many different ways of calculating the number of neighbours but if you make your matrix only contain 1 or 0 for alive or dead then you don't need the if statements - you can just add up all the point values

Lots of interesting answers from different people.

My own preferred approach is to make an array that's n+2 long and wide, where n is the number of points you want to use, and use coordinates 2 to n+1 for the actual points:

(and whatever you want to do for each point in the c-slot). That way, every point has all eight neighbors existing in the array.

If the proper value for a nonexistent point is zero, then as cymplecy says, you can take advantage of the fact that Snap! doesn't give you an error message for a nonexistent index in a list, just have the n by n array, and in effect every point still has eight neighbors. But I learned to program in less forgiving languages, so I put the border in explicitly.

By the way, you can say and the same for COLUMN to get all the neighbor coordinates (plus the point itself; if you don't want that you have to remove it from the resulting list of coordinate pairs).

yes! I was just going to suggest starting with something like this:

and if you want to only access coordinates that exist in the matrix, you could make it obey its dimensions:

note, this reporter includes the value of the given point itself. I always use something like that if I want to aggregate a "tile" inside a matrix, e.g. the average color for a "pixellate" effect in a photo. In that case I want the value of the given coordinate. If you only want the neighbors without the given coordinate you'd need to filter that single value out.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.


text:
To get the best deal on Tutoring, call 1-855-666-7440 (Toll Free)

# Fractions and Decimals Worksheets

Fractions and Decimals Worksheets
• Page 1
1.
Tim ate three fourths of the chocolates that he had. Which decimal represents the fraction of the chocolates he ate?
 a. 3.4 b. 0.25 c. 0.5 d. 0.75

#### Answer: (d)

Correct answer : (4)
2.
The cost of a smaller sausage is half the cost of the larger one. What is the decimal equivalent of the fraction?
 a. 4.8 b. 0.5 c. 0.48 d. 0.25

#### Answer: (b)

Correct answer : (2)
3.
Dorothy gave one tenth of her collection of marbles to Hannah. Choose the decimal that represents the fraction.
 a. 1.1 b. 0.1 c. 0.01 d. 0.2

#### Answer: (b)

Correct answer : (2)
4.
Tommy bought 3 ball-point pens for $0.84. How much does each pen cost?  a.$2.80 b. 27 cents c. 28 cents d. 0.28 cents

#### Answer: (c)

Correct answer : (3)
5.
Jessica bought 10 burgers. She gave $\frac{1}{2}$ of them to her brother. How many burgers are left with her?
 a. 2 b. 5 c. 4 d. 10

#### Answer: (b)

Correct answer : (2)
6.
Valerie had 48 crayons. She gave $\frac{1}{3}$ of them to her friend. How many crayons does she have now?
 a. 15 b. 32 c. 16 d. 18

#### Answer: (b)

Correct answer : (2)
7.
Charlie has a piece of wood that is 39 ft. long. He cuts them into equal pieces. If each piece measures $\frac{3}{4}$ of an inch, how many pieces will he get?
 a. 39 b. 52 c. 56 d. 30

#### Answer: (b)

Correct answer : (2)
8.
Andy has bought 27 gallons of milk for his coffee shop. He uses $\frac{9}{2}$ gallons of milk everyday for few days. How many days can he use the milk?
 a. 6 b. 117 c. 27 d. 12

#### Answer: (a)

Correct answer : (1)
9.
Jolie bought 10 pounds of meat to make different recipes for a Christmas party. She used $\frac{2}{3}$ pound of meat in each recipe. How many different recipes can she make?
 a. 16 b. 12 c. 6 d. 15

#### Answer: (d)

Correct answer : (4)
10.
Brad had 56 toffees in a box. He distributed them equally among all his friends. If each friend got $\frac{7}{4}$ of toffee, find the number of friends Brad has.
 a. 48 b. 54 c. 63 d. 32

#### Answer: (d)

Correct answer : (4)

 More Fractions and Decimals Worksheets Ordering Fractions and Decimals Worksheet Fraction and Decimal Equivalents Worksheet Fraction to Decimal Worksheet Decimal to Fraction Worksheet
*AP and SAT are registered trademarks of the College Board.

format: plain


text:
# Two-Step qPCR

## Materials

• SuperScript III (Thermo Fisher Scientific 18080051)
• PowerUp SYBR Green MasterMix (Fisher Scientific A25741)
• qPCR sub-skirted plate (MIDSCI AVT3890)
• Thermal sealing film (Excel Scientific TS-RT2RR-100)

## Preparation

• Two-step qPCR starts with RNA that has been DNase-treated and quantified with Qubit. Follow the the RNA extraction protocol for C. elegans or parasites.

• Use the Invitrogen SuperScript III kit to perform first-strand cDNA synthesis.

• Do not freeze RNA in between extraction and first-strand synthesis; perform synthesis immediately after quantification.

• Include a non-experimental RNA sample that comes from the same species and stage as your experimental samples (I typically use stock RNA samples from the FR3).

• If performing relative transcript quantification, be sure to normalize the RNA input based on the Qubit quantification.

• Use a 1:1 mixture of oligo(dT) and random hexamer primers and create primer and enzyme master mixes to use across all samples.

• Perform the optional RNase H digestion to remove remaining single-stranded RNAs.

• Freeze at -20°C until ready for the qPCR.

• Before optimizing your primers, validate that they work and produce the expected amplicon length by performing normal PCR on a plasmid template and/or cDNA template.

• Book the qPCR machine on the morning of the reaction.

## Primer optimization

### Primer stock dilutions

qPCR primers must be optimized for each new RNA/cDNA template. Primer optimization involves primer dilutions to find the optimal primer concentration for each primer set + template combination. Depending on your experiments, you should probably use the same stage, non-experimental cDNA sample that is at the same concentration as your experimental samples (the best practice is to include this sample in your cDNA synthesis reaction). If you are working with C. elegans, then RNA is not as precious, but if you are working with parasites then it is paramount not to waste RNA from experimental samples. The PowerUp SYBR Green Master Mix kit recommends trying 300, 500, and 800 nM final concentrations, but you can add additional (lower) concentrations as well.

### Reference Genes

• C. elegans Reference Gene: Y45F10D.4 (Citation)

• Lab Primer IDs: oMZ0516/17

• Expected Ct: 24 from 10 ng of RNA (see figure S10 in Wheeler et al. 2020)

• B. malayi Reference Gene: WBGene00225960 (Bm5699) (Citation)

• Lab Primer IDs: oMZ0257/58

• Expected Ct: ~24 from 10 ng of RNA

### Primer stock dilutions

1. Mix 20 uL of each of the paired stock qPCR primers (100 μM) and add 160 μL water to achieve final paired stock concentrations of 10 μM.

2. Use the table below to calculate primer dilutions required to achieve final primer concentrations of 300, 500, and 800 nM in your eventual 20 μL qPCR reactions. Dilute the volume of 10 μM primer stock shown below in bold to a final volume of 50 μL in water.

Ci (Primer Stock, μM) Vi (Primer Stock Input, μL)
= Cf * Vf / Ci
Vf (μL) Cf (nM)
10 3.75 50 750
10 6.25 50 1250
10 10.00 50 2000

Note: These primer dilutions (750, 1250, and 2000 nM) will achieve the intended qPCR reaction concentrations (300, 500, and 800 nM), as shown below. 8 μL of diluted primer stocks from above will be mixed with 2 μL of cDNA and 10 μL of Master Mix (MM) for a final reaction volume of 20 μL. Scale primer volumes above as necessary, depending on the number of reactions you are planning.

Ci (Cf from above, nM) Vi (μL) Vf (μL) Cf (Primers, nM)
750 8 20 300
1250 8 20 500
2000 8 20 800

### Plate setup

Note: Each qPCR reaction should use a minimum of 5 ng RNA/cDNA (10 ng is preferable). If possible, each primer dilution should be run in duplicate. Ideally, use a non-experimental cDNA sample that has the same concentration and is from the same life stage as your experimental samples.

1. Design the plate setup on Benchling (example below).

a. If possible, do not add any reactions to the outer columns or rows to ensure no evaporation (though we have not run into evaporation problems regardless of well location).

b. Keep the same primers next to each other on the plate.

c. Be sure to include no-template negative controls to check for contamination in your primer stocks.

d. In the table below, there are 3 different transgenic C. elegans strains (ZAM13A, ZAM14B, and ZAM17B), 3 different primer sets (329/330, 343/344, and 506/507), and 3 different primer dilutions (300, 500, and 800). The cells are color-coded by primer set.

2. Dilute an aliquot of the cDNA to 2.5 ng/μL so that 2 μL input cDNA will make 5ng/qPCR (or dilute to half of the final mass so that you can add 2 μL to the reaction).

3. Create primer + PowerUp SYBR Green master mixes by adding 10 μL PowerUp SYBR Green * (n + 1) + 8 μL primer dilution * (n + 1) to a single tube (one master mix per primer dilution).

4. Put a qPCR plate on ice.

5. Pipette 2 μL of the proper cDNA to the side wall of the well.

a. This makes it easier to keep track of which well has had the cDNA added.

b. Another strategy for keeping track of pipetting is arranging your pipette tip box such that you know exactly which tip will be the last one to be used.

6. Add 18 μL of the proper master mix to the dot of cDNA and allow the mixture to fall to the bottom of the tube.

7. Carefully seal the plate with sealing film.

8. Spin the plate on the plate centrifuge.

9. Examine the bottom of each well to ensure no bubbles remain. If there are bubbles, sharply flick the well until it pops. Respin the plate if necessary.

10. Return the plate to ice and move to the qPCR machine in room 311.

### Thermocycler setup

1. Touch the screen of the thermocycler to wake it up and press the on/off button to turn it on.

2. Place the qPCR plate in the machine.

3. Begin the StepOne v2.3 program and login as a guest.

4. Click “Advanced Setup, which will open the following screen.

5. Fill out the metadata and match the selections shown above.

a. Experiment name should be the date of the run.

c. Add optional comments, especially if you’re performing multiple runs on a single day.

d. Choose the StepOnePlus instrument.

e. Choose Quantitation - Standard Curve (you can perform the ΔΔCT calculation later).

f. Choose SYBR Green.

g. Choose Standard.

6. Click the “Plate Setup” menu.

a. In the “Define Targets and Samples” tab, add your targets (the transcript that you are amplifying) and samples (the RNA source) to the appropriate panes. For primer optimization runs, the “Sample Names” should be the different primer dilutions (i.e. 300, 500, and 800).

b. Ignore the “Biological Replicates” pane even if you have biological replicates.

7. Click the “Assign Targets and Samples” tab.

a. Design the plate in the same arrangement as designed on Benchling. Select a well or range of well and click the boxes next to the proper target and sample.

b. Note: each experimental sample should also include the “U” task next to the target name. Before defining no-template negative controls in the plate layout (in this case, wells C1 and D1), click the “N” box in the Task section. The no-template negative control wells will not have a sample label.

8. Click the “Run Method” menu.

a. Setup the thermocycler program according to the below screenshot. Changes that need to be made from the default program:

i. A 2 minute, 50°C hold step needs to be added before the 95° hold step in the Holding Stage.

ii. The 95° hold step should be changed to 2 minutes.

iii. Based on your primers, you probably need to add a 3rd step to the Cycling Stage. Adjust the 2nd step to 15 seconds and the annealing temperature validated with the initial PCR used to test the primers on plasmid/cDNA template. Add a 3rd step with a 1 minute, 72°C  extension. Deselect the “Data Collection” icon on the annealing step and select it on the extension step.

iv. Change the Melt Curve Stage from “Step and Hold” to “Continuous.”

v. Change the percentage of the ramp rate to 10%.

9. When finished setting up the run, click “Start Run” (green button).

10. Stay in the room until you confirm that the run has started.

### Primer optimization analysis

1. After the run is complete, click the Analysis menu.

a. You can quickly analyze the run in the StepOne program, but the lab also has an R template that allows for more customized analysis.

2. On the thermocycler computer, click Export

a. Chose all data files other than Multicomponent Data.

b. Export to a .txt file type.

c. Export to an external flash drive.

3. Transfer the .txt file to ZamanianLab/Data/qPCR/Name/Date/ and copy the primer_optimization.R script to the directory.

4. Once transferred, open the .txt file and manually edit it such that each section defined in [square brackets] is saved into its own file. You should have the following files (file names should be the exact same, otherwise the analysis script won’t work.) Make sure the [words in brackets] are removed from the files so that every line is tab-delimited.

a. results.txt

b. melt_region_derivative_data.txt

c. melt_region_normalized_data.txt

d. melt_region_temperature_data.txt

e. amplification_data.txt

f. raw_data.txt

g. sample_setup.txt

h. For instance, the header of each file should look something like this:

5. Use ~/Box/ZamanianLab/Data/qPCR/primer_optimization.R to analyze the data.

6. Examine the plot in melt_curves.pdf (below, left).

a. The plot should contain 2 columns labeled Derivative and Value; these show the changes in fluorescence emitted at different temperatures during the melting of the last step of the Melt Curve stage.

b. The plot should also contain a row for every target (i.e., primer set), and each panel should include a line for every well.

c. Analysis of the melt curves will tell you if your primers are forming primer dimers or are amplifying off-target sequences. In order to continue with the qPCR experiment, your primer should include a single peak in the Derivative plot, corresponding to a single amplicon produced by the reaction. Primer dimers will correspond to peaks at low temperatures, and longer non-off target products will correspond to peaks at higher temperatures.

d. Negative controls will not have a peak (because there should be no amplification). You will notice from the below plot that the negative controls for GAPDH and OSM-9 were correct, while it appears that there was contamination in the TAX-4 primers (every line contains a peak).

7. Examine the plot in amplification.pdf (right).

a. Again there will be a row for every target and a column for dRn and log10(dRn)

b. In the dRn column, you should see a label and line marking each of the primer dilutions you included, along with the CT value. The dilution with the lowest CT, in this case 800 for all primer sets, should be used in qPCR using experimental samples.

## qPCR with experimental samples

1. Based on the results of the primer optimization, create new primer dilutions at the optimized concentrations, this time ensuring you make enough of the qPCR primer stock for all of the reactions (use the tables above).

2. Follow the Plate setup and Thermocycler setup sections above.

a. When organizing the plate in Thermocycler setup step 6, use your different cDNAs instead of primer dilutions as the Sample Names.

b. Run the exact same thermocyler program as you ran for primer optimization.

### qPCR analysis

1. Follow steps 1 - 4 from Primer optimization analysis to export the reaction results as described.

2. Use ~/Box/ZamanianLab/Data/qPCR/qpcr_analysis.R to analyze the data.


text:
Two sets of waves in a Hertzian Dipole?

In the near field, a hertzian pole has a changing electric field and a changing magnetic field, that are in both space and time quadrature. Are two sets of EM waves then created in the far field, one from the changing e-field, and one from the changing m-field?


text:
# Line integral of vector field from Apostol calculus

## Homework Statement

Here are the three problems that i couldn't solve from the book Calculus volume 2 by apostol

10.9 Exercise

2. Find the amount of work done by the force f(x,y)=(x^2-y^2)i+2xyj in moving a particle (in a counter clockwise direction) once around the square bounded by the coordinate axes and the lines x=a and y=a, a>0

4) A force field f in 3-space is give by the formula f(x,y,z)=yzi+xzj+x(y+1)k. Calculate the work done by f in moving a particle once around the triangle with verticles (0,0,0),(1,1,1),(-1,1,-1) in that order

6) Calculate the work done by the force field f(x,y,z)=(y-z)i+(z-x)j+(x-y)k along the curve of intersection of the sphere x^2+y^2+z^2=4 and the plane z=ytanb where 0<b<pi/2. The path is tranversed in a direction that appears counterclockwise when viewed from high above th xy-plane.

## Homework Equations

3. The Attempt at a Solution [/B]

2)(0,0)-->(a,0) r(t)=ati r'(t)=ai
(a,0)-->(a,a) r(t)=atj r'(t)=aj
(a,a)-->(0,a) r(t)=-ati r'(t)=-ai
(0,a)-->(0,0) r(t)=-atj r'(t)=-aj

∫ƒ.dr= ∫(a^2 t^2)i⋅ai dt (0-->1)+ ∫(-a^2t^2)i⋅aj dt + ∫(a^2t^2)i -ai⋅dt (-1-->0) + ∫(-a^2t^2)i⋅-aj dt
=2a^3/3
yet the correct answer is 2a^3 by the textbook

4)(0,0,0)-->(1,1,1) r(t)=ti+tj+tk r'(t)=i+j+k
(1,1,1)-->(-1,1,-1) r(t)=(1-2t)i+(1-2t)k r'(t)=-2i+-2k
∫ƒ.dr= ∫t^2i+t^2j+(t^2+t)k⋅(i+j+k) dt (0-->1) + ∫(1-2t)^2i +(1-2t)k ⋅(-2i-2k) dt (0-->1)
=t^3+(5/2)t^2-2t
=3/2
yet the correct answer is 0 by the textbook

6)i stuck in parametrize the equation

Ray Vickson
Homework Helper
Dearly Missed

## Homework Statement

Here are the three problems that i couldn't solve from the book Calculus volume 2 by apostol

10.9 Exercise

2. Find the amount of work done by the force f(x,y)=(x^2-y^2)i+2xyj in moving a particle (in a counter clockwise direction) once around the square bounded by the coordinate axes and the lines x=a and y=a, a>0

4) A force field f in 3-space is give by the formula f(x,y,z)=yzi+xzj+x(y+1)k. Calculate the work done by f in moving a particle once around the triangle with verticles (0,0,0),(1,1,1),(-1,1,-1) in that order

6) Calculate the work done by the force field f(x,y,z)=(y-z)i+(z-x)j+(x-y)k along the curve of intersection of the sphere x^2+y^2+z^2=4 and the plane z=ytanb where 0<b<pi/2. The path is tranversed in a direction that appears counterclockwise when viewed from high above th xy-plane.

## Homework Equations

3. The Attempt at a Solution [/B]

2)(0,0)-->(a,0) r(t)=ati r'(t)=ai
(a,0)-->(a,a) r(t)=atj r'(t)=aj
(a,a)-->(0,a) r(t)=-ati r'(t)=-ai
(0,a)-->(0,0) r(t)=-atj r'(t)=-aj

∫ƒ.dr= ∫(a^2 t^2)i⋅ai dt (0-->1)+ ∫(-a^2t^2)i⋅aj dt + ∫(a^2t^2)i -ai⋅dt (-1-->0) + ∫(-a^2t^2)i⋅-aj dt
=2a^3/3
yet the correct answer is 2a^3 by the textbook

4)(0,0,0)-->(1,1,1) r(t)=ti+tj+tk r'(t)=i+j+k
(1,1,1)-->(-1,1,-1) r(t)=(1-2t)i+(1-2t)k r'(t)=-2i+-2k
∫ƒ.dr= ∫t^2i+t^2j+(t^2+t)k⋅(i+j+k) dt (0-->1) + ∫(1-2t)^2i +(1-2t)k ⋅(-2i-2k) dt (0-->1)
=t^3+(5/2)t^2-2t
=3/2
yet the correct answer is 0 by the textbook

6)i stuck in parametrize the equation

(2) Using the simpler parametrizations ##t = x## or ##t = y## on the segments, we have:
$$\begin{array}{l} W_{(0,0) \to (a,0)} = \int_0^a x^2 \, dx\\ W_{(a,0) \to (a,a)} = \int_0^a 2 a y \, dy\\ W_{(a,a) \to (0,a)} = \int_0^a (-) [(a-x)^2 - a^2] \, dx \\ W_{(0,a) \to (0,0)} = 0 \end{array}$$
I get the book's value.

(4) ##\vec{F } = \vec{F_1} + \vec{F_2}##, where ##\vec{F_1} = \langle yz, zx ,xy\rangle## and ##\vec{F_2} = \langle 0,0 ,x \rangle##.
Note that ##\vec{F_1} = \vec{\nabla} V##, where ##V = xyz##, so the contribution of ##\vec{F_1}## to the total work is ##\int_C \vec{\nabla} V \cdot \,d \vec{r} = 0##, by Stokes theorem. Thus, we need only look at ##\int_C \langle 0,0, x \rangle \cdot \langle dx,dy,dz \rangle##, which is a lot easier than the original problem. Of course, this simplification does not help much if you have not yet seen Stokes theorem.

(6) What type of ##xy## curve do you see if you view it from above the ##xy## plane? How would you parametrize such a curve?

Last edited:
LCKurtz
Homework Helper
Gold Member

## Homework Statement

Here are the three problems that i couldn't solve from the book Calculus volume 2 by apostol

6) Calculate the work done by the force field f(x,y,z)=(y-z)i+(z-x)j+(x-y)k along the curve of intersection of the sphere x^2+y^2+z^2=4 and the plane z=ytanb where 0<b<pi/2. The path is tranversed in a direction that appears counterclockwise when viewed from high above th xy-plane.

6)i stuck in parametrize the equation

Another hint for ##6##: If you calculate it you will find ##\nabla \times \vec f = \langle -2,-2,-2\rangle ##. You might try using Stokes' theorem that ##\int_C \vec f \cdot d\vec r =\iint_S \nabla \times \vec f \cdot d\vec S## where ##S## is the plane circular cross-section.

Last edited:
vela
Staff Emeritus


text:
# May The Earth Be Revolving Around The Sun?

Students trace the beginning of the heliocentric theory of the solar system--the idea that the solar system revolves around the Sun--to an observation by the Greek astronomer Aristarchus, which convinced him that the Sun was much bigger than the Earth.

Concepts

Resource Details


text:
# Why is the input to an activation function a linear combination of the input features?

I'm new to deep learning, and there is something about the calculations I do not understand: For a standard neural network, why is it that only the activation function is not linear, but the input to the activation function is a linear combination of each of the $$x_i$$'s? For example, with the sigmoid function, it would look like: $$\frac{1}{1+ e^{-(w_0x_0 + w_1x_1 + b)}}$$ where $$w_i$$ are the weights and $$x_i$$ represents the input to that layer.

For example, why is it that we don't have something like this: $$\frac{1}{1+ e^{-(w_0x_0^2 + w_1\sqrt{x_1} + b)}}$$

Is it because it would be redundant if we had enough layers? Or is it because a priori, you wouldn't know what the best function is?

There's also the efficiency factor since a linear combination of $$n$$ inputs each having $$m$$ dimensions can be represented using a single matrix multiplication $$h=X \times W$$ where $$X$$ is an $$n \times m$$ matrix (where each row is an example and each column is a feature of that example) and $$W$$ is an $$m \times d$$ weight matrix. And computers are VERY efficient at doing matrix multiplications. Thus, the more you build your model to use matrix multiplications the better.


text:
Search by Topic

Resources tagged with Area similar to Ratio or Proportion?:

Filter by: Content type:
Stage:
Challenge level:

There are 92 results

Broad Topics > Measures and Mensuration > Area

Bull's Eye

Stage: 3 Challenge Level:

What fractions of the largest circle are the two shaded regions?

F'arc'tion

Stage: 3 Challenge Level:

At the corner of the cube circular arcs are drawn and the area enclosed shaded. What fraction of the surface area of the cube is shaded? Try working out the answer without recourse to pencil and. . . .

How Random!

Stage: 2 Challenge Level:

Explore this interactivity and see if you can work out what it does. Could you use it to estimate the area of a shape?

Square Areas

Stage: 3 Challenge Level:

Can you work out the area of the inner square and give an explanation of how you did it?

Square Pegs

Stage: 3 Challenge Level:

Which is a better fit, a square peg in a round hole or a round peg in a square hole?

Shear Magic

Stage: 3 Challenge Level:

What are the areas of these triangles? What do you notice? Can you generalise to other "families" of triangles?

Tilted Squares

Stage: 3 Challenge Level:

It's easy to work out the areas of most squares that we meet, but what if they were tilted?

Rati-o

Stage: 3 Challenge Level:

Points P, Q, R and S each divide the sides AB, BC, CD and DA respectively in the ratio of 2 : 1. Join the points. What is the area of the parallelogram PQRS in relation to the original rectangle?

Covering Cups

Stage: 3 Challenge Level:

What is the shape and dimensions of a box that will contain six cups and have as small a surface area as possible.

Fence It

Stage: 3 Challenge Level:

If you have only 40 metres of fencing available, what is the maximum area of land you can fence off?

An Unusual Shape

Stage: 3 Challenge Level:

Can you maximise the area available to a grazing goat?

Overlap

Stage: 3 Challenge Level:

A red square and a blue square overlap so that the corner of the red square rests on the centre of the blue square. Show that, whatever the orientation of the red square, it covers a quarter of the. . . .

Exploration Versus Calculation

Stage: 1, 2 and 3

This article, written for teachers, discusses the merits of different kinds of resources: those which involve exploration and those which centre on calculation.

Great Squares

Stage: 2 and 3 Challenge Level:

Investigate how this pattern of squares continues. You could measure lengths, areas and angles.

Towers

Stage: 3 Challenge Level:

A tower of squares is built inside a right angled isosceles triangle. The largest square stands on the hypotenuse. What fraction of the area of the triangle is covered by the series of squares?

Numerically Equal

Stage: 2 Challenge Level:

Can you draw a square in which the perimeter is numerically equal to the area?

Triangle Relations

Stage: 2 Challenge Level:

What do these two triangles have in common? How are they related?

Two Squared

Stage: 2 Challenge Level:

What happens to the area of a square if you double the length of the sides? Try the same thing with rectangles, diamonds and other shapes. How do the four smaller ones fit into the larger one?

The Pi Are Square

Stage: 3 Challenge Level:

A circle with the radius of 2.2 centimetres is drawn touching the sides of a square. What area of the square is NOT covered by the circle?

Tiling Into Slanted Rectangles

Stage: 2 and 3 Challenge Level:

A follow-up activity to Tiles in the Garden.

Changing Areas, Changing Perimeters

Stage: 3 Challenge Level:

How can you change the area of a shape but keep its perimeter the same? How can you change the perimeter but keep the area the same?

A Square in a Circle

Stage: 2 Challenge Level:

What shape has Harry drawn on this clock face? Can you find its area? What is the largest number of square tiles that could cover this area?

Lying and Cheating

Stage: 3 Challenge Level:

Follow the instructions and you can take a rectangle, cut it into 4 pieces, discard two small triangles, put together the remaining two pieces and end up with a rectangle the same size. Try it!

Making Rectangles

Stage: 2 and 3 Challenge Level:

A task which depends on members of the group noticing the needs of others and responding.

Cylinder Cutting

Stage: 2 and 3 Challenge Level:

An activity for high-attaining learners which involves making a new cylinder from a cardboard tube.

Uncanny Triangles

Stage: 2 Challenge Level:

Can you help the children find the two triangles which have the lengths of two sides numerically equal to their areas?

Pick's Theorem

Stage: 3 Challenge Level:

Polygons drawn on square dotty paper have dots on their perimeter (p) and often internal (i) ones as well. Find a relationship between p, i and the area of the polygons.

Growing Rectangles

Stage: 3 Challenge Level:

What happens to the area and volume of 2D and 3D shapes when you enlarge them?

Fencing

Stage: 2 Challenge Level:

Arrange your fences to make the largest rectangular space you can. Try with four fences, then five, then six etc.

Extending Great Squares

Stage: 2 and 3 Challenge Level:

Explore one of these five pictures.

Isosceles Triangles

Stage: 3 Challenge Level:

Draw some isosceles triangles with an area of $9$cm$^2$ and a vertex at (20,20). If all the vertices must have whole number coordinates, how many is it possible to draw?

Inside Seven Squares

Stage: 2 Challenge Level:

What is the total area of the four outside triangles which are outlined in red in this arrangement of squares inside each other?

Fit These Shapes

Stage: 1 and 2 Challenge Level:

What is the largest number of circles we can fit into the frame without them overlapping? How do you know? What will happen if you try the other shapes?

Isosceles

Stage: 3 Challenge Level:

Prove that a triangle with sides of length 5, 5 and 6 has the same area as a triangle with sides of length 5, 5 and 8. Find other pairs of non-congruent isosceles triangles which have equal areas.

Poly-puzzle

Stage: 3 Challenge Level:

This rectangle is cut into five pieces which fit exactly into a triangular outline and also into a square outline where the triangle, the rectangle and the square have equal areas.

Wrapping Presents

Stage: 2 Challenge Level:

Choose a box and work out the smallest rectangle of paper needed to wrap it so that it is completely covered.

Kissing Triangles

Stage: 3 Challenge Level:

Determine the total shaded area of the 'kissing triangles'.

Kite

Stage: 3 Challenge Level:

Derive a formula for finding the area of any kite.

Warmsnug Double Glazing

Stage: 3 Challenge Level:

How have "Warmsnug" arrived at the prices shown on their windows? Which window has been given an incorrect price?

Through the Window

Stage: 2 Challenge Level:

My local DIY shop calculates the price of its windows according to the area of glass and the length of frame used. Can you work out how they arrived at these prices?

My New Patio

Stage: 2 Challenge Level:

What is the smallest number of tiles needed to tile this patio? Can you investigate patios of different sizes?

Squaring the Circle

Stage: 3 Challenge Level:

Bluey-green, white and transparent squares with a few odd bits of shapes around the perimeter. But, how many squares are there of each type in the complete circle? Study the picture and make. . . .

Making Squares

Stage: 2

Investigate all the different squares you can make on this 5 by 5 grid by making your starting side go from the bottom left hand point. Can you find out the areas of all these squares?

Ribbon Squares

Stage: 2 Challenge Level:

What is the largest 'ribbon square' you can make? And the smallest? How many different squares can you make altogether?

Cover the Tray

Stage: 2 Challenge Level:

These practical challenges are all about making a 'tray' and covering it with paper.

Making Boxes

Stage: 2 Challenge Level:

Cut differently-sized square corners from a square piece of paper to make boxes without lids. Do they all have the same volume?

Dissect

Stage: 3 Challenge Level:

It is possible to dissect any square into smaller squares. What is the minimum number of squares a 13 by 13 square can be dissected into?

Carpet Cuts

Stage: 3 Challenge Level:

You have a 12 by 9 foot carpet with an 8 by 1 foot hole exactly in the middle. Cut the carpet into two pieces to make a 10 by 10 foot square carpet.

Framed

Stage: 3 Challenge Level:

Seven small rectangular pictures have one inch wide frames. The frames are removed and the pictures are fitted together like a jigsaw to make a rectangle of length 12 inches. Find the dimensions of. . . .

Dicey Perimeter, Dicey Area

Stage: 2 Challenge Level:

In this game for two players, you throw two dice and find the product. How many shapes can you draw on the grid which have that area or perimeter?


text:
# When the Dust hits the Fan

When the dust hits the fan

Why is the CPU fan running at top speed almost constantly?
Well, it’s 30 degree Celsius, what do you expect?

# Multi-Precision Floats: Radix Conversion with Large Exponents

[UPDATE] bugfix in code listing
The method for the radix conversion of floating point numbers described more theoretically here and more practically here has one large drawback: albeit always correct it is abysmally slow for large magnitudes.

Is there a faster way to do it? Yes, there is! Continue reading

# Adventures of a Programmer: Parser Writing Peril XXXX

The final[1] grammar together with the lexer. The whole file with a lot of comments is on Github. It is currently in one file for convenience but needs to be split into a lexer (Flex) and a parser (Bison) later.

The file has a lot of comments already, not much to say here, but nevertheless… Continue reading

# Computation of the Arcsin/Arccos

The MacLaurin (Taylor series at x=0) series for the arcsin

${\displaystyle{ \arcsin(x) = \sum_{k=0}^{\infty} \frac{(2k-1)!{\kern-1.25pt}!}{(2k)!{\kern-1.25pt}!} \frac{x^{2k+1}}{2k+1} }}$

is a very slowly converging one, especially close to the branchpoints at -1 and 1.
The MacLaurin series for arccos is the same as for arcsin because of

${\displaystyle{ \arccos x = \frac{\pi}{2} - \arcsin x }}$

so it has the very same problem.

The series for the arctan on the other side is simpler to compute.
Another good reason: I have it already implemented 😉

The arcsin is related to the atan by

${\displaystyle{ \arcsin x = 2\arctan\biggl(\frac{x}{1 + \sqrt{1 - x^2} } \biggr) }}$

which seems to be of no help at all because the fraction does not get very small and the series for atan is also quite slow near -1 and 1. We can use another relation for this range.

${\displaystyle{ \arcsin x = \mathop{\mathrm{sgn}}(x)\arctan\Biggl(\sqrt{\frac{x^2}{1 - x^2 }} \Biggr) }}$

Seems not of much use but we can expand the root

${\displaystyle{ \arcsin x = \mathop{\mathrm{sgn}}(x)\arctan\biggl(\frac{x}{\sqrt{1 - x^2 }} \biggr) }}$

The closer x comes to the branchpoint the larger the fraction, but with

${\displaystyle{ \arctan x = \frac{\pi}{2} - \arctan \frac{1}{x} }}$

the actual value gets close to zero when x goes close to one and $\arctan 0 = 0$ so
$\arcsin 1 = \frac{\pi}{2}$ which is correct and as intended. The point where $\frac{x}{\sqrt{1 - x^2 }} = 1$ is at $x = \frac{1}{\sqrt{2}}$ and at this point $\arctan 1 = \arcsin \frac{1}{\sqrt{2}} = \frac{\pi}{4}$.

My cutoff points will be $\arcsin = 2\arctan \bigl(\frac{x}{1 + \sqrt{1 - x^2} } \bigr)$ for $|x| \le 0.8$ and $\arctan\bigl(\frac{x}{\sqrt{1 - x^2 }} \bigr)$ for $|x| > 0.8$.

No code yet, just twiddling with math, sorry 😉

For $x \in\mathbb{R} \land |x| > 1$ the real part of the result is always $\frac{\pi}{2}$ and the imaginary part $\mathop{\mathrm{sgn}}(z) \log\bigl(x + \sqrt{x^2-1}\bigr)$. This comes from one of the definitions

${\displaystyle{ \arcsin x = -i\log\biggl(ix + \sqrt{1 - x^2 }\biggr) }}$

I will use this definition for complex arguments.

# JavaScript: Make a Real typeof

The problems with JavaScript’s typeof operator are manifold. It is so restricted, that its only use is in testing for undefined. The main culprit cause these restrictions is the loose typing together with the automatic type coercion: "2" + 2 results in 22, "2" == 2 is true, t = 2;typeof t returns "number" and t = new Number(2);typeof t returns "object" to name just a few.
The worst case is probably:

// somewhere on top of the code
var a = 2;
// some thousand lines and/or several scripts later
var b = new Number(2);
if(a === b){
// CPR: Cardiopulmonary resuscitation
console.log("Go on with CPR!");
} else {

The Firefox browser has a little tool for JavaScript editing build-in called “scratchpad”. Based on the editor CodeMirror it is a bit better than writing a small HTML file with a textarea and a button to eval() the content but not very much.


text:
# 9.7: Time Evolution of the State Vector

The time evolution of the state vector is prescribed by the Schrödinger equation

$i\hbar {\partial \over \partial t} \vert\Psi(t)\rangle = H\vert\Psi(t)\rangle \nonumber$

where $$H$$ is the Hamiltonian operator. This equation can be solved, in principle, yielding

$\vert\Psi(t)\rangle = e^{-iHt/\hbar}\vert\Psi(0)\rangle \nonumber$

where $$\vert\Psi(0)\rangle$$ is the initial state vector. The operator

$U(t) = e^{-iHt\hbar} \nonumber$

is the time evolution operator or quantum propagator. Let us introduce the eigenvalues and eigenvectors of the Hamiltonian $$H$$ that satisfy

$H\vert E_i\rangle = E_i \vert E_i\rangle \nonumber$

The eigenvectors for an orthonormal basis on the Hilbert space and therefore, the state vector can be expanded in them according to

$\vert\Psi(t)\rangle = \sum_i c_i(t) \vert E_i\rangle \nonumber$

where, of course, $$c_i(t) = \langle E_i\vert\Psi(t)\rangle$$, which is the amplitude for obtaining the value $$E_i$$ at time $$t$$ if a measurement of $$H$$ is performed. Using this expansion, it is straightforward to show that the time evolution of the state vector can be written as an expansion:

\begin{align*} \vert\Psi(t)\rangle &= \displaystyle e^{-iHt\hbar}\vert\Psi(0)\rangle \\[4pt] &= e^{-iHt/\hbar}\sum_i\vert E_i\rangle \langle E_i\vert\Psi(0)\rangle \\[4pt] &=\sum_i e^{-iE_i t/\hbar}\vert E_i\rangle \langle E_i\vert\Psi(0)\rangle \end{align*}

Thus, we need to compute all the initial amplitudes for obtaining the different eigenvalues $$E_i$$ of $$H$$, apply to each the factor $$\exp(-iE_it/\hbar)\vert E_i\rangle$$ and then sum over all the eigenstates to obtain the state vector at time $$t$$.

If the Hamiltonian is obtained from a classical Hamiltonian $$H (x, p)$$, then, using the formula from the previous section for the action of an arbitrary operator $$A (X, P)$$ on the state vector in the coordinate basis, we can recast the Schrödiner equation as a partial differential equation. By multiplying both sides of the Schrödinger equation by $$\langle x |$$, we obtain

\begin{align*} \langle x\vert H(X,P)\vert\Psi(t)\rangle &= i\hbar {\partial \over \partial t}\langle x\vert\Psi(t)\rangle \\[4pt] H\left(x,{\hbar \over i}{\partial \over \partial x}\right)\Psi(x,t) &= i\hbar {\partial \over \partial t}\Psi(x,t) \end{align*}

If the classical Hamiltonian takes the form

$H(x,p) = {p^2 \over 2m} + U(x) \nonumber$

then the Schrödinger equation becomes

$\left[-{\hbar^2 \over 2m}{\partial^2 \over \partial x^2} + U(x)\right]\Psi(x,t)= i\hbar {\partial \over \partial t}\Psi(x,t) \nonumber$

which is known as the Schrödinger wave equation or the time-dependent Schrödinger equation. In a similar manner, the eigenvalue equation for $$H$$ can be expressed as a differential equation by projecting it into the $$X$$ basis:

\begin{align*} \langle x\vert H\vert E_i\rangle \nonumber &= E_i \langle x\vert E_i\rangle \\[4pt] H\left(x,{\hbar \over i}{\partial \over \partial x}\right)\psi_i(x) &= E_i \psi_i(x) \\[4pt] \left[-{\hbar^2 \over 2m}{\partial^2 \over \partial x^2} + U(x)\right]\psi_i(x) &= E_i \psi_i(x) \end{align*}

where $$\psi_i(x) = \langle x\vert E_i\rangle$$ is an eigenfunction of the Hamiltonian.

This page titled 9.7: Time Evolution of the State Vector is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Mark Tuckerman.


text:
# What determines the orbital period of a satellite?

Feb 3, 2018

For artificial satellites, it depends upon height of the orbit.

#### Explanation:

For the earth,

• Artificial satellite:-

1.The time to complete one revolution around the planet depends upon the height of the orbit.

2.When height of orbit is 1000 km it takes 1.8 hours,when the height of orbit is 20,000 km the time taken is 12 hours.

Feb 3, 2018

The orbital period of a satellite depends on the mass of the planet being orbited and the distance of the satellite from the centre of the planet.

#### Explanation:

The orbital period of a satellite $T$ can be obtained from Newton's form of Kepler's third law.

${T}^{2} = \frac{4 \pi}{G M} {a}^{3}$

Where $a$ is the semi minor axis, which is the distance of the satellite's orbit from the centre of the planet it is orbiting. $G$ is the gravitational constant and $M$ is the mass of the planet. The product $G M$ is called the gravitational parameter.

In the case of the Earth, the gravitational parameter $G M = 3.986 \cdot {10}^{14} {m}^{3} {s}^{-} 2$.


text:
# How to determine the charge on electron?

The charge on the electron was determined by Millikan by his Oil Drop Experiment.

### Explanation

The charge of the electron is equivalent to the magnitude of the elementary charge (e) but bearing a negative sign. Since the value of the elementary charge is roughly 1.602 x 10-19 coulombs (C), then the charge of the electron is -1.602 x 10-19 C.

• The experiment with Millikan is important since it defined the charge on an electron.
• Millikan used a very basic, very simple system in which the behaviour of gravitational, electrical, and (air) drag forces was controlled.


text:
We’re rewarding the question askers & reputations are being recalculated! Read more.

# Tag Info

26

There is still a search for problems where the D-Wave shows improvement over classical algorithms. One might recall media splashes where the D-Wave solved some instances $10^8$ times faster than a classical algorithms but forgot to mention that the problem can be solved in polynomial time using minimum weight perfect matching. Denchev showing $10^8$ ...

18

A Quantum Annealer, such as a D-Wave machine is a physical representation of the Ising model and as such has a 'problem' Hamiltonian of the form $$H_P = \sum_{J=1}^nh_j\sigma_j^z + \sum_{i, j}J_{ij}\sigma_i^z\sigma_j^z.$$ Essentially, the problem to be solved is mapped to the above Hamiltonian. The system starts with the Hamiltonian $H_I = \sum_{J=1}^nh'_j\... 16 Annealing's more of an analog tactic. The gist is that you have some weird function that you want to optimize. So, you bounce around it. At first, the "temperature" is very high, such that the selected point can bounce around a lot. Then as the algorithm "cools", the temperature goes down, and the bouncing becomes less aggressive. Ultimately, it settles ... 15 First, let me note that quantum annealing, or more precisely the adiabatic quantum computation model is polynomially equivalent to the conventional gate-based quantum computation model. Second, the general traveling salesman problem is NP complete. Third, it is generally believed that the with gate-based quantum computation one cannot solve in polinomial ... 14 The time to solution (tts) is highly dependent on the Hamiltonian of the problem one would like to solve. The D-Wave uses a spin-glass-like Hamiltonian which can be in the NP-Complete complexity class. Due to having to run the annealing process multiple times, tts measures are typically quantified by how long it takes to find the ground state some percent ... 13 In adiabatic QC, you encode your problem in a Hamiltonian such that your result can be extracted from the ground state. Preparing that ground state is hard to do directly, so you instead prepare the ground state of an 'easy' Hamiltonian, and then slowly interpolate between the two. If you go slow enough, the state of your system will stay in the ground state.... 12 As Troyer and Lidar saw no speed increase with the D-Wave 1 compared to classical computers, the D-Wave 2 benchmark figure reported in 2013 of 3600 times as fast as CPLEX (the best algorithm on a conventional machine) suggests the D-Wave 2 is 3600 times as fast as the D-Wave 1. However: the results are in a pretty restricted set of parameters, so this may ... 7 I'll do my best to address your three points. My previous answer to an earlier question about the difference between quantum annealing and adiabatic quantum computation can be found here. I'm in agreement with Lidar that quantum annealing can't be defined without considerations of algorithms and hardware. That being said, the canonical framework for ... 7 As far as I know the closest answer to your question for applications is given in the recent (still unpublished) work presented at the March meeting by Bibek Pokharel, where he compares graph 3-coloring instances on D-Wave Two, D-Wave 2X and D-Wave 2000Q, all other things staying reasonably equal. The short answer is that all the performance increase is ... 6 Yes. This has been done by Morita and Nishimori in their 2008 publication, "Mathematical Foundations of Quantum Annealing." https://arxiv.org/abs/0806.1859 In Section 5 they derive the convergence conditions from path integral Monte Carlo and Green function Monte Carlo methods. To quote; In Sec. 5 we have derived the convergence condition of QA ... 6 Is there proof that the D-wave (one) is a quantum computer and is effective? D-Wave Video - Offers an explanation of: "How do we know ...": https://youtu.be/kq9VqR0ZGNc One analogy you might make with the D-Wave One, an adiabatic ('analog') computer, is to the "south-pointing chariot" or the "Antikythera mechanism". A lengthy explanation is offered in ... 5 Vinci and Lidar have a nice explanation in their introduction of non-stoquastic Hamiltonians in quantum annealing (which is necessary to a quantum annealing device to simulate gate model computation). https://arxiv.org/abs/1701.07494 It is well known that the solution of computational problems can be encoded into the ground state of a time-dependent ... 5 The earliest non-internal reference I can find is in NIPS 2009 from a Google/D-Wave effort1. You'll notice that the two Choi papers, in addition to not using the term "Chimera", do not describe a Chimera graph (and note that the name comes from D-Wave, not from graph theory). For a good early reference on Chimera, I recommend Bunyk et al., 20141 , which ... 4 If two matrices (in this case, Hamiltonians) commute, they have the same eigenvectors. So, if you prepare a ground state of the first Hamiltonian, then that will (roughly speaking) remain an eigenstate throughout the whole adiabatic evolution, and so you get out just what you put in. There's no value to it. If you want to be a little more strict, then it ... 4 Until recently, D-Wave's quantum annealing devices always started from a uniform superposition over all$N$qubits: &... 3 One of the advantages, as stated in the paper you linked, is that with QAOA you can increase the precision arbitrarily, whereas QA will only find the solution with probability 1 as$T \to \infty$which is impractical. In addition if$T$is too long you're likely to not find the solution as the probability is not monotonic. I believe an example of this can be ... 3 Quantum annealing as defined by Chakrabarti 1981 and later implemented by Kadowaki and Nishimori 1998 uses a varying transverse magnetic field to facilitate tunneling through the energy landscape of an optimization problem. The system is prepared in the ground state of a Hamiltonian and then the transverse field is applied and slowly reduced (adiabatically) ... 3 In the context of Ising optimizers having an initial Hamiltonian that commutes with the problem Hamiltonian means it is essentially products of$\sigma^Z$operators, which means that its eigenstates are classical bitstrings. Hence the groundstate at the beginning ($t$=0) will be classical as well, not a superposition of all possible bitstrings. Moreover, ... 3 There are multiple factors that affect an embedding's performance, including what Davide mentions. Depending on your background, the following interpretation of Davide's answer might be easier for you to understand: Early in the anneal, the Ising (classical/user-input/final) Hamiltonian has no effect, which means that two spins in a chain are not compelled ... 3 On parameter setting, check our work: https://journals.aps.org/prx/abstract/10.1103/PhysRevX.5.031040 (Basically you want to make sure that the chains representing the logical qubit have a phase transition synchronized with the minimum gap). But in general this is a hard problem, and precision issues connected to the embedding characteristics are probably ... 2 I will assume you are asking about D-Wave's quantum annealer. If there is a part of the learning process that can fit the QUBO (Quadratic Unconstrained Binary Optimization) formulation, then yes. The problem however is what to consider as binary variables of your problem. In CNN, we have in general real-valued parameters that we tweak for training (using ... 2 A couple papers are out there on algorithms which can be constructed using reverse annealing, http://iopscience.iop.org/article/10.1088/1367-2630/aa59c4/meta and https://arxiv.org/abs/1609.05875 (it is worth pointing out previous somewhat related closed system work: https://link.springer.com/article/10.1007/s11128-010-0168-z). As far as experimental results, ... 2 Well first you will have to specify the MST in a QUBO/Ising formulation. In this article showing formulations for different types of problems, section 8.1 is about the MST with a maximal degree constraint. This paper contains results of Spanning Tree calculations. When you have the formulation, you map it on the Chimera Graph if the hardware size is not ... 1 The errors from quantum annealing apart from having crappy qubits will come from the imperfect instantiation of the qubit coupling. The first problem i.e having bad qubits can ultimately be mitigated by a kind of error correction look at Error-corrected quantum annealing with hundreds of qubits (Pudenz et al., 2014). But as it turns out the second problem ... 1 You can use a technique of reduction by substitution. Here we represent using ancilla representing a Boolean constraint$ z\Leftrightarrow x_1\wedge x_2 $as a quadratic penalty function : $$P(x_1,x_2;z) = x_1 x_2 - 2(x_1+x_2)z + 3z$$ For a triplet interaction, you use it to reduce to pairwise :$$x_1 x_2 x_3 = \min_z \bigl\{ z x_3 + M P(x_1,x_2;z) \bigr\},... 1 You need to introduce ancillary variables and minimize over them; which would enable you to have a QUBO form with only pairing terms. For example, if your binary variables are called$ x,y,z $and you have a$ a*xyz $term with the coefficient$ a$, you can use a technique of reduction by minimum selection where you introduce another variable$w\$ such that ...

1

This answer reflects my understanding of what D-wave have to say about this, in the 2013 whitepaper they link to: Programming With D-Wave: Map Coloring Problem To back up the question, we find once again the claim: "superposition" states [...] give a quantum computer the ability to quickly solve certain classes of complex problems such as optimization, ...

Only top voted, non community-wiki answers of a minimum length are eligible


text:
Lemma 12.14.5. Notation and assumptions as in Lemma 12.14.4 above. The morphism of complexes $\delta (s) : C_\bullet \to A[-1]_\bullet$ induces the maps

$H_ i(\delta (s)) : H_ i(C_\bullet ) \longrightarrow H_ i(A[-1]_\bullet ) = H_{i - 1}(A_\bullet )$

which occur in the long exact homology sequence associated to the short exact sequence of chain complexes by Lemma 12.13.6.

Proof. Omitted. $\square$

There are also:

• 2 comment(s) on Section 12.14: Homotopy and the shift functor

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:
few problems, approaches and solutions

## subtleties of programming

While coding for the problem-2.3-7 , some how I was not in my default mode of not thinking while coding. To test my programs I was writing a random array generator. One part of it was to swap two array entries. Now, the most straight forward way to swap two array elements is

```int tmp = arr[i];
arr[i]  = arr[r];
arr[r]  = tmp;
```

But, knowing the xor method, I thought why not save a variable. Basically, if $a$ and $b$ are to be swapped, then the code suffices.

```a ^= b;
b ^= a;
a ^= b;
```

So now the question is, would this work on an array. Ex.

```arr[i] ^= arr[r];
arr[r] ^= arr[i];
arr[i] ^= arr[r];
```

Here’s a subtle bug. If $i$ and $r$ are same, then it wont. The reason being that we loose the original value. If both indexes are same, the same array entry would be xor’ed with itself. Wiki page explains it better, and why it should be avoided in desktop systems. Again, I learn the evils of premature optimization. Subtleties of programming!


text:
# Reaction between magnesium metal and sodium hydroxide: Does this even happen?

Came across this question in a book:

Among aluminum, zinc, tin and magnesium, which metals (if any) will react with an aqueous solution of sodium hydroxide to displace dihydrogen?

The answer to the question is : Aluminum, zinc and tin.

Their reasoning?

Under normal conditions, magnesium metal does not react with an aqueous solution of sodium hydroxide.

Given that the book does not go on to explain the rationale behind this one-liner, naturally my question would be: "Why not?"

QUESTION:

Why doesn't magnesium react with an aqueous solution of sodium hydroxide and release dihydrogen?

[@paracetamol thinks]

Initially, I was under the impression that they were talking about the oxide layer that forms over magnesium metal (the very reason we buff the surface of magnesium ribbons with sandpaper before igniting it), which would give the reaction a slow start. Then, the statement could've been: "Magnesium metal does not immediately react with aqueous sodium hydroxide (owing to the presence of an oxide layer)".

But earlier on in the chapter, there is explicit mention of the reaction between aluminum metal ( which also naturally come with an oxide coat) and aqueous sodium hydroxide, to form sodium aluminate and dihydrogen. There was no mention of an oxide layer hampering the reaction.

[@paracetamol thinks harder]

I then (cursorily) looked at the Electrochemistry aspect of the reaction; because whenever we're asked if a metal reacts with a mineral acid (to liberate dihydrogen), we're expected to flip open our table of standard electrode reduction potentials and say:

Metals having a higher electrode reduction potential than that for the reaction $$\ce{2H^{+} -> H_{2}}$$ (which is arbitrarily taken as zero volts) will be able to liberate dihydrogen from the solution. However, metals such as copper, silver, mercury, etc which have a lower standard electrode reduction potential than that for $H^+$ will not liberate dihydrogen.

When I compared the standard electrode reduction potentials of aluminum, zinc, tin and magnesium, I've observed that all of them have electrode reduction potentials that are higher than the electrode reduction potential for $H^+$. Meaning, that all those metals (magnesium included) should be able to displace dihydrogen from the solution, at least, from the high-school electrochemistry perspective. (Yes, I know the textbook mentions an alkali in the question, but what I'm trying to point out is, that since the four metals have higher electrode reduction potentials that $H^+$, then they ought to behave the same way. So if aluminum, zinc and tin can liberate dihydrogen (as the textbook claims) then why not magnesium too?)

I Googled my question, and arrived at this Quora post. Same question as mine, but it's generated such lackluster answers, that they would only be worthy of...well...Quora. O:)

[@paracetamol bamboozled]

I can't for the world figure out why magnesium doesn't react with aqueous sodium hydroxide (if it doesn't). Anyone?

• NaOH lowers the concentration of H+ in solution, so there is less H+ to begin with and considering that magnesium slowly reacts with water, I'm not astonished that it doesn't react with basic water. – AS_1000 Aug 27 '17 at 13:34
• Magnesium does react with hot water (not so much with cold water). I see no reason for it to not react with hot sodium hydroxide (though it might happen slower). Also, magnesium is a very active metal and in mixture of fine powders reacts (actually, burns) with things like sand, many metal oxides, and for example, hydrate of barium chloride. Pretty sure it should burn with powder of solid sodium hydroxide. – permeakra Aug 27 '17 at 21:46
• You need to use the Nernst equation to adjust the potentials accordingly to the much higher pH value. The potential of hydrogen gas and protons equalling zero is only true at pH zero. – Jan Oct 18 '17 at 12:48
• The reason why aluminium is so reactive to NaOH is because it destroys the oxide layer (the oxide is acidic). The oxide on the Mg might well not have this character. Worth a look. – matt_black Dec 17 '17 at 15:29


text:
Top Recent Blog Posts
By Supermagzzz, history, 3 days ago, translation,

1538A - Stone Game

Author: MikeMirzayanov

Tutorial
Solution

1538B - Friends and Candies

Author: MikeMirzayanov

Tutorial
Solution

1538C - Number of Pairs

Author: MikeMirzayanov

Tutorial
Solution

1538D - Another Problem About Dividing Numbers

Author: MikeMirzayanov

Tutorial
Solution

1538E - Funny Substrings

Author: MikeMirzayanov

Tutorial
Solution

1538F - Interesting Function

Author: Supermagzzz, Stepavly

Tutorial
Solution

1538G - Gift Set

Author: MikeMirzayanov

Tutorial
Solution

• +54

By maroonrk, history, 2 days ago,

We will hold Tokio Marine & Nichido Fire Insurance Programming Contest 2021（AtCoder Regular Contest 122).

The point values will be 400-500-600-700-800-1200.

We are looking forward to your participation!

• +95

By kashyapriya754, 2 days ago,

****I request the cheaters to please somehow let me know the rating of their real father whose code they copy , so that i can make a target to surpass him and won’t have to be bothered by such dumbfucks again?

• +140

By gavy_pole, history, 2 days ago,

For the Codeforces Round #725 (Div. 3), check these two submissions: 119070732 and 119073742. These two codes are 99% similar. My question is how come these same submissions (template aside) didn't get skipped? MikeMirzayanov, please look into this.
Anyway, these guys are new type of cheaters. They cheat by exchanging codes and this is not the first time. For further proof, check these two as well: 119047376 and 119057342 (the function is same and only variables are changed). They have plagiarized in Codechef contests as well (obviously) but that's another story for another time.
So would you like to explain your actions, lordgavy01 and south_pole? What do you gain from this?

Update: I just came to know that these two guys, instead of accepting their mistake, are telling their friends to downvote this blog as much as possible. I don't understand this behaviour. Just accept your mistake and move on.

• +34

By chokudai, history, 17 hours ago,

We will hold AtCoder Beginner Contest 205.

The point values will be 100-200-300-400-500-600.

We are looking forward to your participation!

• +63

By Dormi, history, 88 minutes ago,

1534A - Colour the Flag

Author: crackersamdjam

Hint 1
Hint 2
Hint 3
Tutorial
Solution

1534B - Histogram Ugliness

Author: Dormi

Hint 1
Hint 2
Hint 3
Tutorial
Solution

1534C - Little Alawn's Puzzle

Author: Ninjaclasher

Hint 1
Hint 2
Hint 3
Hint 4
Tutorial
Solution

1534D - Lost Tree

Author: Plasmatic

Hint 1
Hint 2
Hint 3
Hint 4
Tutorial
Solution

1534E - Lost Array

Author: Plasmatic

Hint 1
Hint 2
Hint 3
Hint 4
Tutorial
Solution

1534F1 - Falling Sand (Easy Version)

Author: Dormi

Hint 1
Hint 2
Hint 3
Hint 4
Tutorial
Solution

1534F2 - Falling Sand (Hard Version)

Author: Dormi

Hint 1
Hint 2
Hint 3
Hint 4
Hint 5
Tutorial
Solution

1534G - A New Beginning

Author: Aaeria

Tutorial
Solution

1534H - Lost Nodes

Author: Ninjaclasher

Tutorial
Solution

• +82

By maroonrk, history, 11 hours ago,

After the last ARC, one participant pointed out that the result is WA when the error is precisely the same as $EPS$ (submission).

For example, consider these two outputs: 331997010.50000000000000000000 (the jury output) and 331997342.4970105 (the user output). Their relative error is exactly $10^{-6}$, so when $EPS=10^{-6}$, this should get AC.

However, with the current implementation of the doubleCompare function in testlib.h, the result is WA. This is because perturbations in the line 429 (return result + 1E-15 >= minv && result <= maxv + 1E-15;) don't work when the values of result/minv/maxv are large. We made a fix and sent a pull request.

If you believe you were affected by this in the last ARC, please let me know.

That being said, given the popularity of testlib.h and the fact that no one has ever raised this issue, I hope no one was affected by this in the entire history of testlib.h.

• +189

By MohamedAboOkail, history, 7 hours ago,

Hello everyone!

This (What is Codeforces?) is the first blog post on Codeforces, 11 years ago by MikeMirzayanov

I wanted to thank MikeMirzayanov for this great website, which has become an integral part of our daily lives!

Also, thank you to all the Codeforces community!

I have a lot of Beautiful memories with Codeforces in the past two years.

• +30

By rahul_107, 13 hours ago,
### Question:
There is a grid with a balloon at some cells. Players can shoot arrows from outside the grid horizontally and vertically. Every arrow shot will burst all balloons in that row if fired horizontally and in that column if fired vertically.
Given the positions of the balloons in the grid find the minimum no of arrows required to burst all the balloons.

### Constraints:
1 <= N(No of ballons) <= 50
0 <= x, y -> Positions of the balloons < 10^9-1

### Input Format:
Line1: Integer denoting N.
Next N lines, where each of the ith lines contains two integers representing (row, col) of ith balloon.

### Sample Input :
6
15 21
33 8
17 21
17 8
28 11
28 19

### Sample Output:
3

### Sample Input :
6
15 1
15 2
15 3
15 4
18 1
20 1

### Sample Output:
2

• +12

By gabrielwu, history, 26 hours ago,

Thank you to everyone who participated in the mBIT Spring 2021 competition today! All of the information on this blog post is also available in our archive, which includes the full leaderboard.

Problems and Editorials

Test your solutions on our Codeforces Gyms: Standard, Advanced

Results

First, we would like to congratulate the team Texas (Adam Bertelli, Dilhan Salgado, Zack Lee) for being the first team to find all of the Among Us references hidden in the problems! Without further ado, we are pleased to announce the division winners:

Winning Teams:

1. KoreshaMaksim Gorokhovskii, Ramazan Rakhmatullin

2. jharada fan clubHuaiyu Wu, Antonio Molina, Yuting Zhou, Maryam Bahrani

3. ඞYTN3M (HS team) — Elliot En-Yi Liu (National Experimental High School at Hsinchu Science Park), Ashley Aragorn Khoo (NUS High School), Udit Sanghi (Bhavan Vidyalaya), Panchkula Kostiantyn Savchuk (Lyceum No. 2 of Korostyshiv)

4. ScrubsRaymond Kang, Li Yao'an, Koh Li Chen

5. we can fill this out later but I have to put something to save (HS team) — Moses Xu (Appleby College), Eric Pei (Don Mills CI), Chris Trevisan (William Lyon Mackenzie CI), Victor Gao (Victoria Park CI)

6. Coast (HS team) — Anand John (Brandywine High School), Nathan Chen (Garnet Valley High School), Richard Qi (Princeton High School), Siyong Huang (Homestead High School)

Standard Division

Winning HS Team: Remdi™Nishchay Bhutoria (Nehru Smarka Vidyalaya), Vishesh Saraswat (DPS RK Puram), Aryan Raina (Sri Guru Harkrishan Model School), Ritul Kumar Singh (DPS Bokaro Steel City)

First Place MS Team: The Purple DuckDaniel Wu (Tilden MS), Paul Trusov (Tilden MS), David Sy (Tilden MS)


text:
# Five moles of an ideal gas at 1 bar and 298 k is expanded into vacuum to double the volume.

Question:

Five moles of an ideal gas at 1 bar and $298 \mathrm{~K}$ is expanded into vacuum to double the volume. The work done is :

1. $\mathrm{C}_{\mathrm{V}}\left(\mathrm{T}_{2}-\mathrm{T}_{1}\right)$

2. $-\mathrm{RT}\left(\mathrm{V}_{2}-\mathrm{V}_{1}\right)$

3. $-R T \ln V_{1} / V_{1}$

4. zero

Correct Option: , 4

Solution:

In expansion against vacuum

$P_{\text {ext }}=0$

$W=-P_{\text {ext }} \Delta V=0$

w = 0


text:
# Function $s(x)=1+\sum_{k=1}^{\infty} \frac{x^k}{k^k}$ - is there any other way to define it?

This series converges for all $x \in (-\infty, \infty)$, thus the function is analytic on the real line and defined by its Taylor series.

However, unlike the exponential function, this one is very elusive - I can't find any other representation for it - no integral, no differential equation, nothing.

Its derivatives exist (an infinite number of them), but it seems they can't be connected to the function itself in any other way.

I know that $s(1)-1$ is called 'Sophomore's Dream', because it has integral representation:

$$\sum_{k=1}^{\infty} \frac{1}{k^k}=\int_0^1 \frac{1}{t^t}dt$$

I don't know if the same method can be used to find a general integral representation for $s(x)$, but I have some hope.

The most interesting (in my opinion) property of this function - $s(x)$ and its derivatives all have exactly one zero (for $x_0<0$) and one minimum ($x_m<0$ and $s(x_m)<0$). They are connected in a sense, since obviously if $s(x)$ has a minimum, then $s'(x)$ has a zero.

Here is a plot of $s(x)$ for $x<0$:

I added $1$ to the sum in the definition of $s(x)$ for consistency - it can be seen from the form of its derivatives:

$$s(x)=1+x+\frac{x^2}{2^2}+\frac{x^3}{3^3}+\dots=1+\sum_{k=1}^{\infty} \frac{x^k}{k^k}$$

$$s'(x)=1+\frac{x}{2}+\frac{x^2}{9}+\frac{x^3}{64}+\dots=\sum_{k=1}^{\infty} \frac{k~x^{k-1}}{k^k}$$

$$s''(x)=\frac{1}{2}+\frac{2x}{9}+\frac{3x^2}{64}+\frac{4x^3}{625}+\dots=\sum_{k=1}^{\infty} \frac{k(k-1)~x^{k-2}}{k^k}$$

$$s'''(x)=\frac{2}{9}+\frac{3x}{32}+\frac{12x^2}{625}+\frac{5x^3}{1944}+\dots=\sum_{k=1}^{\infty} \frac{k(k-1)(k-2)~x^{k-3}}{k^k}$$

It is apparent, that $\lim_{n \to \infty} s^{(n)}(0) = 0$, however, the zero on the negative line actually moves to the left with each differentiation (see the position of the minimum). So I'm not sure, how the 'infinite derivative' of $s(x)$ would look.

I'd like to know if someone studied this function, and get a reference for it. But the main question is - what other definitions are possible for $s(x)$, except for the series?

Thanks to this great answer, I'm able to write the integral definition:

$$s(x)=1+\int_0^1 x ~u^{-u~x} du$$

So I consider my question answered.

By the way, if we define the function:

$$p(x)=\frac{s(x)-1}{x}=\int_0^1 u^{-u~x} du=\sum_{k=1}^{\infty} \frac{x^{k-1}}{k^k}$$

We get a very monotone (exponential-like) behavior, without any zeroes or minima. The function and several of its derivatives are plotted below.

• I think this post and this post are somehow relevant to your function $s(x)$. – Sangchul Lee Mar 22 '16 at 21:19
• Your answer to the first question also answers my question about integral definition. Maybe you can post the part about integral here, so I could accept it? – Yuriy S Mar 22 '16 at 21:36


text:
FREELessons: 28Length: 4 hours

• Overview
• Transcript

# 4.9 Creating the User Store

If we want to follow other users, we'll need a way to display a list of users. But before we can create a list, we'll need to get that user information from somewhere. In this lesson, we'll create the UserStore.


text:
Instructional Activity

# Interpreting $\frac{a}{b}$

Lesson 5. Unit 6. Grade 6 Open Up Resources

Open Up Resources15 min(s)

This Instructional Activity is a part of the Lesson 5, Unit 6, Grade 6. Apply understanding of a fraction as a division to solve equations of the given form. Students solve more equations of the form px=q while interpreting the division as a fraction.


text:
After searching the internet for a decent walk through or tutorial, I came up with very little and so I decided to collate what have learned in this post with the hope that someone else can benefit from it.

Firstly you will need to obtain the datasources plugin from github and stick it in your application’s plugin folder (app/plugins) – make sure you get the master branch and not the 2.0 as it needs to be compatible with your version of CakePHP (1.3 ideally)

The next thing you need to do is edit the databases config file (app/config/database.php):

var \$default= array(
        'driver' => 'Datasources.DboFirebird', //references the datasources plugin
        'persistent' => false,
        'host' => 'localhost', //the host name of your database
        'login' => 'sysdba',
        'password' => 'masterkey',
        'database' => 'C:\\path\\to\\database.gdb', //path to the database - note the double backslashes
        'prefix' => '',
        //'encoding' => 'utf8',
    );

The two important things you should note of is the driver key-value pair which references the datasource plugin namespace, and secondly the double backslashes for the database file path.

All the models you create for your application should now access the corresponding tables through the FireBird SQL connection.

Be Sociable, Share!


text:
directed graph where some vertices are blue, find nearest blue vertex.

Let $G = (V; E)$ be a directed graph where some subset of the vertices are coloured blue and each edge has a non-negative length. Provide an $\operatorname{O}(|E| \log n)$ time algorithm for finding the length of the shortest path from each vertex in the graph to its nearest blue vertex.

My biggest problem is being able to do this in the specified time. I could go down all edges of the starting vertex, then down the edges of each of those vertices, until I find a blue vertex. And then when I find it, save the path. But that won't work because it won't be fast enough, so any help would be appreciated, thanks!

EDIT: Shortly after posting this, I realized I can use Dijkstra's Algorithm.

• Yes, adopt Dijkstra. The only trick is, it runs in $O(m + n \log n)$ only if you use Fibonacci Heaps... – gt6989b Sep 21 '15 at 20:04
• You should expand your edit and post it as an answer to your own question. That way this post doesn't go on the unanswered questions queue. – Mike Pierce Sep 21 '15 at 21:50


text:
Home how to post image data through javascript

# how to post image data through javascript

user2392
1#
user2392 Published in April 24, 2018, 8:36 am
 I have a html form which sends POST data to my PHP script It also uses AJAX to provide a preview as they complete the form However the form uses onsubmit="" The issue i have is one of the html inputs is an image. the form is as below to give you an idea:

 I am using var logo =document.getElementById("logo").value; for the image but when i am sending the logo value through to PHP it breaks the image as it isn't the correct post value required to be sent through to the PHP script as though you are submitting the form. Does anyone know how to get the same post value for the logo html field simply by using onchange and javascript?
 You need to login account before you can post.
Processed in 0.364886 second(s) , Gzip On .