Jump to content

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

From Wikipedia, the free encyclopedia
Computing desk
< September 11 << Aug | September | Oct >> September 13 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


September 12

[edit]

How to repeat a word 'x' times...?

[edit]

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..?--Joseph 09:32, 12 September 2015 (UTC)[reply]

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:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>String duplication</title>
</head>

<body>

<div id="divResult"></div>

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

</body>
</html>

Now, open this file in your favourite web browser.
--Andreas Rejbrand (talk) 10:45, 12 September 2015 (UTC)[reply]
Thanks a lot Andreas. It worked.--Joseph 11:00, 12 September 2015 (UTC)[reply]

 Done

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)[reply]

Photo stitching program

[edit]

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)[reply]

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)[reply]
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)[reply]
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)[reply]

Increasing the Probability of Some Measurement - Quantum Computation

[edit]

Assuming I have some qubit ,, that I want to know whether it is a superposition of the vectors and , or just . What can I do to increase the probability to measure if indeed is a supeposition of and , and to measure else? 176.106.227.214 (talk) 17:30, 12 September 2015 (UTC)[reply]

If you think the qubit is in the state , you can apply the gate , which will take that to . 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)[reply]
How can I get this gate from the "standard" set of universal gates (CNOT, Hadamrd, and )? (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)[reply]

More formally, I look for a quantum circuit that uses the gates CNOT, Hadamrd, and only, and uses these gates as less as possible and satisfies that on input , if , then the output is in probability . Else, the output is in probability . 185.32.179.145 (talk) 12:53, 13 September 2015 (UTC)[reply]

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 else", which BenRG didn't address. I think it makes increasing the probability to measure impossible. Egnau (talk) 15:09, 13 September 2015 (UTC)[reply]
As Egnau suggested, that can't be done. A single-qubit state can be represented by a point on the Bloch sphere, with as the north pole and as the south pole. The states with are the entire sphere except the south pole. The states that will measure as 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, 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)[reply]
What happens if we add another input qubit . So now, we're looking for a rotation of in Bloch Sphere such that after the rotation value will be as described above, and we don't care what will be the value of . Is it possible? What transformation can do it? Thank you! 176.106.227.44 (talk) 07:30, 16 September 2015 (UTC)[reply]
?? 80.246.136.67 (talk) 09:01, 17 September 2015 (UTC)[reply]

Software documentation of libraries, DLLs and such as a source of bugs

[edit]

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)[reply]