Tuesday, 13 September 2011

Converting between Number Systems

I'm finally back from an extensive summer of military training. I am finally back in school. So now I can go back to blogging and teaching what I am currently learning. Both so you as the reader can learn some neat things; and I can remember what was taught. Call it studying maybe. So one of my computer science classes is "Intro to Computer Architecture". First day I learned to convert between 4 number systems.

I won't go into much detail about what exactly they are. But here they are.

Decimal: Can use any number between 0 and 9.

Hexadecimal: Can use any number between 0 and 9. Any number higher is represented by a letter. These letters are A to F. Where A = 10 and F = 15.

Octal: Can use any number between 0 to 7.

Decimal: Can use 0 or 1.

One thing i will mention which is important is these number systems use a base.

Denoted as (N)^what ever base

Decimal is base 10.  (N)^10

Hexadecimal is base  16. (N)^16

Octal is base 8. (N)^8

Binary is base 2. (N)^2

The base is represented by how many numbers are in the number systems set.

So as for converting between the numbers.

EX Decimal to Binary

Lets have our decimal number as 1411 as today is the 14th and the year is 2011.

So we write (1411)^10 ---> (N)^2   to show our decimal number and what base we are converting to.

Heres where the conversion starts. Take whatever the base is of the system you are converting two. Then divide the number you are converting by that base. Keeping the remainder each time and add it on top of your divided number. We are actually using the operator Modulo instead.

1411 / 2 = 705+1
705/2 =  352+1
352/ 2 =  176 + 0
176/2 = 88 + 0
88/2 = 44 + 0
44/2 = 22 + 0
22/2 = 11 + 0
11/2 = 5 + 1
5 / 2 = 2 + 1
2 / 2 = 1 + 0
1 / 2 = 0 + 1

When we get to zero as in bold above we stop. Note that this is also similar to Euclid's algorithm. Now this is the kool part. Starting from the bottom of that long series of modulo. Take the remainders of each modulo and write those numbers next to each other as shown below.

(10110000011) this is the binary conversion. To test to see if we did this right. Starting from the right hand side of our binary number. We go up the powers of 2 on each number.

2^ 0 = 1  ; 2^ 1 = 2 ; 2 ^ 2 = 4; 2^ 3 = 8 ; 2 ^ 4 = 16 ; 2 ^ 5 = 32 ; 2 ^ 6 = 64 ; 2^ 7 = 128 ;
2 ^ 8 = 256 ; 2 ^ 9 = 512; 2 ^ 10 =1024 ; 2^ 11 = 2048 ;

So to break our binary up into individual bits.starting from the right hand side. If it is a one you give it the power of two determined.

1 + 2 + 128 + 256 + 1024 = 1411.

EX conversion from octal to binary.

This starts to get a little different. Octal has a base of 8. Which means that for each octal number binary requires 3 binary numbers.

Lets pick good old 63.

(63)^ 8 ---> (N)^2. Same idea but now we do each number individually. So starting at 6 then 3.

6/2 = 3 + 0
3/2 = 1 + 1
1=2 = 0 + 1    if you notice there is our 3 binary numbers required to represent one octal number.

3/2 = 1 + 1
1/2 = 0 + 1

Now in this case if you start with zero. But you know you have to have 3 numbers keep going till you have three numbers.

3/2 = 1 + 1
1/2 = 0 + 1
0 / 2 = 0 + 0 

So taking our 6 binary numbers. we get (110) and (011)

Testing this out to see if we did it correctly.
(110) = 2+4 = 6
(011) = 1+ 2 = 3

Note that testing the two together will give you 51 and not 63. By together I mean 110011.

Hexadecimal to Octal

(FACE5) ^ 16 ---> (N)^8

For these conversion we either need to change hexadecimal to binary or decimal. If you change to binary for each hexadecimal requires 4 bits( 4 binary numbers, such as how octal requires 3 bits).

We will convert to binary.

(FACE5)^16 ---> (N)^ 2

F = 15 / 2 = 7 + 1
7 / 2 = 3 + 1
3 / 2 = 1 + 1
1 / 2 = 0 + 1

A = 10 / 2 = 5 + 0
5 / 2 = 2 + 1
2/2 = 1 + 0
1/2 = 0 + 1

C = 12 / 2 = 6 + 0
6 = 2 = 3 + 0
3 / 2 = 1 + 1
1/2 = 0 + 1

E = 14 / 2 = 7 + 0
7 / 2 = 3 + 1
3 / 2  = 1 + 1
1/2 = 0 + 1

5/2 = 2 + 1
2/2 = 1 + 0
1/ 2 = 0 + 1
0 / 2 = 0 + 0

Our binary conversion is (1111101011100101) Now becuase octal takes 3 bits per number we need to split our binary up into groups of 3 bits.

Since theres 16/ 3 =  5  Remainder 1 Let the one remainder be the first bit. The group the rest.

1  111 101 011 100 101. Now lets see what are octal number is.

101 = 1 + 4 = 5
100 = 4
011 = 1 + 2 = 3
101 = 5
111 = 1 + 2 + 4 = 7
1 = 1


Hope you had fun reading this. Have fun showing off to friends.


Friday, 3 June 2011

Deep Web

Every wonder how big the internet is? I have wondered this. Now the internet in it's size can never truly be determined. We can gather a rough approximation. But it grows to rapidly and unpredictable. Now here is a brain buster. All of us who use the internet has probably only visited less than 1%. Most likely smaller. his is partly in reason that web search engines only scratch what is called the surface layer of the web. This layer is all that a search engine can reach to find websites. The rest of the websites are lost down in a place called the dark web or deep web/net.

So i have a challenge for anyone reading this. Go find a deep net search engine and explore the deep net. There is all kinds of information undiscovered waiting for you.

Just be careful!!!

Majority of the deep net holds criminal activity such as identity theft, cp, scams.

So be safe and have fun

Wednesday, 1 June 2011

Doritos and why the kind I tried, hurt!

So while I was away on course. I had a weekend off and decided to skip to the next town over. This town being Owen sound, a nice beach city. I decided instead of sleeping on a cot I would buy a hotel room with some buds and sleep there. While I was staying there a younger fellow on another course came out with a bunch of weird Doritos chips. They were well weird because I have never seen them before.

They were Doritos 1st degree burn, 2nd degree burn, and 3rd degree burn. Each bag a totally different level of spiciness. I never got to try them then. But about 2 weeks later(now) as I write this I bought some. Needless to say my mouth is still on fire from 6 hours ago when I tried them. Starting with 1st degree.

The flavor was jalapeno.  Needless to say I am already weak for jalapeno's. So these chips were manageable, but I still had a nice face sweat going on along with the tip of my tongue for some reason burning. You will definitely want to try and finish this bag before continuing your quest of pain. 

