Putting the 1992 Putnam Test question A-6 into code.

Overview

Problem

If you choose 4 points on a sphere and consider the tetrahedron with these points as it's vertices, what is the probability that the center of that sphere is inside of that tetrahedron? (Each point is independently chosen relative to a uniform distribution on the sphere.)

Bouquets

This project was inspired by the video The hardest question on the hardest test by 3Blue1Brown:

The hardest problem on the hardest test

Description

The proof discussed in the video is very elegant, but I wanted to see how it worked in practice.

For the random distribution, I create a starting point P(0 | 0 | 1), then rotate it by a random amount around the x-, y- and z-axis for a uniform distribution.

To test whether a point is inside or outside of the tetrahedron, I convert it's vertices into a barycentric coordinate system. For more information, check out this Wikipedia article.

Examples

You can find more examples in /examples or generate your own by running main.rs.

alt text alt text

You might also like...
A simple code that will load a shellcode directly into RAM memory in a new process
A simple code that will load a shellcode directly into RAM memory in a new process

γ€Œ πŸ”„ 」About RustSCLoader RustSCLoader is a simple code that has the intention of loading a shellcode directly into RAM memory in a new process that wi

Evaluate performance gains to expect when EVM were to compile hot contracts into machine code

Convert evm bytecode to native machine code and go vroom - just an experiment, probably broken, reach out to [email protected] to contribute / productionize.

 create and test the style and formatting of text in your terminal applications
create and test the style and formatting of text in your terminal applications

description: create and test the style and formatting of text in your terminal applications docs: https://docs.rs/termstyle termstyle is a library tha

Terminal-based typing test.
Terminal-based typing test.

ttyper Ttyper is a terminal-based typing test built with Rust and tui-rs. installation With Cargo: cargo install ttyper usage For usage instructions,

Simple test app based on rust-psp

PSP Test App Simple test app based on rust-psp. Demonstrating the usage of C libs. Build Download and unzip the prebuilt PSPSDK (built from clang-psp)

A tui to test regexes on the rust regex crate

regex-tui Structure src/ β”œβ”€β”€ app.rs - holds the states and renders the widgets β”œβ”€β”€ event.rs - handles the terminal events (key press, mouse cl

A common library and set of test cases for transforming OSM tags to lane specifications

osm2lanes See discussion for context. This repo is currently just for starting this experiment. No license chosen yet. Structure data tests.jsonβ€”tests

Black-box integration tests for your REST API using the Rust and its test framework

restest Black-box integration test for REST APIs in Rust. This crate provides the [assert_api] macro that allows to declaratively test, given a certai

yet another typing test, but crab flavoured

toipe A trusty terminal typing tester for the tux. Usage Install cargo install toipe Run typing test toipe looks best on a nice terminal (such as Ala

Owner
Elias
I'm Elias, an 18 year old college student from Berlin.
Elias
Rust library for putting things in a grid

rust-term-grid This library arranges textual data in a grid format suitable for fixed-width fonts, using an algorithm to minimise the amount of space

Benjamin Sago 61 Nov 4, 2022
Putting a brain behind `cat`πŸˆβ€β¬› Integrating language models in the Unix commands ecosystem through text streams.

smartcat (sc) Puts a brain behind cat! CLI interface to bring language models in the Unix ecosystem and allow power users to make the most out of llms

Emilien Fugier 28 Dec 2, 2023
Answering the question nobody asked: what if you wanted to text your friends using only ARP?

arpchat so... you know arp? the protocol your computer uses to find the mac addresses of other computers on your network? yeah. that. i thought it wou

Kognise 1.3k Jan 1, 2023
Coppers is a custom test harnass for Rust that measures the energy usage of your test suite.

Coppers Coppers is a test harness for Rust that can measure the evolution of power consumptions of a Rust program between different versions with the

Thijs Raymakers 175 Dec 4, 2022
A Rust command that prettifies the ugly `cargo test` output into a beautiful one.

Cargo Pretty Test ✨ A Rust command-line tool that prettifies the ugly cargo test output into a beautiful output. This crate can be also used as a libr

Jose Celano 105 Oct 10, 2023
Incredible.dev is an AI Coding Co-worker which can code, fix, document, deploy, test your APIs. One agent to rule everything API.

Incredible.dev Early Github preview, documentation and instruction to run coming soon in a week! Here are some highlights: AI agents that can code, fi

Incredible 27 Jun 27, 2024
πŸ“œπŸ”πŸŽΆ A CLI which converts morse code into sound

morse2sound ?? A CLI which converts morse code to sound Big shoutout to Br1ght0ne for guiding me how to use Rust on stream

Ilya Revenko 15 Dec 4, 2022
ripsecrets is a command-line tool to prevent committing secret keys into your source code.

ripsecrets is a command-line tool to prevent committing secret keys into your source code. ripsecrets has a few features that distinguish it from other secret scanning tools:

Brian Smith 588 Dec 30, 2022
Blazingly fast Rust CLI app to sync data from a folder of excel workbooks into generated c# code for unity usage

Extensions supported ( .xls, .xlsx, .xlsm, .xlsb, .xla, .xlam, .ods ) Speed Test Image shows the results of 5000defs synced from 2 workbooks and 5 she

null 4 Feb 16, 2023
🏭 Convert Markdown documents into themed HTML pages with support for code syntax highlighting, LaTeX and Mermaid diagrams.

Marky Markdown Magician ?? Features Hot reload previewing ?? Conversion to HTML / PDF ?? Themes! ✨ Extensions - Math, diagrams, syntax-highlighting ??

Vadim 12 Feb 19, 2023