Demos

Below are some demonstrations of how MathPad can be used. Each section shows you what you can type into MathPad to see it for yourself. I've also made it so you can easily copy/paste the input directly into your own version of MathPad as well.

Bitwise: Odd/Even Check

You can use the bitwise & operator to determine if a number is even or odd. If you & a number by 1 it will return 0 if even and 1 if odd. This works because there is only one odd slot. Try visualizing it: 0, 1, 2, 4, 8, 16, 32, etc. Every slot is even except for "1". The & operator only returns 1/true if both sides are 1/true. So it only returns 1/true if the number if the 1 bit is set (i.e. is odd).

// Evens
100 & 1
52 & 1
18 & 1
4 & 1
2 & 1

// Odds
1 & 1
17 & 1
63 & 1
99 & 1

0
0
0
0
0


1
1
1
1

Bitwise: Swap Two Values With Only Two Variables

Typically, if you want to swap the values of two variables, you need a 3rd variable. But with bitwise you don't need that extra variable. You can try it yourself in MathPad.

a = 8
b = 3

a = a XOR b
b = a XOR b
a = a XOR b

a
b
8
3

11
8
3

3
8

Physics: Calculate Earth's Gravitational Acceleration

The gravity on Earth (i.e. Earth's gravitational acceleration), is 9.8 meters/second. You can calculate this value using the formula g = (GM)/r^2. MathPad contains a lot of hardcoded constants. So all you have to do is type in things like "Earth's mass" and "Earth's radius", etc.

G = Gravitational constant
M = Earth's mass
r = Earth's equatorial radius

g = (GM)/r^2

6.6742E-11
5.9737E+24 kilogram
6,378,135 meter

9.800657

As you can see it's easy to setup a formula in MathPad. In this case you just assign 3 values to 3 variables. After that you're ready to type in the formula that calculates Earth's surface gravity.

Large Numbers

During 2015 an image started circulating Facebook, claiming that if everyone split the money from Powerball we'd all get $4.33 million! That doesn't sound right. In MathPad, instead of counting zeros while typing in 1300000000 / 300000000 you can use commas: 1,300,000,000 / 300,000,000. Or, you can just type in 1.3 billion / 300 million.

$1300000000 / $300000000

$1,300,000,000 / $300,000,000

$1.3 billion / $300 million
$4.33

$4.33

$4.33

There are many little quality of life features like this in MathPad. Much of it was developed while I was taking math classes, so everytime I was doing homework and thought, "It would be nice if...", I would fire up Visual Studio and write the code for it.

Sources