Next up is fiery buffalo. Now this one was surprisingly not as bad as the first for me. I was pounding them back as they had a very calm sweetness to them. Then it hit me like a wall of death. There is mad after burn with these chips. It sucks, I thought i was going to die. I drank 4 liters of milk and it still hurt. After accomplishing both 1st and 2nd degree. You have earned to try 3rd. If your not dead yet.

Scorching Habanero. Now I did not have the option of buying these chips as they were out of order. But from what I have read online it was probably best that I did not. The chip bag is red and the chips apparently don't look any different. Each bite is like swallowing razors of heat. When I get the chance to buy these I will write about my trip to the hospital. As I will clearly be there.

To the reader this may have been very exaggerated. Still eat at your own discretion.  Have fun and challenge yourself with these chips. They may be hard to come by in Canada as I had a hard time finding them.

Saturday, 28 May 2011


So i am back for a few days before i head back to work. In my last post i did not mention what i was doing. I was currently finishing off my military boot camp course. The second portion of it. Also known as BMQ Land (Soldier Qualifications). So i will keep this post short, as my writing skill has diminished a little. "BMQ" stands for "Basic Military Qualifications". "Land" means what side of the military I am on. In this case Land is well land and not air or naval.

Course details(what i learned):

M72 Rocket Propelled Grenade (SRAAW (L))
C13 Fragmentation grenade
C9 Light Machine Gun
C6 General Purpose Machine Gun

Platoon Attacks
Section Attacks

Recce Patrols

Offensive and Defensive Operations

How to dig and man a trench and not sleep for a week straight

The last point was the highlight of the course. Now i will display a picture of myself and the killing tools I was trained on.

Thursday, 21 April 2011

Leave of Absence

Hi there fellow views and followers. I am sad to inform you that I will no longer be blogging for the next 3 months. This is mainly due to I need work to pay for school. Now your probably wondering and saying, "well i work and i can blog". This may be true, but for myself I will not have the privilege of internet and computer access.  In my line of work which I will not disclose with you.

On those regards, I shall be returning August 1st or sooner. Thus you can expect to read more programming math related posts around that time. Also for the voting post.

What Language to explain and possibly teach?

Total votes per language:

C: 0
Java: 7
CSS: 0
Javascript: 0
PHP: 2
Other(aka Ruby): 1

So as you can see it is a tie between Java and C++. Thus we need to take into consideration my vote.
I myself would like to learn and teach Java in the process. So in august before my object oriented programming starts. I will be getting a head start by learning java. So this is my last post. Have a good summer.

Tuesday, 19 April 2011

Portal 2

So finally Portal 2 came out. For those who have not even heard of Portal. You have to crawl out of your cave and game it. It has won all sorts of awards and is quite possibly the most original game I have played.

Here is a quick writeup from our good friend Wikipedia.

The game consists primarily of a series of puzzles that must be solved by teleporting the player's character and simple objects using the Aperture Science Handheld Portal Device (ASHPD, also dubbed the "portal gun"), a unit that can create inter-spatial portals between flat planes. The player character, Chell, is challenged by an AI named GLaDOS(Genetic Lifeform and Disk Operating System) to complete each puzzle in the Aperture Science Computer-Aided Enrichment Center using the portal gun with the promise of receiving cake when all the puzzles are completed.

In short summary for anyone who has played. The cake is a lie. This was quite possibly the best game of 2007.

So besides Portal being an awesome game. Such an awesome game as a sequel. Portal 2. Now i have not played the game yet. As i am waiting for my younger brother to get off the Xbox 360, and go to bed which should have been 2 hours ago.  I will soon be playing this game. I am extremely excited and I think after this post i will be kicking my brother off. Oh and obviously I will have to beat it all in one sitting.

The game description on the back of the game case.

The single-player portion of Portal 2 introduces a cast of dynamic new characters, a host of fresh puzzle elements, and a much larger set of devious test chambers. Players will explore never-before-seen areas of the Aperture Science Labs and be reunited with GLaDOS, the occasionally murderous computer companion who guided them through the original game.
The game's two-player cooperative mode features its own entirely separate campaign with a unique story, test chambers, and two new player characters. This new mode forces players to reconsider everything they thought they knew about portals. Success will require them to not just act cooperatively, but to think cooperatively.

Screenshot of one of the game's test chambers, showing the deterioration over the years (plant overgrowth, damaged panels and floors, etc.) Also demonstrates the crazed art left by the "Rat Man" character that reviews the events of the first game.

Monday, 18 April 2011

What Language to explain and possibly teach?

So starting this week, depending on how well comments go. I will be interacting with my fellow followers a bit. I want to see what you my followers want to see me talk about. To do this I will obviously ask you the reader to leave a nice comment/vote to determine what I talk about next. The topics I will be talking about will either be a programming language that i have not explored yet, or one that I am extremely familiar with. So this will be both a fun experience for myself and for the reader. I will hopefully brush up on some programming, or possibly learn a new language or at least better understand a language. I will also be referencing this post in my other posts so that you can get a chance to vote/comment. So I will now lay down the options for you to decide.

******* Please comment with the language you would like me to talk about*********
  1.  C
  2.  C++ 
  3. HTML
  4. CSS
  5. JavaScript
  6. PHP
  7. Java
  8. Other (state what language in comment)
Voting will be over by Wednesday or Thursday. 

 So I look forward to talking about one of these. Also even though school is over for myself. I have always wanted to learn Big "O" in math. So i think I will teach myself that and post it about that sometime.

Sunday, 17 April 2011

Javascript Tricks

I have read a few tricks across my travel through the Internets in regards to Javascript.

JavaScript, also known as ECMAScript is a prototype-based, object-oriented scripting language that is dynamic, weakly typed and has first-class functions. - http://en.wikipedia.org/wiki/JavaScript

Now when i say tricks i mean something that manipulates the code of a site in a non harmful way to create personal enjoyment. You can also use these to benefit yourself or show off to friends. What ever order comes first.

All of the code presented can be copied and pasted into the URL bar. Hit enter and enjoy. Also it may help if JavaScript is turned on in your browser. 

Master Editor:

So anyhow here is some code to help you edit your site faster, or pretend to be editing a site in real time.

javascript:document.body.contentEditable='true'; document.designMode='on'; void 0

My personal favorite. Takes all images off the site and creates a Ferris wheel with them. 

Image Vortex:

javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.getElementsByTagName("img"); DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+"px"; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+"px"}R++}setInterval('A()',5); void(0);

 If you look carefully in the above code, its rotating the HTML “img” tag. Just replace it with “a” or “p” and watch some links or text rotate instead of images.


Your screen is going to love this one.

avascript:function flood(n) {if (self.moveBy) {for (i = 200; i > 0;i--){for (j = n; j > 0; j--) {self.moveBy(1,i); self.moveBy(i,0);self.moveBy(0,-i); self.moveBy(-i,0); } } }}flood(6);{ var inp = "D-X !msagro na dah tsuj resworb rouY"; var outp = ""; for (i = 0; i <= inp.length; i++) {outp =inp.charAt (i) + outp ; } alert(outp) ;}; reverse 

 Sketchy Site, Inspect it:

