Replicator

In  Star Trek a  replicator is a machine capable of creating (and  recycling) objects. Replicators were originally seen used to synthesize meals on demand, but in later series they took on many other uses.

Origins and limitations
Although previous sci-fi writers had speculated about the development of "replicating" or "duplicating" technology,[1]  the term "replicator" was not itself used until Star Trek: The Next Generation. In simple terms, it was described as a 24th century advancement from the 23rd century "food synthesizer" seen in Star Trek: The Original Series. The mechanics of these devices were never clearly explained on that show. The subsequent prequel series, Star Trek: Enterprise, set in the 22nd century, featured a "protein resequencer" that could only "replicate certain foods," so an actual chef served on board who used "a hydroponic greenhouse" where fruits and vegetables were grown. Additionally, that ship had a "bio-matter resequencer" which was used to recycle waste product into usable material.[2]

According to an academic thesis: "The so-called 'replicators' can reconstitute matter and produce everything that is needed out of pure energy, no matter whether food, medicaments, or spare parts are required."[3]  A replicator can create any inanimate matter, as long as the desired molecular structure is on file, but it cannot create antimatter, dilithium, latinum, or a living organism of any kind; in the case of living organisms, non-canon works such as the Star Trek: the Next Generation Technical Manual state that, though the replicators use a form of transporter technology, it's at such a low resolution that creating living tissue is a physical impossibility.

In its theory it seems to work similarly to a universal assembler.[citation needed]

Theory
A replicator works by rearranging subatomic particles, which are abundant everywhere in the universe, to form molecules and arrange those molecules to form the object. For example, to create a pork chop, the replicator would first form atoms of carbon, hydrogen, nitrogen, etc., then arrange them into amino acids, proteins, and cells, and assemble the particles into the form of a pork chop.

This process requires the destructive conversion of bulk matter into energy and its subsequent reformation into a pre-scanned matter pattern. In principle, this is similar to the transporter, but on a smaller scale. However, unlike transporters, which duplicate matter at the quantum level, replicators must be capable of a large number of different materials on demand. If patterns were to be stored at the quantum level, an impossible amount of data storage (or a set of original copies of the materials) would be required. To resolve this, patterns are stored in memory at the molecular level.

The drawback of doing so is that it is impossible to replicate objects with complicated quantum structures, such as living beings, dilithium, or latinum. In reality, living beings and/or cited elements are not necessarily more complex on a quantum level; the putative 'extra complexity' is used an in-universe function to head off questions such as 'why can't Starfleet replicate people?'[citation needed]  In the TNG episode "Allegiance", aliens used their version of replicators to create a Picard impostor. Additionally, read/write errors cause a number of single-bit errors to occur in replicated materials. Though usually undetectable to human senses, computer scanning can be used to reveal these discrepancies, and they may explain the frequent complaint (by some gourmets and connoisseurs) that replicated food and beverages suffer from substandard taste. These errors also may cause a nontoxic material to become toxic when replicated, or create strains of deadly viruses and bacteria from previously harmless ones.

Uses
One of the most important pieces of technology in the Star Trek universe, the replicator is used primarily to provide food and water on board starships, thus eliminating the need to stock most provisions. (Starships, starbases, and other installations stock some provisions for emergency use, in case of replicator failure or an energy crisis.) On Star Trek: Deep Space Nine, it was established that as long as there is an energy source to power life support, replication is used to provide breathable air on ships and starbases (and to disassemble the carbon dioxide exhaled by the crew), thus providing a seemingly endless supply of oxygen and eliminating the need to carry air tanks.

<p style="margin-top:0.5em;margin-bottom:0.5em;line-height:22.3999996185303px;color:rgb(37,37,37);font-family:sans-serif;font-size:14px;">The technology is also used for producing spare parts, which makes it possible to repair most ship damage without having to return to a starbase. Other applications include replication of Starfleet uniforms, as well as everyday objects such as toys and souvenirs.<sup class="noprint Inline-Template Template-Fact" style="line-height:1;font-size:11.1999998092651px;white-space:nowrap;">[citation needed]  Replication is also used by the Holodeck program to allow food, clothes, and other objects belonging within a simulation to be used or consumed by the participants.

<p style="margin-top:0.5em;margin-bottom:0.5em;line-height:22.3999996185303px;color:rgb(37,37,37);font-family:sans-serif;font-size:14px;">Starfleet's safety protocols prevent unauthorized replication of dangerous objects, such as weapons and poisonous substances.<sup class="reference" id="cite_ref-4" style="line-height:1;font-size:11.1999998092651px;unicode-bidi:-webkit-isolate;">[4]

