Bradley Solliday's bmath Code Demos

View My Linkedin

This website is built and maintained by Bradley Solliday to demo various cool ideas and his code.

All the code demonstrated here can be found on the linked github repository (including the files for building this website).

This site is hosted on Github pages, meaning all the content on it is statically served. I'm using React to make writing the user interface easier, and webpack as my bundler. While the underlying repository is written mostly in Rust, The rust library, wasm-bindgen, makes it easy to export the code into Web Assembly, and the wasm-pack plugin makes it easy to import the resulting Web Assembly in javascript.

Wave Simulator

To the right is a simple wave simulator where each simulated point is represented by a pixel-like square, and the magnitude is represented by the color of the square. The magnitude of the wave is set to be a constant along the whole boundary.

Click on any square to "disturb" the wave, setting the magnitude to be large and the rate of change of the magnitude of the wave to be zero.

Note, the animation will not begin until you hit the play button, and will continue playing until you hit pause. The animation does not need to be paused in order to click and "disturb" the wave.

Discussion of Finite Differences

Here you can find a discussion of approximating the derivative of a function represented as an array of evaluated points.

To skip to the part where I start plotting solutions to a differential equation, click here. If you scroll down you'll see how the solution is improved by making successing modifications to the way the boundary conditions are implemented.

Here is the C++ code used to solve the differential equation and plot the results. Note, plotting is done with python2.7 via matplotlib-cpp, so if you wish to compile the code yourself, you'll have to download and link whatever dependecies your compiler demands.

General Math Discussions

Jump to page.

 This section is new, and thus doesn't have a wide range of topics on it yet. Right now there is a proof of how a k degree polynomial is uniquely determined by its value at k+1 points, an algorithm for taking the inverse of a real function of a real variable (along with some associated proofs for continuous and invertible functions), and a discussion of how to calculate the distance between line segments.
 More generally, you can expect to find proofs of various propositions I found interesting here.

Calculating Prime Numbers

Below is a demo of a method of calculating prime numbers based on the Sieve of Eratosthenes, but modified to allow the calculation of arbitrarily large prime numbers. See the documentation for the implementation here (note, the code is written in Rust).

Beware, I haven't yet gotten around to setting the code to run in the background, so if it takes a moment to calculate the first 1 million primes, think twice before adding another zero as the user interface will freeze until the calculation is complete (you can always close and reopen the page of course).

Calculating Greatest Common Divisors

The first demo below is a demonstration of Euler's algorithm for calculating the greatest common divisor of two positive integers. See the documentation for the implementation here.

The second demo below computes both the greatest common divisor d of two positive integers (m, n) and a pair of their Bezout coefficients (x, y), which are intergers such that xm + yn = d. Note, the Bezout coefficients are not unique. See the documentation for the implementation here

I won't bother to add a demo with a brute implementation, checking all potential divisors up to half the smaller argument (plus the smaller argument itself), would take a ridiculous amount of computational time.

As an aside, when I first started learning html, css, and Javascript, I started making a weblog to learn the languages and to share interesting ideas. The experiment was enlightening, if a bit laborious, and motivated me to look into Web Assembly (to allow me to reuse code), React (to ease the creation of user interfaces), Babel (to make React easier to use), Webpack (to make Babel and Terser easier to use, and later because I began to appreciate the dev-server and build enviornment), which culminated in this page you're on now.

Anyway, the one page I had completed before redirecting my efforts was on calculating GCDs. I thought I did a pretty good job of explaining Euclid's algorithm there, so I'd figure I'd link the relevant page. Keep in mind, the blog was unfinished, so don't count on anything but the GCD stuff working.

Discussion of Euclid's Algorithm

If you'd like to see the rest of the (unfinished) site, you can find it's homepage here.