If you find a site that you feel you cannot trust. You want to verify that it is authentic. You can with this.

javascript:alert("The actual URL is:\t\t" + location.protocol + "//" + location.hostname + "/" + "\nThe address URL is:\t\t" + location.href + "\n" + "\nIf the server names do not match, this may be a spoof.");

Roll up your broswer Katamari style:

javascript:var h='http://dl.dropbox.com/u/1881429/Katamari/',i,n,ss=['http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js',h+'Renderables.js',h+'Game.js'];for(i=0;i<ss.length;i++){n=document.createElement("script");n.src=ss[i]+'?'+Date.now();document.head.appendChild(n);}

This code only works for chrome and safari.  Thanks to "mac and me" for posting a comment about this.

Basic Calculator:
 Possibly the most helpful out of these tricks. 

javascript: alert(69696-76543+555);

Change the numbers inside the alert function to create your own equations. You can also not include numbers in the function, but instead write any comment that you want displayed like. Your computer will self destruct in 10 seconds. Freak your friends out. Have fun.

Saturday, 16 April 2011

PHP: File Input and Output

So i was meddling around today will File input and output functions. These functions are relatively the same as what i have dealt with in C and C++. One thing that's bothering me is the newline command is still acting weird for me. Another thing I experimented with was getting a string or value from a user input. This involves HTML forms. Which i have very little experience with too. So today was very hectic trying to learn and correct a lot of mistakes and errors while trying to code and learn new things. I also noticed what i was coding actually required a server this time. So i used a nice program called xampp to set up a PHP server for me. So testing the code on that has been splendid. So anyhow on to the coding.

Source Code
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <meta http-equiv="content-type" content="text/html; charset=us-ascii" />


    Form site
    <br />

    <form action="fileio.php" method="post">
        username:<input name="name" type="text" /> <input type="submit" />
Now the code that makes the least amount of sense is this.

Source Code
    <form action="fileio.php" method="post">
        username:<input name="name" type="text" /> <input type="submit" />
 Now you are probably wondering what in the world is this. Well, I will start with saying it is a form. If you haven't figured that out then i don't know if programmings right for you. What this form does is allows the user to enter a string into a box. Then hit a little submit button. This is appropriate for numerous situations and can be used as a login.

In this codes case it's to check the availability of a username. If it is free, it allows the user to use it.
Another important part of the form is the top where it says

action="fileio.php" method="post"

the action part is when the user clicks the submit button.It will bring them to another page i called fileio.php. I will show the code for that soon. The next important thing is the method="post". This takes whatever the user entered into the text box and transfers it over to the fileio.php page. Now this may be explained poorly and i am sorry if it is. This is how i understand it. So if this is not the case as to what is going on correct me in a comment.  So the user clicks submit after filling out the forms.

Now on to the fileio.php page.

Source Code


$fp = fopen("usernames.txt", "r") or die("Could not open requested file");

