Questions tagged [physics]

For challenges pertaining to problems in the field of Physics.

Filter by
Sorted by
Tagged with
18 votes
10 answers
1k views

Position from atomic number in the periodic table

Let us consider the following representation of the periodic table. ...
  • 321
13 votes
12 answers
2k views

Simulate the ripple effect

Imagine throwing a rock into a pond. You get to see perfect circles of ripples spreading out over the pond, bouncing off of each other. Of course, nothing can be as serene as that in coding, but, we ...
  • 691
40 votes
13 answers
4k views

Recreate Minecraft's lighting

Minecraft has a fairly unique lighting system. Each block's light value is either one less than the brightest one surrounding it, or it is a light source itself. Your task is to write a method that ...
  • 691
18 votes
9 answers
1k views

The Koszul Sign Rule

A Bit of Background The exterior algebra is a central object in topology and physics (for the physics concept cf. fermion). The basic rule dictating the behavior of the exterior algebra is that \$yx =...
  • 2,085
20 votes
13 answers
1k views

Convert Planck unit to SI metric

Objective Given a dimension of an SI unit, convert the Lorentz-Heaviside version of a Planck unit \$1\$ into SI metric. What is a Planck unit? Planck units are a set of units of measurement. It ...
  • 4,173
22 votes
14 answers
3k views

Elastic collisions between blocks

The 3Blue1Brown Youtube channel released a video a year ago called "Why do colliding blocks compute pi?" which describes a model where a block A of mass \$a\$ ...
  • 8,117
22 votes
44 answers
3k views

Parallel resistance in electric circuits

Introduction: Two resistors, R1 and R2, in parallel (denoted R1 || R2) have a combined ...
29 votes
8 answers
5k views

Billiard balls collision

Given the 2-dimensional positions and velocities of a pair of billiard balls right before impact, calculate their velocities after a perfectly elastic collision. The balls are assumed to be ideal ...
  • 14.9k
9 votes
6 answers
415 views

Help Notwen simulate gravity!

Notwen wants to study the kinematics of bodies thrown from big heights in a uniform gravitational field but unfortunately he doesn't have the technical possibility to go to sufficiently high places ...
  • 41.6k
5 votes
4 answers
485 views

Einstein's Sorter

Challenge Given a list of integers and a velocity, \$v\$, implement a sorting algorithm which simulates a program sorting the list from smallest to biggest at the given velocity. Einstein's Theory ...
  • 22.8k
23 votes
22 answers
2k views

Can this list be balanced?

To check whether a list of non-negative integers is balanced, one can imagine putting respective weights on a board and then try to balance the board on a pivot such that the summarized relative ...
  • 25.2k
19 votes
10 answers
5k views

What do I need to destroy the world?

The gravitational binding energy of a planet is the amount of energy required to separate every tiny piece of it so that no piece will orbit or collide with another piece. For a uniform sphere, ...
  • 3,576
17 votes
6 answers
2k views

The Double Slit Experiment

A lazy physicist has the job to perform the double slit experiment. However, they are lazy and can't be bothered to set up all the equipment themselves and so are going to simulate the effects. They ...
38 votes
16 answers
3k views

Will I tip over?

Overview Given a 3 line string, figure out if the structure falls to the left, balances, or falls to the right. Input structure You can imagine the structure as metal rod with stuff on top, all being ...
  • 1,025
6 votes
1 answer
278 views

Construct a multiparticle quantum state

Sandboxed and made less complicated and hopefully more fun. Summary of the challenge Given a number of particles, either identical bosons or identical fermions, output the total wave function of the ...
  • 539
19 votes
3 answers
694 views

Name the Hadrons

Challenge Given a quark composition of a particle as input, output the corresponding hadron's name. Quarks will be represented by a capital letter and antiquarks by a lowercase letter. The quarks ...
  • 22.8k
6 votes
3 answers
558 views

Calculate gravity on a 1D field

Given a string or list, calculate the effects of gravity on that string/list. The string will be made of 5 characters: N has a weight of 2 ...
  • 6,532
10 votes
2 answers
530 views

Derive the Units

Challenge Given a list of SI base units, a list of equations and a target, you must derive the units of the target using only the base units. Derived Units From Wikipedia: The International System of ...
  • 22.8k
1 vote
9 answers
415 views

Predict the Bomb's Landing Point!

Introduction It was just a normal day, here at your military base. Suddenly, you looked up to see a bomb falling down from the sky! You need to create a program to predict where it will fall, and tell ...
37 votes
35 answers
5k views

Draw the arc of a ball

