Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [physics]

For challenges pertaining to problems in the field of Physics.

Filter by
Sorted by
Tagged with
24
votes
8answers
4k 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 ...
104
votes
16answers
5k 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 ...
20
votes
40answers
3k views

Parallel resistance in electric circuits

Introduction: Two resistors, R1 and R2, in parallel (denoted R1 || R2) have a combined ...
10
votes
25answers
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} <...
35
votes
32answers
4k 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 ...
9
votes
6answers
357 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 ...
18
votes
5answers
918 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 ...
19
votes
10answers
4k 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, ...
5
votes
4answers
383 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 ...
46
votes
19answers
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 ...
36
votes
15answers
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 ...
24
votes
21answers
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 ...
16
votes
6answers
1k 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 ...
6
votes
1answer
251 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 ...
6
votes
3answers
540 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 ...
19
votes
3answers
623 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 ...
10
votes
2answers
493 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 ...
1
vote
9answers
394 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 ...
27
votes
3answers
1k 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 ...
13
votes
8answers
586 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-...
36
votes
2answers
528 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 ...
16
votes
8answers
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 __________________________ ...
20
votes
9answers
862 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 ...
11
votes
1answer
248 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 ...
21
votes
7answers
676 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 ...
18
votes
5answers
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 ...
9
votes
1answer
492 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 ...
15
votes
3answers
495 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). ...
5
votes
2answers
881 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 ...
13
votes
1answer
366 views

Bob the Bowman!

Bob the Bowman ...
32
votes
9answers
3k 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 ...
18
votes
1answer
734 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 ...