$usrname = $_POST['name'];
$used = 0;
while ($str = fgets($fp)) {
    if ($usrname == $str) {
        print ("This username has already been used");
        $used = 1;

if ($used == 0) {
    $fp = fopen("usernames.txt", "a");
    fwrite($fp, "\r\n$usrname");

Okay so we have lots going on here in this code. I will try and touch on all bases.

$fp = fopen("usernames.txt", "r") or die("Could not open requested file");

This line of code has created a variable that points to a file. That file is usernames.txt and the "r" signifies that we have open that file for reading only. fopen stands for file open and takes two parameters a string and what you want to do to the file.

$usrname = $_POST['name'];

Remember that method="post" code from earlier. This is where that comes into play. What ever the user typed into that box is now a string held by the variable $usrname. As far as I know this is the only way to prompt the user for a variable. How neat.

 $used = 0;
while ($str = fgets($fp)) {
    if ($usrname == $str) {
        print ("This username has already been used");
        $used = 1;

Now this big ugly control structure. The variable $used is just there to keep track of whether or not the username has been used already. where it says while( $str = fgets($fp) ). This is a loop, and the condition for that loop is keep looping while there is still a string for use to get from the file.

$str = fgets($fp)

in other words the condition above is using fgets(). fgets() is a function that reads a line from a file. So what is happening is it is reading a line from the file and storing that string into the variable $str. Now this function fgets will keep being called until it finds no more lines left in the file. In this case it will stop running and when this happens the loops stops looping.

if ($usrname == $str) {
        print ("This username has already been used");
        $used = 1;

This line of code is saying hey! if the username is equal to a string already in the file then lets alert the user, change the value of the variable used to one, and then stop the loop by using break. Simply right.
So after this comes an important function for files once they are open.


fclose just closes your file that is opened.  In this case our file pointer $fp which points to usernames.txt.

if ($used == 0) {
    $fp = fopen("usernames.txt", "a");
    fwrite($fp, "\r\n$usrname");

This last piece of code is saying. Hey if the username was not already used. Then lets store it in the file so it can't be used again. We determine if the username has been used already from the while loop statement and by using the variable $used. Also you will notice we are pointing to the same file again. But the difference being this time. We are opening the file for appending. Denoted by "a" in the second parameter.

What is happening here is we have opened the file to add on to the file without erasing anything.

The last line of code we have not seen is

fwrite($fp, "\r\n$usrname");

fwrite() is a function that adds a string to the file. So we are adding the username to the file in this line of code. We are also creating a newline so the username is spaced out among the others.

So hopefully that was not too confusing and I will be adding onto this code as  i progress and get better.

Thursday, 14 April 2011

PHP: Declaring and Printing Variables

So i decided to go ahead and learn how to declare and display my variables in PHP. First thing i noticed is when declaring a variable you do not need to specify what type of data your variable is. Such as an integer, string, character, etc. Which i found really weird, but I got use to it. Next thing i noticed was I had a hard time using \n to create a newline in PHP. Which is a command. I just found it was a syntax error(aka parse error in PHP). But anyhow here is some code I created in order to test some things. Feel free to read the English parts of my code for non programmers. It might amuse you.

Source Code

   <body>Welcome to my PHP Test Page
    <?php /*Declaring and printing variables*/
        $var = 5;
        $name = "Hello World";
        $test = array("Hello","this","is","an","array");

    Testing out, printing declared variables <br />
    printing 5 to the screen from variable <?php print('$var ');?>  <br /><br />
    <?php print("$var");?> <br /><br /> 
    Well that seemed to have worked out nicely, Now wth is the code to print print a newline. <br />
    instead of having to use HTML's "br" to create a new line out of my php scope<br /><br />
    Time to print a string using echo and print command<br />
    <?php echo "$name"; print("   $name   "); ?> <br /><br />
    Time to print an array<br />
    <?php print_r($test); ?><br />
    Well that was really unexpected so much for that command being of any use.<br />
    Maybe i used it wrong oh well time to find another way to print an array.<br />
    <?php for($i = 0; $i<5; $i++){print("$test[$i] ");} ?><br /><br />
    Well that seemed to have worked out a lot nicer. Using a loop and accessing each index of the array was nicer then print_r.<br />
    I think I will end the tests for this blog. Thanks for reading!<br />


End of Source Code

 What is actually displayed here. So you can see what exactly I did. 

Welcome to my PHP Test Page
Testing out, printing declared variables
printing 5 to the screen from variable $var


Well that seemed to have worked out nicely, Now wth is the code to print print a newline.
instead of having to use HTML's "br" to create a new line out of my php scope

Time to print a string using echo and print command
Hello World Hello World

Time to print an array
Array ( [0] => Hello [1] => this [2] => is [3] => an [4] => array )
Well that was really unexpected so much for that command being of any use.
Maybe i used it wrong oh well time to find another way to print an array.
Hello this is an array

Well that seemed to have worked out a lot nicer. Using a loop and accessing each index of the array was nicer then print_r.
I think I will end the tests for this blog. Thanks for reading!

Wednesday, 13 April 2011

PHP Designer 7

So i am done my first year of Computer Science at Lakehead University. I Finished all my exams and feel confident I did good in the classes, that I do not currently have a mark to put with. I finished my computer Programming class with an 87% so I am happy and content with an A mark.  Now that I am done my math exams and I can now talk about other topics regarding more on the programming side of things.

First thing first. I was recommended a nice IDE called PHP Designer 7. For those who do not know what an IDE is.Here is a definition.

Integrated Development Environment. It has visual designer to allow you to put together the user interface visually, editor to let you edit the source code, compiler to compile your source to executable, debugger to debug your programs, etc.

So many IDE's make programming a lot easier and more convenient as it's a one stop shop. So anyhow I am currently teaching myself PHP for the sake of learning the language.

A definition of PHP :

PHP: Hypertext Preprocessor. It is a recursive acronym; the first "P" stands for "PHP," and the first "P" of that stands for "PHP" as well, thus the cycle continues. It originally stood for Personal Home Page, but was renamed when the language fell into common use on the web, at version 3.0

The one thing i find cool about this language is that unlike ordinary web code where you can write it in a text file then change the extension and load it up in your internet to view the outcome. PHP needs some sort of server in order for the code to become visual. Where as if you typed out your code changed the extension and went to view it you would see nothing locally.

This is where PHP Designer 7 comes into play. It allows you to be able to visually see what your code is doing instead of having to set up a server to view it. Which has to be the most iimportant feature of this IDE. So anyhow here is the generic Hello World code in PHP. 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 <!-- Fig. 26.1: first.php -->
  <!-- Our first PHP script -->
      $name = "Hello World"; // declaration
   <html xmlns = "http://www.w3.org/1999/xhtml">
          <title>A simple PHP document</title>
       <body style = "font-size: 2em">
                <!-- print variable name's value -->
               Welcome to PHP, <?php print( "$name" );?>!

This code displays Hello World. Enjoy!

Tuesday, 12 April 2011

Discrete Probability and Probability

So this blog will be about some of my study notes for probability and other things that i need to remember for my exam tomorrow. It will not be as informative for the most part. But it might be able to show you some cool things that math can do.

Binomial Theorem: 

This is helpful for if you want to find the coefficient of a large polynomial really fast. Lets say find the coefficient of

( x + y) ^13 for x^6*y^7. Your probably going to write all of this out which would take forever factoring this equation out. To solve for the coefficient of x^6*y^7. Take a look at the exponent over the factored equation. It is 13. Now look at the exponent over your first variable x. This is 6. So your coefficient for x^6y^7 is the combination of 13 choose 6. Which happens to be 1716.

A combination is usually left in this notation C(13 6).

Pigeon Hole: This is really simple and a great way of solving probability questions. Lets say you have only k boxes(pigeon holes) and n distributable objects. Each object gets on hole. Until there is no more room for an object in a hole, then that object shares a hole with another object. By this principle there must be a box with

roundup( n/k) elements. Where roundup means whatever your answer is round it up. Also known as the roof function.


61 people are in a classroom. Show that at least 6 people in the room share a birthday in the same month.

To break this down we know that there are 12 months.

The  by the formula plug in roundup(61/12) we get exactly 6 elements in one hole. So we know that atleast 6 people in the class share the same month for their birthday.

Indistinguishable Permutations:

Count the number of ways you can re arrange the word "dispose"

The answer is 7!.

Now this does not work for repeating characters. Such as in the word "goodbye" .
Where there is two "o".

The answer for this is the number of characters in the word. Divided by the factorial of the number of repeating characters.

The answer is 7!/2!.

Repetition allowed Combinations:

Giving by the formula:

C( n - 1  r , r)

Example: Suppose we have 10 loonies to give out to 5 children.

Our answer is C(5-1+10 , 10) = C(14 10) = 1001 ways.

Card Problems:

1. How many different 5 card hands can you make with a standard deck of cards.

C(52 5) = 2598960 ways.

2. 5 card hand with only spades. We know there is 13 spades in a deck. So for this just remove every other card and choose from your spade deck of 13 cards.

C(13 5)

3. The number of hands with 3 hearts and 2 diamonds. Split your deck into a deck of 13 hearts and 13 diamonds. Remove all spades and clubs. Pick from each deck appropriately 3 hearts and 2 diamonds. Multiple your combinations together.

C(13 3) * C(13 2)

Fruit Basket problem:

You have a basket with oranges and apples. You can only pick 4 fruit from the basket. How many ways can you pick four fruit.

You can just count them out.

Let O = orange and A = apples.

4O , 4A , 3O1A, 2O2A, 1O3A.

As you can see 5 ways.

Money Troubles:

You have a bag of money with different denominations: $1,2,5,10,20,50,100.

You want to how many ways can you pick 5 bills. We know there is 7 different values of bills in the bag. Using a combination that allows repetition we get

C(7-1+5 , 5 ) = C(11 5) = 462 ways.

Discrete Probability

Possibly my more favorite area of probability.

Must know formula :

P(E) = | E | / |S|   Where P(E) = the probability of an experiment. |E| = event, |S| = sample space


p(of drawing a queen from a standard deck) = |4| / |52| = 1/13. There is only 4 queens in a deck of 52.

If you roll two dice what is the probability that the sum of them add up to 5.

Show the number of ways to add up to five for visual purpose.

|E| = { 2 , 3} ,{3 , 2} , { 1 , 4 } , { 4 , 1 } = 4 ways.

We know that two standard dice have a possibility of 36 outcomes = 6*6.

So 36 is our sample space and 4 is our event. Therefore the answer is

P(sum of 5) = 4/36

Discrete Card Problems

Your dealt 5 cards from a 52 deck.

1. You want to get at least one ace.For this you have to find the hands with atleast one ace and minus it off the hands with no ace.

|E| = C(52 5 ) - C(48 5) <----removed aces from the deck
|S| = C(52 5)

2. You want to get a 4 of a kind. First we need a kind. Which is C(13 1)
Then we need the rest of the kind C(4 4)
Then we need another card from he remaining cards C( 48 5) 
So times these 3 events together to equal |E| and we know our sample space is C(52 5)

[C(13 1)* C(4 4)* C(48 5)] / C(52 5)


Euler circuit: Contains every edge once. Every vertex must have an even degree for one to exist. Must reach the same vertex. As denoted by a circuit.

Euler Path: Must visit every edge exactly once.

Hamilton Circuit: contains at least every vertex exactly once and returns to original as denoted by a circuit.

Hamilton Path: is just visiting every vertex exactly once.

Sequences and Formulas:

Just ways to determine what type of formula you should use.

Geometric: an = ar^n for n>= 0 
Arithmetic an = nd + a for n>=0
Recursion: usually my favourite.

Example: Find a solution to the sequence.

2,  5, 8 , 11, 14, 17, 20 ......

We can visually see this is incrementing by 3.

My solution for this would be

a0 = 2.
an = a(n-1) + 3 for n>=0.

Test it or yourself.

Composition of Relations:

Basically this has transitive properties.


A = { x, y, z} ,  B = { 0, 1} , C = { a, b, c, d}

Let R be a subset of  the product of A to B. Let S be a subset of the product of B to C.

R = { (x, 0) , (y , 1)} , S = { (0 , a), ( l, d)}.

The the Composition of S  and R denoted S o R or R o S is

S o R = R o S = { (x , a ) , (y , d)} You may be able to see how this is transitive.

Monday, 11 April 2011

4th Prestige in Call of Duty: Black ops

 First on a side note. I changed the title of this blog to Programming and Math. This is mainly because of my final exams majority of my content has been about math related content in order to help me study. This content will be mostly about math for a while at least. Until i feel i can post more content like this. Now for the actual post.

So once again i Prestige'd in COD Black Ops. This prestige round this time. I will mostly be using an assault rifle, with extended mag. Any pistol with extended mag. For grenades frag and concussion. Claymore for fun. For perks, lightweight, hardened, hacker. my objective this prestige is to be as big of a meany as possible and shoot people through walls. Shooting people through walls is the most important part of this prestige hence the perk hardened. I have had so much fun today aiming at a wall and just shooting it. Managing to pull of triple kill head shots and such.

Not my favorite prestige emblem. To be honest in game it looks like nothing but a blob. but whatever now I have something to work towards. That is changing it with the 5th prestige emblem.

Sunday, 10 April 2011

Rules of Inference and Basic Proofs

This is a small add-on to this post Propositional Logic and De Morgans Law Knowledge of this post will be required for understanding this post. I am posting this as a hope that i will remember it for my Discrete Math Final Exam.

A rule of inference: is a rule that can be used in proving a theorem or some logic directly and polished.

Addition:  is you just add another proposition onto it using the Logical OR.

p  = 'The sky is blue" 
p v q = "The sky is blue or red"
Simplification: is you just subtract a proposition

p ^ q = 2+2= 4 and grass is green
p = 2+2 = 4

Conjunction: adding two separate propositions together.

p = Grass is green.
q = Rome is in Italy
p^q = "Grass is green and Rome is in Italy".

Modus Ponens: Basically the end result of an implication.

P - > Q = "If I study, then i get an A".
Q = " I studied so i got an A"

Modus Tollens: Basically the opposite of Modus Ponens.

p - > q "If I go to the store, I buy milk"
~p = " I did not go to the store" Which means
~q = " I did not buy milk"

Hypothetical Syllogism: Say this out-loud to sound cool.Visually you can see how this works.

p -> q = "If i study, then i pass."
q - > r = " If i pass then i grad".
p -> r = "If i study then i grad".


p v q = " I will study or eat dinner".
~p v r  "I will not study or go to the party"

 q v r = " I will eat or go to the party"

Disjunctive Syllogism:

p v q = "I will study or I will eat"
~p = " I do not study"
q = "I will eat"

Basic Proofs:

Proofs usually involve implications.

So two ways of solving these can be

Contra-positive: p -> q this is equivalent to ~q - > ~p. So instead of proving p - > q. we test ~p - > ~q to see if this is true. If it is true then we know p - > q is true.


If n + 2 is odd, then n is odd.

Suppose that "if n is even, then n + 2 is even"

let n = 2k for some integer k. n + 2 = 2k + 2 = 2(k+1). Clearly 2(k+1) is divisible by two thus making it even. Therefore since the contra-positive is true then p -> q is true.

Contradiction: This is a little more difficult. We want to prove that. p - > q is true and p -> ~q is true.
If both of them is true we go with the original as being true. For clearly both q and ~q cannot be true.


If n + 2 is odd, then n is odd.

Assume that n is odd. Then n = 2L + 1 for some integer L. So n + 2 = 2L + 3. Which is odd.

Suppose that  If n + 2 is odd, then n is even.

Let n = 2k for some integer k. Then n + 2 = 2k + 2. which means n is even.

Since both is true, clearly if n + 2 is odd then n is odd is true.

Bam, Poison up in yo body!

If you have not heard this yet, or you have and your confused as to where it came from. It is a line that it said in a Sims commercial and it's actually kinda hilarious.

So i decided hey i enjoy hearing this guy talk in the commercial. The things he says is funny.So i decided I'm gonna make a really mediocre remix. So this is what i did. 

Friday, 8 April 2011

Partial Fractions

This technique is very appropriate for integrals when you have some mess of a fraction with no hopes of being able to integrate it nicely.

A partial fraction is just taking any fraction and breaking it up into smaller fractions that can later be added together to make the same original fraction.

The first thing you must do to determine if you can do te partial fraction technique is see if your equation is a candidate for it. To do this you check if the degree of the numerator is less than the denominator. If it is not you have yourself an improper fraction and will need to do long polynomial division. Else you can begin doing the partial fraction technique.

Example of an improper fraction

2x^3 + x^2 -10
-----------------  <----degrees are the same

Now to create your partial fraction:


These are the forms your broken up fraction will either be. These are in a sense your formula.

         A                                                   Bx + C
   --------------                                ----------------------
     ( x-a)^k                                    (x^2 + bx + y)^k

Where a , b, y are some values. Where k is some exponent.

1. If the denominator contains linear fractions. Factor them out.

    5                        5
-----------  =   -----------
x^2+x-6        (x-2)(x+3)

2. Use the formulas and break up your equation appropriately. 

  5                        5                             A                                     B
-----------  =   -----------     =      ------------------   +      ---------------------
x^2+x-6        (x-2)(x+3)                   (x-2)                               (x+3)

3. Multiple both sides by the left
5 = A(x+3) + B(x-2)

4. Takes the roots(the what the x's are) and plug them in to solve for A and B.

x = -3, 2

If x = -3 :    5 = A(0) + B(-5) =  -5B;   B = -1

If x = 2:      5 = A(5) + B(0) = 5A ;   A = 1

5. we have found our A and B. So time to fill in our partial fractions for A and B.

         1                                    -1
------------------   +      ---------------------
     (x-2)                               (x+3)

There you this looks like something you could integrate much easier. Enjoy.

Wednesday, 6 April 2011

C++ Final Exam Cheat Sheet

So last minute my computer science professor decides to email the class. That we are allowed to bring in a one sided cheat sheet. So seeing as my this is my final exam and is worth 42% of my mark in the class. I decided it might be a good idea to create such a sheet full of info for ease. Last time i heard the exam would only have C++ on it and will deal with mostly classes. So i took a look at all my "class" notes and came up with this cheat sheet/program that goes through everything i learned on classes this semester.

The program i created was rewritten extremely compressed and ugly to save space for future material i decide to put on it. At the moment though here is my cheat sheet.

Source Code
#include <iostream>
using namespace std;

class study
    study(){x = 0,y = 0; n++;}
    study(int a, int b);
    void print(void);
    void displayN(void)const;
    friend study change(study obj){ cin>>obj.x; cin>>obj.y; return obj;}
    friend int area(study);
    study& operator+(study);
    study& setX5(void){this->x = 5; return *this;}
    study& sety10(void){this->y = 10; return *this;}
    friend ostream& operator<<(ostream &output, study &obj){output<<"("<<obj.x<<","<<obj.y<<")"<<endl; return output;}//stream overloading friend
    ~study(){x = 0; y=0; if(n!=0){cout<<"Object deconstruction"<<" Objects remaining = "<<n--<<endl;}}
private://methods in here called utility function
    static int n;
    int x;
    int y;
int study::n = 0;

void study::print(void){cout<<x<<endl; cout<<y<<endl;}
void study::displayN(void)const{cout<<"The number of objects created is: "<<n<<endl;}
study::study(int a, int b){ n++; x = a; y = b;}

int area(study obj){ return obj.x*obj.y;}

study& study::operator+(study obj2){this->x = this->x + obj2.x; this->y = this->y + obj2.y; return *this;}

int main()
    study obj1;//x = 0 , y = 0
    study obj2(2,4);//x = 2 , y = 4
    const study obj3(5,4);
    study *obj4 = new study(5,5);
    obj1.print();//output: 0  endl 0
    obj2.print();//output: 2  endl 4
    cout<<"The area of obj2: "<<area(obj2)<<endl;//object from area function gets deconstructed
    obj1 = change(obj1);//x = 6 , y = 5
    obj1 = obj1.operator+(obj2);
    obj1.print();// 8, 9
    obj1 = obj1 + obj2;
    //obj3.print(); won't work because const objs can only use const methods
    obj1.setX5().sety10();//cascading member list
    cout<<obj1<<endl;//use of operator overloading of <<. Method has to be a friend. ostream for output. istream for input.
    delete obj4;
    return 0;

As you can see it is pretty ugly, but should really benefit me in terms of knowing the syntax of certain programing styles/commands.

Tuesday, 5 April 2011

The Area of bounded functions

The Area and Volume of bounded functions: 

This is not the most informative blog, but for those who have a rough idea of whats going on should be able to grasp and understand the examples shown.

Find the area between
y = 2 - x^2 and y = (1/2)x.

from x = 0  to x = 1 .

 Now as seen above we use integration to determine this. Basically you find the integral of the equation shown and solve for the domain of it. Which in this case is  x = 0 to x = 1.

Now the example jumps right to the answer being 17/12. The actual steps behind the seen is

= [ 2x - (x^3 / 3) - (x^2 / 4)] from x = 0 to x = 1

=[ (2(1) - (1^3 / 3) - ( 1^2 / 4) - (2(0) - (0^3)/3 - 0^2 / 4) ]

= [ 2 - 1/3 - 1/4 - 0 - 0 - 0]

= [ 2 - 1/3 - 1/4]

=  [ 6/3 - 1/3 - 1/4]  = [ 5/3 - 1/4] = [20/12 - 3/12] = 17/12 units squared. YAH!

So after these steps we have found the area between these two functions from x = 0 to x  = 1.

Find the area:

y = x^(1/3) , and y = x^3 from x = 0 to x = 2.

First thing we should notice about this is that they intersect at  x= 1. Therefore we need to split this up into two different integrals. One from x = 0 to 1, and the other from x = 1 to 2.


= [ 3/4 x ^(4/3) - 1/4 x ^4] from x = 0 to x = 1

= [ 3/4 (1) ^(4/3) - 1/4 (1) ^4 -  3/4 (0) ^(4/3) - 1/4 (0) ^4

= 3/4 - 1/4 - 0 - 0 = 3/4 - 1/4 = 2/4 = 1/2 YAH!

= [ 3/4 x ^(4/3) - 1/4 x ^4] from x = 1 to x =2

= [ 3/4 (2) ^(4/3) - 1/4 (2) ^4 -  3/4 (2) ^(4/3) - 1/4 (2)^4]

= 4 - 3/2(2)^1/3 - 1/4 - 3/4

= 4.5 - 1.5(2)^1/3

So add up the values of both these integrals to get

. 5 + 4.5 - 1.5(2)^1/3 = 3.11 approximate units squared.

This is how you find the area between two functions bounded.

Sunday, 3 April 2011

Critical Numbers

Critical numbers also know as critical points are numbers that can determine what is happening in the function using derivatives. Now that was poorly explained but i will demonstrate the uses.

Lets  find the critical points of the function f(x) = 3x^5 - 20x^3.

Step 1:

First find the first deriviative of f(x)

d(f(x))/dx = 15x^4 - 60x^2

Step 2:

Now set the derivative to zero

f(x)' = 15x ^4 - 60x^2 = 0

15x^2(x^2-4) = 0

15x^2(x+2)(x-2) = 0

so upon inspection we see that x =  -2 , 0 , 2

These x's are ciritical numbers.

Plugging in these found critical points into f(x) our original function we get

f(-2) = 3(-2)^5 - 20(-2)^3 = 64
f(0) = 3(0)^5 - 20(0)^3 = 0
f(2) = 3(2)^5 - 20(2)^3 = -64

These numbers determine where the function has a local max or local min.


Local Maximum: The point where the function has the high mountain or peak in the local area of the function. Being explained the point where y is equal to  a high point of the function or possibly the highest point.

Local Minimum: The point where the function has a low valley or canyon. where y is equal to a lower point on the graph in the local area.

Both definitions are terrible, but if you graph the function using graphing technology you will know what i am talking about.

  A local maximum and local minimum can be determined if the critical points found from the first derivative are plugged into the function. Such that a

local max can be found if f(x) > 0 . By plugging in the critical points of the first derivative.
local min can be found if f(x) < 0 . By plugging in the critical points of the first derivative.


concavity is just a fancy way of saying does the function at a point start to turn into a mountain or into a  valley. Also known as concave up or down.

To find concavity can be just as easy as finding the local min and max. Finding concavity is also another way of finding the local min and max. So you can really kill two birds with one stone by finding the second derivative. First find the second derivative of f(x).

d^2(f(x))/dx^2 = d(15x^4 - 60x^2)/dx = 60x^3 - 120x

So now all you have to do is plug in the critical points from the first derivative.

f(x)'' = 60x^3 - 120x

f(-2)'' = 60(-2)^3 - 120(-2) = -240
f(0)'' = 0 (which tells us nothing, you'll see why)
f(2)'' = 240

Just like the same way of determining the local min and max. This determines both that and concavity.

local max can be found if f(x)'' < 0 . By plugging in the critical points of the first derivative.
local min can be found if f(x)'' > 0 . By plugging in the critical points of the first derivative.

concave down can be found if f(x)'' > 0 . By plugging in the critical points of the first derivative.
concave up can be found if f(x)'' < 0 . By plugging in the critical points of the first derivative.

We know that the function is concave up at x = 2 and has a local min.
We know that the function is concave down at x = -2 and has a local max.

As far as x  = 0, this does not work for our rule/theorem. 

Absolute extreme values

Not so extreme. In a function there has to be a maximum value and a minimum value of the function. If the function was horizontal on a graph, there would be a tie for y = constant value.

so far we know that

We know that the function is concave up at x = 2 and has a local min.
We know that the function is concave down at x = -2 and has a local max.

 Now to find the absolute max and min. We just need to know where the function is at it's highest and where it is at it's lowest point.

So by comparison of all our values of critical points. We can see that our local min and local max are also are absolute min and absolute max.

Easy right!

Endpoint values:

 This is pretty much the simplest of all simple. Lets say our function f(x) was continuous between the closed interval of  [ -5 , 5]. For the endpoint values all you do is plug in these numbers into your equation.

If  f(5) > f(-5)  then 5 is an endpoint max else 5 is an endpoint min and -5 is an endpoint max.


Point of Inflection

A point of inflection is a point such that the function mirror's itself almost. Such a function is x^2 where a point of inflection is (0,0). You can determine a point of inflection easily. To do this you need to find an x such that the second derivative f(x)'' = 0.

So for our second derivative. A point of inflection can be determined by x = 0.

For f(0)'' =60(0)^3 - 120(0) = 0.

A point of inflection is a point such that ( f(x)'' = 0 , f(x)) this is equivalent to ( 0 , f(0))

Where f(0) = 0.

So our point of inflection is (0, 0). Which from observation of graphing technology makes sense. For the function mirrors itself at that point.

Conclusion : 
Knowing these things can help you sketch a graph of your function or understand what your function is doing at certain points. Making them of importance.

Well hopefully this blog helped you understand Critical points. Also i hope this helped me study for my calculus final exam.

Saturday, 2 April 2011

Intermediate Value Theorem

 Intermediate Value Theorem

If f is continuous on the closed interval [ a , b] and K is any number between f(a) and f(b), then there is at least one number c in the interval such that f(c) = K.

You can use this theorem to determine if a polynomial has at least one real root.

To begin using this we first need to know if

f(a) < 0 < f(b)    or  f(b) < 0 <  f(a)

If either of those cases are true. We know that there is a c in the closed interval such that f(c) = 0.

As an example:

we set f(x) = x^2 - 2. We will now test the function for some closed interval. Lets say [1 , 2]. Then lets test these numbers 1 and 2.

f(1) = -1 < 0 and f(2) = 2 > 0.

Therefore we know by the theorem that there exists a number c in the interval [1 , 2] such that f(c) = 0.

Since f increases on [1 , 2], there is only one such number. This number we can see is the square root of 2.

Friday, 1 April 2011

April Fools Day and my 100th Follower

First of all i would like to mention it is April Fools Day.So to start off this morning for my house. I decided to pull the fire alarm, run into my significant others rooms. Scream Fire at the top of my lungs. Get them running outside half nude. To realize that it's ridiculously cold outside and that i just trolled them. So have fun trolls, play safe.

Also  on a side note Donal is my 100th Follower. His blog is http://songsyoucandanceto.blogspot.com/
At the moment he only has two posts. But damn are they ever songs you can dance to. 

Wednesday, 30 March 2011

Mathematical Induction

Mathematical induction is a method of mathematical proof typically used to establish that a given statement is true of all natural numbers (non-negative integers). It is done by proving that the first statement in the infinite sequence of statements is true, and then proving that if any one statement in the infinite sequence of statements is true, then so is the next one.
- Stolen from http://en.wikipedia.org/wiki/Mathematical_induction

In my own words. Mathematical Induction is the concept of having a ladder that goes on to infinite. If you know that you can reach the first rung. Then odds are you are able to reach the next rung. If you can reach the "n-th rung", then you can touch the "n+1-th rung". 

I will show how this can prove various equations to show that they are true for all values of your variable.


We will prove by Mathematical Induction that the equation 

1+2+...+n = [n(n+1)]/2   is true for all n > 0.

So to start. Let p(n) be the propostion => 1+2+...+n=[n(n+1)]/2

Our objective is to show that p(1) is true(the first value that n can be), and that the conditional statement p(k) implies p(k+1) also denoted as p(k) -> p(k+1), is true for all k > 0.

So we first need to show that the proposition p(n) is true for the very first value of n. In this case 1.
This step is called the Basis step. 

Basis Step: verifying that p(1) is true. As seen by inspection p(1) is true for

1 = [1(1+1)]/2 = 1(2)/2 = 2/2 = 1

Since the basis step is true we move onto the next step called the Inductive step. This is where all the nitty gritty algebra comes into play.

Inductive step: In this step, we assume that p(k) holds for an arbitrary positive integer k. That is we assume that 

1+2+...+k = k(k+1)/2

under this assumption, it must be shown that p(k+1) is true.

To show that p(k+1) is true we first must find what p(k+1) is. 

p(k+1) => 1+2+...+(k+1) = ((k+1)[(k+1)+1]) / 2 = [(k+1)(k+2) ]/2

(k+1)(k+2) / 2 is the equation that we will need to show for our next step . The next step we call the Inductive Hypothesis.

Inductive Hypothesis: This was the hypothesis that if any value of n is true then n+1 must also be true. To show this we write the proposition p(k) as the following.

1+2+...+k+(k+1) = k(k+1)/2 + (k+1)             (we added (k+1) to both sides of this equation)
The idea in this step is to show that the left side can equal the same answer we determined in the Inductive step. 

So as the following working with the left side of the equation.

=   k(k+1)/2  + (k+1) 
=  [  k(k+1) + 2(k+1) ] / 2   (By adding the fractions, the 2 came from the base difference of 1 and 2)

=  [k^2 + k + 2k + 2 ] / 2  (Textbook feels it's unnecessary to skip this step, i find it confusing without)

= [ k^2 + 3k +2 ] / 2 ( By factoring we get)

= [ (k+1)(k+2) ] / 2  (which hopefully looks familiar)

The answer is the same as the Inductive step. Thus proving the hypothesis correct.

So by Mathematical Induction we know that p(n) is true for all positive integers n. That is we have proven that

1+2+...+n = [ n(n+1) ] / 2   for all n>0.   

Tuesday, 29 March 2011

My Halo 3 Dueltage

This a montage that features myself(Annihilate)spelled(AnnihiIate) and my former MLG team mate Beware.
I hope you enjoy.

Sunday, 27 March 2011

Limits and Continuity

Limits are fundamental for both differential and integral calculus. The formal definition of a derivative involves a limit as does the definition of a definite integral.

The limit of a function(if it exists) for some x-value, a is the height  the function gets closer and closer to as x gets closer and closer to a from the left and the right. Lets take a look at what that even means.

The limit of the function f(x) = 3x + 1 as x approaches 2. When writing a limit we denote this as the following equation.

lim f(x) = lim 3x+1.
x->2         x->2

Now for such an easy limit we can plug in the number 2 and solve this limit. Plugging in the 2 we see.

lim f(x) = lim 3(2)+1  = 7
x->2         x->2

 That the limit is 7. So as x approaches 2 from the left and right side. The limit of this function is 7.

 Now your probably think well that's silly. Any function that's continuous you just plug in and solve for x. Now limits are important for functions with holes.

Definition of a Limit:

lim f(x) exists if and only if

x -> a

1. lim f(x) exists
     x->a- (a from the left side)

2. lim f(x) exists, and
    x->a+(a from the right side)

3. lim f(x) = lim f(x)
    x -> a-      x->a+

Number three is the most important.

A function with an infinite limit and vertical asymptotes.

f(x)  = (x+2)(x-5) / (x-3)(x+1) This function has a VA at x = 3, x = -1

So the lim f(x) = lim (3+2)(3-5) / (3-3)(3+1) =  infinity as x will never reach 0 thus it heads closer to 0
           x-> 3-      x->3-

for infinity.

From the right side the limit will be negative infinity. Thus we know by the limit definition that the limit does not exist for x approaches 3.

Definition of Continuity:

A function is continuous at a point x  = a if the following three conditions are satsified.

1.f(a) is defined
2.limf(x) exists and,
    x-> a
3. f(a) = lim f(x)

Limits to Memorize:

lim c = c

lim 1/x = infinity
x-> 0+

lim 1/x = negative infinity
x-> 0-

lim 1/x = 0
x -> infinity(same for both - and + infinity)

lim sin x/x = 1

lim cos x - 1/x =0

lim (1+1/x)^x = e
x -> infinity

Plugging and Chugging Limits:

Any limit where it's continuous and straight forward.

lim (x^2 - 10) = -1
x-> 3

lim 10/x-5= 10/0  if you get an answer that has any numerator thats not zero divided by zero. The limit
x - > 5

does not exist.

Now in the below case if you get 0/0 you have a real limit problem.

lim (x^2 - 25) / (x - 5) = 0/0 which is undefined
x-> 5

undefined is not the limit. This is not the answer we are looking for. Four things we can do to find a limit that is undefined. Calculator, algebra, limit sandwhich, L'Hopitals rule.

I will only show the algebra and L'Hopitals rule. I will not explain L'Hopitals Rule though.

Using algebra to solve for 
lim (x^2-25)/(x-5) we can rewrite this by factoring (x^2 - 5) = (x-5)(x+5) knowing this we can
x-> 5

divide out the (x-5) which leaves us with the equation lim x+5 = 10

Using L'Hoptials Rule

lim (x^2-25)/(x-5) = lim d/dx(x^2 - 25) / d/dx(x-5) = lim 2x = 10.
x-> 5                        x->5                                             x->5



Friday, 25 March 2011

Boolean Operations

In computer science a Boolean is a primitive data type. This data type consists of whether something is True or False. In this blog 1 or 0.
//section (11.1) personal note

The Boolean compliment: 
                                                                 __   __
The negation of  a Boolean. Denoted as  1 or 0.  Spoken as 1(bar) and 0(bar).

 0(bar) = 1
1(bar) = 0

Boolean Addition:

This works exactly like the logical operator OR.

0+0 = 0
0+1= 1
1+0= 1
1+1 =1

Boolean Multiplication:

This works exactly like the logical operator AND.

0*0 = 0
0*1 = 0
1*0 = 0
1*1 = 1

As you can see zeros dominate in any multiplication

 1  *(0+1) = 0 * 1 = 0
(1+1)+(1+0) = 1 + 1 = 1

Wednesday, 23 March 2011

Silly itunes

Ever have one of those itune moments where after closing your itune's. The silly program loads back up. So what do you do. You decide to close it because your done with it. But now it becomes even  more persistent and reloads more rapidly. If anyone has experienced this problem with itunes. You know how ridiculously annoying this is. For those who have not had any experience with this problem. You may read, or choose not to. But for those who have this problem. This is a must read blog.

My hypothesis to this problem. Is that the process may have been initially closed, but a linked process related to the itunes process is still running. Then it realizes hey the itunes process was terminated. But i need it to keep running. So i think i'm going to reload it, to make both myself and the itunes process happy.

From my experience with itunes i noticed one of two things. The process itunes.exe, and ituneshelper.exe are closely related to my hypothesis. It seems that these two processes keep wanting to start up if at least one of them is running. Now you can open up task manager and close the processes right from there. Now i have done this with some success, but not always. It seems to be a hit and miss for myself. So i decided well there has to be a solution or atleast a quick fix. So i don't have to keep closing it every 30 seconds it decides to pop up again.

The solution i call a batch file i named SillyItunes. This batch file forcefully ends the processes from the command line and from my experience with this batch that i just wrote. It stops the random reload of itunes to keep popping up with no hope of ever ending it's cycle.

so copy the below source code into a text file. Then save the text file as a .bat instead of a .txt.

Source Code:


@ echo off
echo "SillyItunes" a program made by DisposedCheese

taskkill /F /T /IM  itunes.exe
taskkill /F /IM ituneshelper.exe
echo I hope that solved the problem
set /p M="Press any key to continue..."


Suggestions can be left as a comment. If you think this program is useless. Well so do i. But i still find it to be an easy solution to an annoying problem. A very handy file to keep on the desktop for your itunes mishaps.

Also i am not responsible if your computer takes a random dump on you after using said program.