<p style="margin-top:0.5em;margin-bottom:0.5em;line-height:22.3999996185303px;color:rgb(37,37,37);font-family:sans-serif;font-size:14px;">Replicators can also convert matter into energy. Following that principle, the device can dismantle any object into subatomic particles. The ensuing energy can then be stored for future use or immediately applied in a subsequent replication. This process is referred to as "recycling", and is applied to everything from dirty dishes<sup class="reference" id="cite_ref-5" style="line-height:1;font-size:11.1999998092651px;unicode-bidi:-webkit-isolate;">[5] to outgrown children's clothes.

<p style="margin-top:0.5em;margin-bottom:0.5em;line-height:22.3999996185303px;color:rgb(37,37,37);font-family:sans-serif;font-size:14px;">Replicator technology, even if produced on a larger scale, cannot be used to create complex objects such as shuttlecraft or starships (the production staff felt that being able to replicate entire starships "at the push of a button" would severely impact dramatic potential). However, in the Star Trek: Deep Space Nine episode "For the Cause", industrial replicators are used to replicate large components of ships, shuttlecraft, and other pieces of this sort, which are later used in shipyards to construct such vessels. In this manner, as few as 15 industrial replicators are enough to replicate the components needed to build a fleet of starships or to help a civilization recover from a planet-wide natural disaster.

<p style="margin-top:0.5em;margin-bottom:0.5em;line-height:22.3999996185303px;color:rgb(37,37,37);font-family:sans-serif;font-size:14px;">By virtually eliminating material scarcity, replicator technology plays an important role in the moneyless human economy within the Star Trek universe.

Voyager
<p style="margin-top:0.5em;line-height:22.3999996185303px;color:rgb(37,37,37);font-family:sans-serif;font-size:14px;">When the USS Voyager was pulled to the Delta Quadrant, it became clear that replicator technology was unknown to some of the indigenous peoples of that region. Throughout the first seasons, the Kazon and other races tried repeatedly to obtain the technology.

<p style="margin-top:0.5em;margin-bottom:0.5em;line-height:22.3999996185303px;color:rgb(37,37,37);font-family:sans-serif;font-size:14px;">Captain Janeway feared that if this technology were acquired by a civilization before they were ready, disastrous consequences could ensue. For this reason, and because of the Prime Directive, Janeway refused to give away the technology at any price.

<p style="margin-top:0.5em;margin-bottom:0.5em;line-height:22.3999996185303px;color:rgb(37,37,37);font-family:sans-serif;font-size:14px;">Also on Voyager, the ship's energy constraints on the journey back to the Alpha Quadrant meant that replicator supplies had to be strictly controlled, leading to "replicator rations" becoming an unofficial ship currency. This is also the reason Neelix (aside from providing the crew with a morale boost through the preparation of fresh food) became employed as the ship's chef. Some ingredients came from the ship's hydroponics laboratory.

In the real world
<p style="margin-top:0.5em;line-height:22.3999996185303px;color:rgb(37,37,37);font-family:sans-serif;font-size:14px;">In 2014, researchers at Nestlé were reported as working on technology comparable to the replicator, with the goal of providing food tailored to an individual's nutritional requirements.<sup class="reference" id="cite_ref-6" style="line-height:1;font-size:11.1999998092651px;unicode-bidi:-webkit-isolate;">[6]

<p style="margin-top:0.5em;margin-bottom:0.5em;line-height:22.3999996185303px;color:rgb(37,37,37);font-family:sans-serif;font-size:14px;">In comparison, 3D printers, which are now a mainstream technology and have a range of impressive and important capabilities (including shaping prostheses or making organs) are decidedly different, in that they do not create material "ex nihilo" (out of nothing), or perhaps more accurately, out of nuclei or atoms or programmed patterns of information, but instead, like regular printers, must use already pre-existing corporal material.

<p style="margin-top:0.5em;margin-bottom:0.5em;line-height:22.3999996185303px;color:rgb(37,37,37);font-family:sans-serif;font-size:14px;">Also, 3D printers are limited in the materials that they can print. Currently only materials that can be easily fused together via extrusion or sintering processes can be used by 3D printer technology — generally plastics, metals, and clays. However food, concrete, and a few other materials have been successfully printed on a limited scale.

<p style="margin-top:0.5em;margin-bottom:0.5em;line-height:22.3999996185303px;color:rgb(37,37,37);font-family:sans-serif;font-size:14px;">Imperial College London physicists have discovered how to create matter from light - a feat thought impossible when the idea was first theorised 80 years ago. In just one day in Imperial's Blackett Physics Laboratory, three physicists worked out a relatively simple way to physically prove a theory first devised by scientists Breit and Wheeler in 1934.<sup class="reference" id="cite_ref-7" style="line-height:1;font-size:11.1999998092651px;unicode-bidi:-webkit-isolate;">[7]