30 seconds of code

Browse 1075 short code snippets for all your development needs on 30 seconds of code.

 

30 seconds of code provides a wide variety of snippet and article collections for all your development needs. Explore individual language collections or browse through collections about specific topics and programming concepts.

Read the full article at: www.30secondsofcode.org

Read the full article at: www.30secondsofcode.org

Quantum Physics Questions Causality and Hints to Change the Laws of Cause and Effect

Spurred on by quantum experiments that scramble the ordering of causes and their effects, some physicists are figuring out how to abandon causality altogether.

 

Quantum researchers now have shown that quantum theory allows for transformations of black boxes that cannot be realized by inserting the input black boxes within a circuit in a pre-defined causal order. The simplest example of such a transformation is the classical switch of black boxes, where two input black boxes are arranged in two different orders conditionally on the value of a classical bit. The quantum version of this transformation-the quantum switch-produces an output circuit where the order of the connections is controlled by a quantum bit, which becomes entangled with the circuit structure. Simulating these transformations in a circuit with fixed causal structure requires either postselection, or an extra query to the input black boxes.

Read the full article at: www.quantamagazine.org

Read the full article at: www.quantamagazine.org

New Precise Hubble Constant Measurement Adds to Mystery of Universe Expansion

Scientists have known for almost a century that the universe is expanding, meaning the distance between galaxies across the universe is becoming ever more vast every second. But exactly how fast space is stretching, a value known as the Hubble constant, has remained stubbornly elusive.

 

Now, University of Chicago professor Wendy Freedman and colleagues have a new measurement for the rate of expansion in the modern universe, suggesting the space between galaxies is stretching faster than scientists would expect. Freedman’s is one of several recent studies that point to a nagging discrepancy between modern expansion measurements and predictions based on the universe as it was more than 13 billion years ago, as measured by the European Space Agency’s Planck satellite.

 

As more research points to a discrepancy between predictions and observations, scientists are considering whether they may need to come up with a new model for the underlying physics of the universe in order to explain it.

 

Read the full article at: www.nasa.gov

How to make our electronics smarter, faster, and more resilient – topology has the answer

A new database and searchable tool reveals more than 90,000 known materials with electronic properties that remain unperturbed in the face of disruption.

 

Topology stems from a branch of mathematics that studies shapes that can be manipulated or deformed without losing certain core properties. A donut is a common example: If it were made of rubber, a donut could be twisted and squeezed into a completely new shape, such as a coffee mug, while retaining a key trait — namely, its center hole, which takes the form of the cup’s handle. The hole, in this case, is a topological trait, robust against certain deformations.

 

In recent years, scientists have applied concepts of topology to the discovery of materials with similarly robust electronic properties. In 2007, researchers predicted the first electronic topological insulators — materials in which electrons that behave in ways that are “topologically protected,” or persistent in the face of certain disruptions.

 

Since then, scientists have searched for more topological materials with the aim of building better, more robust electronic devices. Until recently, only a handful of such materials were identified, and were therefore assumed to be a rarity. Now researchers at MIT and elsewhere have discovered that, in fact, topological materials are everywhere, if you know how to look for them.

 

In a paper published today in Science, the team, led by Nicolas Regnault of Princeton University and the École Normale Supérieure Paris, reports harnessing the power of multiple supercomputers to map the electronic structure of more than 96,000 natural and synthetic crystalline materials. They applied sophisticated filters to determine whether and what kind of topological traits exist in each structure.

 

Overall, they found that 90 percent of all known crystalline structures contain at least one topological property, and more than 50 percent of all naturally occurring materials exhibit some sort of topological behavior. “We found there’s a ubiquity — topology is everywhere,” says Benjamin Wieder, the study’s co-lead, and a postdoc in MIT’s Department of Physics.

 

The team has compiled the newly identified materials into a new, freely accessible Topological Materials Database resembling a periodic table of topology. With this new library, scientists can quickly search materials of interest for any topological properties they might hold, and harness them to build ultra-low-power transistors, new magnetic memory storage, and other devices with robust electronic properties.

Read the full article at: news.mit.edu

Telescopes Support Studying Milky Way’s Black Hole

