Alarm Clock


How do you think an alarm clock feels, meant to wake you up, yet it carries a snooze button: a built-in function to render it useless, a failure, a counterproductive feature.

Do you ever feel like that alarm clock? When you try so hard, but it feels like life was built to go against you? When you don't know what was wrong, but it all went wrong? And you begin to worry, is it just me? Do I carry a snooze button, that automatic, built-in failure?

We all fail. We all fail to meet our goals every now and then. But that alarm clock will keep trying, no matter how many times you hit that snooze button. It's a resilient, stubborn little machine. The snooze button may stop it for a minute, but a minute later, it's back up, ringing, alive and kicking.

Embrace your inner alarm clock. Own up to your past mistakes. But don't let them stop you from trying, from continuing to work towards your goals. Don't let one push of a button knock you down. One day, you'll rise and shine and accomplish your dreams.

—Stang

#midnightramble
1 comment

1 comment :

Post a Comment

Please be appropriate and respectful.

Calculating Weird Trig Values

Drawn by me on Piskel.

How do calculators calculate irrational values and trigonometric values? Is the calculator programmed with a giant table with all the values of, say, sine, and when you ask it for the sine of 5, it looks it up? Maybe, but what if you asked it something really weird, like the cos(-57/ln3.2) or e^2.74? It's irrational that a calculator would just happen to have all those numbers and their corresponding values stored inside. Besides, if it did, where would they even come from?

Calculators use something called a Taylor Polynomial to estimate values like those stated above. Let's see how it works.

First, let me show you something interesting. This is sine.

All graphing screenshots are of desmos.com

It really is.


Alright, alright, here's the trick: it's just zoomed in really close. If you notice the x and y values, they are all less than 1 away from zero.
So we can conclude that when x is really close to zero, y=x is a pretty dang good approximation of sin(x). When x is past 0.5 and -0.5, the two lines start diverging.


You can extend the boundaries of the approximation by firstly, finding the difference between the two functions.
Use the function y = sin(x) - x


Hmm... Look familiar?
It's -x^3 multiplied by some constant to make it wider. A fraction, you conclude. After some fiddling, you find out that -(1/6)*x^3 works pretty well. Let's see how far that brings our approximation to.


Pretty nice, pretty nice. Now, the accuracy starts tapering off around 1.0 instead of 0.5.

If you repeat the cycle of finding the difference and adding another chunk of math to the approximation, you'll end up with this nifty equation:



(Red is sine and purple is the sine approximation.)
You can get pretty far by finding the difference and using guess and check to find the best denominator, but it'll get pretty tedious. It would be really sweet if there was, say, a pattern.

Thankfully, there is one. Notice how the 3 corresponds to 6; 5, 120; 7, 5040; 9, 362880? It's factorials!

The Taylor Polynomial, what this estimation equation is called, follows this pattern:

From Wikipedia

  • f(a) is the function
  • f'(a) is the first derivative, f''(a) is the second, and so on
  • a is where the polynomial is centered
  • x is the value, plugged into f(x) that you want to find
  • the closer x is to a (read: the closer the value you plug in is closer to where the polynomial is centered), the more accurate your approximation will be

You might be wondering why the sin(x) function we approximated in our example only has odd-powered x's and there is no (x-a).

That's because the "a" we used in the example was zero, so ever even-valued derivative of f at a is zero. In people speak, that means that sine is always zero at zero. And even-numbered derivatives (the second derivative, fourth derivative, and even no derivative aka zero) are always in sine, not cosine (which the odd-numbered derivatives are in which is why the numerator is always one in the example).

Since a = 0 in the example, (x-a) evaluates to simply x.

By the way, remember that this is an approximation! Use those squiggly approximation lines instead of the actual equal sign.

\sin \left(x\right)\approx x-{\frac {x^{3}}{3!}}+{\frac {x^{5}}{5!}}-{\frac {x^{7}}{7!}}.\!
These squiggly lines. (Thanks, Wikipedia)

Anyway, that's the Taylor Polynomial, and it is used to approximate sine, cosine, tangent, e, and other "weird" math.

—Stang
No comments

No comments :

Post a Comment

Please be appropriate and respectful.