Giter VIP home page Giter VIP logo

putnam-1992's Introduction

Question

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.)

Thank You

3Blue1Brown for his video The hardest question on the hardest test for inspiring me to create this project.

Description

For a uniform distribution of the points, a starting point P(0 | 0 | 1) is created, then rotated by a random degree around the x-, y- and z-axis.

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

I have added a plot function the the code to help visualize the problem as well as see if my code was working correctly.

Thoughts

While the solution to this problem by 3Blue1Brown is very elegant, I wanted to implement a heuristic approach to the problem. This project was more of a practice for my knowledge of linear algebra than meant as a serious analysis of the question.

Examples

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

example-1

Center of sphere outside of the tetrahedron

example-2

Center of sphere inside of the tetrahedron

putnam-1992's People

Contributors

eliavaux avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.