Multiple telescopes, including Chandra, observed the Milky Way’s giant black hole simultaneously with the Event Horizon Telescope (EHT). This combined effort gave insight into what is happening farther out than the field-of-view of the EHT.

The main panel of this graphic contains X-ray data from Chandra (blue) depicting hot gas that was blown away from massive stars near the black hole. Two images of infrared light at different wavelengths from NASA’s Hubble Space Telescope show stars (orange) and cool gas (purple). These images are seven light years across at the distance of Sgr A*. A pull-out shows the new EHT image, which is only about 1.8 x 10-5 light years across (0.000018 light years, or about 10 light minutes). (Credit: X-ray: NASA/CXC/SAO; IR: NASA/HST/STScI. Inset: Radio (EHT Collaboration))

Lee este anuncio de prensa en español aquí.

As the Event Horizon Telescope collected data for its remarkable new image of the Milky Way’s supermassive black hole, a legion of other telescopes including three NASA X-ray observatories in space was also watching.

Astronomers are using these observations to learn more about how the black hole in the center of the Milky Way galaxy — known as Sagittarius A * (Sgr A* for short) — interacts with, and feeds off, its environment some 27,000 light years from Earth.

Read the full article at: www.nasa.gov

NASA’s James Webb Space Telescope’s Sharper View Hints at New Possibilities for Science

NASA’s James Webb Space Telescope is aligned across all four of its science instruments, as seen in a previous engineering image showing the observatory’s full field of view. Now, we take a closer look at that same image, focusing on Webb’s coldest instrument: the Mid-Infrared Instrument, or MIRI. The MIRI test image (at 7.7 microns) shows part of the Large Magellanic Cloud. This small satellite galaxy of the Milky Way provided a dense star field to test Webb’s performance.

 

Here, a close-up of the MIRI image is compared to a past image of the same target taken with NASA’s Spitzer Space Telescope’s Infrared Array Camera (at 8.0 microns). The retired Spitzer telescope was one of NASA’s Great Observatories and the first to provide high-resolution images of the near- and mid-infrared universe. Webb, with its significantly larger primary mirror and improved detectors, will allow us to see the infrared sky with improved clarity, enabling even more discoveries.

For example, Webb’s MIRI image shows the interstellar gas in unprecedented detail. Here, you can see the emission from “polycyclic aromatic hydrocarbons,” or molecules of carbon and hydrogen that play an important role in the thermal balance and chemistry of interstellar gas. When Webb is ready to begin science observations, studies such as these with MIRI will help give astronomers new insights into the birth of stars and proto-planetary systems.

 

In the meantime, the Webb team has begun the process of setting up and testing Webb’s instruments to begin science observations this summer. Today at 11 a.m., Webb experts will preview these next two months of instrument preparations in a teleconference for media. Listen to the audio stream live at nasa.gov/live.

Read the full article at: blogs.nasa.gov

Creating beautiful stand-alone interactive D3 charts with Python

Visualizing your data can be the key to success in projects because it can reveal hidden insights in the data, and improve understanding. The best way to convince people is by letting them see and interact with their data. Despite many visualization packages being available in Python, it is not always straightforward to make beautiful stand-alone and interactive charts that can also work outside your own machine. The key advantage of D3 is that it works with web standards so you don’t need any other technology than a browser to make use of D3. Importantly, interactive charts can help to not just tell the reader something but let the reader see, engage, and ask questions.

 

This blog outlines how you can build your own stand-alone, interactive force-directed D3 network using Python. Note that the steps are similar to any other D3 chart. If you need a readily working version, the d3graph library is for you!

Read the full article at: towardsdatascience.com

Your First Machine Learning Project in Python Step-By-Step

Do you want to do machine learning using Python, but you’re having trouble getting started? In this post, you will complete your first machine learning project using Python.

 

In this step-by-step tutorial you will:

  1. Download and install Python SciPy and get the most useful package for machine learning in Python.
  2. Load a dataset and understand it’s structure using statistical summaries and data visualization.
  3. Create 6 machine learning models, pick the best and build confidence that the accuracy is reliable.

 

If you are a machine learning beginner and looking to finally get started using Python, this tutorial was designed for you.

Read the full article at: machinelearningmastery.com