Wikipedia:Reference desk/Archives/Computing/2015 September 12

= September 12 =

How to repeat a word 'x' times...?
Hi, I need to repeat a specific word 'x' times to use in Typography. I've searched online for such word generators, but couldn't find any. Can anyone suggest some..?-- Jos   eph   09:32, 12 September 2015 (UTC)


 * You can do this in many scripting languages and mathematical software, for example, in AlgoSim (www.algosim.se), see example.


 * Perhaps the simplest way is to use your web browser. Create a file named strdup.html with the following contents:

&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="utf-8" /&gt; &lt;title&gt;String duplication&lt;/title&gt; &lt;/head&gt;

&lt;body&gt;

&lt;div id="divResult"&gt;&lt;/div&gt;

&lt;script&gt; var str = prompt("Enter string to duplicate:"); var num = prompt("Enter number of iterations:"); var result = ""; for (i=0; i&lt;num; i++) { result = result + str; } document.getElementById("divResult").innerHTML = result; &lt;/script&gt;

&lt;/body&gt; &lt;/html&gt;


 * Now, open this file in your favourite web browser.


 * --Andreas Rejbrand (talk) 10:45, 12 September 2015 (UTC)


 * Thanks a lot Andreas. It worked.-- Jos   eph   11:00, 12 September 2015 (UTC)

✅


 * Does it have to be a repetition of the same word? Normally, if you just need a dummy text to fill a layout, you would be using some lorem ipsum type of text. There are lots of generators online for this type of text.--YX-1000A (talk) 23:43, 12 September 2015 (UTC)

Photo stitching program
I'm looking for a free automatic panoramic photos stitching tool which stitches several photos into one. My OS is Windows XP 32-bit. What I have here are several overlapping photos I took of a lake from out of a train as it was passing by the lake. --80.187.98.23 (talk) 11:04, 12 September 2015 (UTC)
 * Hugin is very good, but it doesn't like sets with large overlap. You will need to use the older 2013.0 release, as newer ones use an API that XP doesn't support. LongHairedFop (talk) 12:14, 12 September 2015 (UTC)


 * I use - Panorama photo stitcher quite a lot. It is not very intuitive but Hugin has a lot of other very usful tools. So, I think it is work persevering with the initial step learning curve.--Aspro (talk) 12:15, 12 September 2015 (UTC)


 * Another thought is, as you're using Windows, it is worth upgrading it to work like a modern computer by installing a Virtual machine on it, so  that you can take advantage of faster running Linux based free applications like Fotoxx. Photo stiching is dead easy on this. It dead easy to instal to. It has a lot of other free tools as well.--Aspro (talk) 12:49, 12 September 2015 (UTC)

Increasing the Probability of Some Measurement - Quantum Computation
Assuming I have some qubit ,$$|x \rangle $$, that I want to know whether it is a superposition of the vectors $$ |0 \rangle $$ and $$ |1\rangle $$, or just $$ |x \rangle=|1\rangle$$. What can I do to increase the probability to measure $$ |x\rangle=|0\rangle $$ if indeed $$|x \rangle$$ is a supeposition of $$|0\rangle$$ and $$|1\rangle$$, and to measure $$|x\rangle=|1\rangle$$ else? 176.106.227.214 (talk) 17:30, 12 September 2015 (UTC)


 * If you think the qubit is in the state $$\alpha|0\rangle + \beta|1\rangle = \begin{pmatrix} \alpha \\ \beta \end{pmatrix}$$, you can apply the gate $$\begin{pmatrix} \bar\alpha & \bar\beta \\ -\beta & \alpha \end{pmatrix}$$, which will take that to $$|0\rangle$$. Then measuring in the computational basis will return 0 with probability 1 if it was indeed in that state. -- BenRG (talk) 08:00, 13 September 2015 (UTC)


 * How can I get this gate from the "standard" set of universal gates (CNOT, Hadamrd, and $$ R(\pi / 4) $$)? (by the way, I need to do this efficient. That is, using as less "standard" quantum gates as possible). 185.32.179.23 (talk) 10:47, 13 September 2015 (UTC)

More formally, I look for a quantum circuit that uses the gates CNOT, Hadamrd, and $$ R(\pi / 4) $$ only, and uses these gates as less as possible and satisfies that on input $$ |x\rangle = \begin{pmatrix} \alpha \\ \beta \end{pmatrix}$$, if $$ \alpha \ne 0 $$, then the output is $$ |0\rangle $$ in probability $$ >0.5$$. Else, the output is $$ |1\rangle $$ in probability $$ 1$$. 185.32.179.145 (talk) 12:53, 13 September 2015 (UTC)


 * If you expect to need to find efficient quantum circuits with these 3 gates often, it might be worth investing some time to write a computer program to enumerate all possible circuits with 1,2,3... gates, test each one for the property you want, and return the first one that passes the test. About your current question, I worry about the requirement "and to measure $$|x\rangle=|1\rangle$$ else", which BenRG didn't address. I think it makes increasing the probability to measure $$ |x\rangle=|0\rangle $$ impossible. Egnau (talk) 15:09, 13 September 2015 (UTC)


 * As Egnau suggested, that can't be done. A single-qubit state can be represented by a point on the Bloch sphere, with $$|0\rangle$$ as the north pole and $$|1\rangle$$ as the south pole. The states with $$ \alpha \ne 0 $$ are the entire sphere except the south pole. The states that will measure as $$|0\rangle$$ with probability >0.5 are the states north of the equator. Single-qubit gates are rigid rotations of the sphere. There's no rigid rotation that will move all points except the south pole north of the equator.
 * Also, $$ R(\pi / 4) $$ is a π/4 rotation around the polar axis, and the Hadamard gate is a 180° rotation around an axis inclined at 45° to the polar axis. It is probably possible to approximate any rotation of the sphere to arbitrary precision with combinations of those two operations, but the approximation will be long and ugly in most cases. It makes more sense to design for a quantum computer with a less awkward set of fundamental gates (such as R(φ) for arbitrary φ). -- BenRG (talk) 17:27, 13 September 2015 (UTC)


 * What happens if we add another input qubit $$ |y\rangle = |0\rangle$$. So now, we're looking for a rotation of $$ (|x\rangle,|y\rangle) $$ in Bloch Sphere such that after the rotation $$ |x\rangle $$ value will be as described above, and we don't care what will be the value of $$ |y\rangle $$. Is it possible? What transformation can do it? Thank you! 176.106.227.44 (talk) 07:30, 16 September 2015 (UTC)
 * ?? 80.246.136.67 (talk) 09:01, 17 September 2015 (UTC)

Software documentation of libraries, DLLs and such as a source of bugs
Is software documentation of libraries, or the lack thereof, a common source of bugs on the software built using those libraries?

Is software documentation necessarily defective, since it's written in natural languages, which are less well-defined than formal languages? However, can this defectiveness cause defective software? --YX-1000A (talk) 23:20, 12 September 2015 (UTC)