Draw the parabolic trajectory of a thrown ball. The input is the ball's initial upward velocity, a positive integer v. Every second, the ball moves ...
  • 139k
13 votes
8 answers
2k views

Add weight to one side of a see-saw to balance it

Balancing Act A see-saw (supposedly from the French 'ci-ça', meaning 'this-that') forms a third of the holy trinity of playground equipment, along with the similarly ubiquitous slide and swing. A see-...
16 votes
8 answers
2k views

Falling ASCII balls

Input You are given a 2D map with balls and ground in it. It looks like this: 1 5 2 3 4 __________________________ Each ...
  • 501
11 votes
27 answers
2k views

Calculate the relativistic velocity

In special relativity, the velocity of a moving object relative to another object that is moving in the opposite direction is given by the formula: \begin{align}s = \frac{v+u}{1+vu/c^2}.\end{align} <...
's user avatar
28 votes
3 answers
2k views

Volts, Amps, Watts and Ohms: given two, calculate the other two

Ohm's law tells us that the current (I) in amps flowing through a resistance (R) in Ohms when a voltage (V) is applied across it is given as follows: V = I / R ...
19 votes
9 answers
936 views

How far is the Sun?

Introduction tl;dr Continuously output the current distance from the Earth to the Sun. Simplified, the orbit of the Earth around the Sun is an ellipse. So the actual distance between both is ...
10 votes
1 answer
298 views

Attraction Between Words

Newton's theory of gravitation says that the gravitational force between two point masses is F=(Gm1m2)/ r2 Where G is the gravitational constant: 6.674×10−11 N · (m/kg)2 m1 is the mass of the ...
  • 6,546
21 votes
7 answers
716 views

Electrostatic potential of a simple system

In physics, like electric charges repel, and unlike charges attract. The potential energy between two unit charges separated by a distance d is ...
  • 21.2k
46 votes
19 answers
5k views

Lever Simulator 2015

Why a Simulator? Kids these days don't have the time nor the ambition to actually go and stack boxes on the see-saw or play around with balancing physical objects. This leaves lots of room in the ...
15 votes
3 answers
547 views

Dimensional Analysis

Calculate a product or ratio of SI units. For example, kg m / s s (kilogram-meter per second squared) should return N (newton). ...
  • 10.8k
18 votes
5 answers
1k views

The Interview: The Front Nine

The Interview: The Front Nine This is the first of a series of challenges inspired by programming job interview questions. You walk into the office where your potential future boss sits. "Come on in ...
's user avatar
105 votes
16 answers
6k views

Simulate the Universe!

One nice property of a Turing-complete language is that it can be used to write any program, up to and including the simulation of the entire Universe. Your job is to do exactly that: write a program ...
  • 8,090
36 votes
2 answers
591 views

Will the tower balance?

Introduction Given an ASCII tower and the force of the wind, write a program or function to determine if the tower will balance or which way it will fall. For example the first tower balances but ...
9 votes
1 answer
542 views

Variant of racetrack with exact finishing point and zero terminal velocity

Introduction The challenge is a very interesting variant of the game racetrack and those two challenges: To Vectory! – The Vector Racing Grand Prix Program a Racing Car Source of this challenge is ...
  • 341
5 votes
2 answers
1k views

3-D Antiferromagnetism

A while ago, we had a challenge related to antiferromagnetism (AF) in two dimensions. Now, on a 2-d square lattice, antiferromagnetic is antiferromagnetic, and that is all there is to it. Moving to ...
  • 951
12 votes
1 answer
401 views

Bob the Bowman!

Bob the Bowman ...
's user avatar
17 votes
5 answers
961 views

What's the voltage over each component?

The picture below shows a RLC circuit. A RLC circuit is an electrical circuit consisting of a resistor (R), an inductor (L), and a capacitor (C), connected in series or in parallel. (1) In order to ...
32 votes
9 answers
4k views

Balance a set of weights on a seesaw

Balancing Act Overview Given an input of 3 single-digit positive integers representing a set of weights, output an ASCII representation of a seesaw with the weights placed on it so that it is in ...
  • 1,667
18 votes
1 answer
786 views

Mini Golf Code Golf

This is a mini golf hole: The outer boundary is a circle with radius 10 and center (0,0). The inner boundary is a circle with radius 3 and center (0,5). The tee is at (0,-8). Assume the ball is just ...
13 votes
3 answers
578 views

Physics golf: inclined shooting

An angry bird is shot at an angle \$β\$ to the horizontal at a speed \$u\$. The ground is steep, inclined at an angle \$α\$. Find the horizontal distance \$q\$ that the bird traveled before it hit the ...
  • 5,438