Wednesday, June 20, 2012

QBasic 64 : You’re Gonna Get It! IF THEN Statement

The IF-THEN-ELSE statement is called growing up as children (even some adults) are programmed into becoming human beings. This is a computer statement which involves true-false logic just like real life.  Even the smallest child quickly learns the logic of this programming statement.

IF it’s true you do something wrong THEN there will be consequences ELSE it’s false you did not do anything wrong there will be different consequences, END IF.  

IF you put that ice cream in your mouth THEN

you’re gonna be in big trouble young man    {if TRUE something happens}

ELSE

            you will not be in trouble     {if FALSE, something else will happen}

ENDIF


In our first program, we entered to numbers, guessed at the answer and we will use the If-Then statement to test the results with the correct answer.

INPUT:  Num1 = First numbered inputted
               Num2 = Second number inputted
               Ans = Our guess for the correct answer

PROCESS:

Corr = Num1 * Num2

IF Ans = Corr THEN

            PRINT “ You are correct”
ELSE
                        PRINT ”You’re a Moron”
END IF


Family Guy - I Want Ice Cream posted by huluDotCom.

QBasic 64 : Arithmetic Stuff

Mine! Mine! Mine! It’s my stuff.  Infants and even seagulls  intuitively learn how to count by tracking and accounting for their stuff.  Arithmetic was invented to keep track of stuff.



Children are delighted when they increase or add to their stuff.  It is no wonder addition was the first arithmetic operation to be created.  In QBasic the addition symbol is “+”

Children are sad when they have to give up or subtract their stuff.  In QBasic the subtraction symbol is “-“.

Happy days are here again when children learn multiplication  is a form of accelerated addition.  In QBasic the “*” is the symbol for multiplication.

Another sad event is when we have to give up or divide stuff.  Think of multiplication in reverse.   
In QBasic the “/” is the symbol for multiplication. 

Examples of QBasic arithmetic would be:

Num1 + Num2 = Ans1
Ans – Corr = Diff1
Num 1 * Num2 = Prod1
Prod1 / Num2 = Quot1
  
These are the four basic arithmetic operators in QBasic.



Mine mine mine (Finding Nemo) posted by as0k
George Carlin Talks About "Stuff" posted by CappyNJ

Tuesday, June 19, 2012

The Number Family

The number family is large a collection of numbers, actually an infinite collection numbers.  Some numbers  are prime while the majority are composites of other numbers.  Every family has it’s negative members but they are usually offset by the positive members.  There is only one zero in the family it is neither negative or positive.  

The earliest numbers were simple whole counting numbers.  Some people call them the natural numbers but there was nothing natural about zero which didn’t come into use in Western mathematics until about 1200 AD.  Are the un-natural numbers zombie numbers, vampire numbers or invisible numbers?

The un-natural numbers are a little complicated to conceptualize. They are real numbers and can be very rational at times and irrational at other times.  Integers are whole numbers which can be positive, negative or zero.  (In QBasic we can define variables as integer numbers.)

Rational numbers are really ratio-nal numbers because they can be expressed as a ratio of integers and do not have a denominator of zero, ¼, 7/27, or 5/1.  Rational number can also be divided and expressed as decimals although some quotients result in very annoying repeating decimals which go repeating for infinity and beyond but are predictable. (In QBasic we define non-integer numeric variables as floating numbers.)

Most disturbing are the irrational numbers.  The most famous irrational number is pi or for really hungry people, pie.  Pi is a mathematical constant of the ratio of a circle’s circumference to its diameter.  The quotients of irrational numbers do not repeat but go on forever and ever like fairy tales.

The discovery of irrational numbers was not a fairy tale.  The Greek philosopher Hippasus is believed to have discovered irrational numbers in the 5th century BC when tying to compute the square root of the number two.  Pythagoras  (yes, from the famous theorem a^2+b^2=c^2 where “^” is exponentiation in QBasic) and his Pythagorean School did not believe in irrational numbers.  Rumor has the Godfather of the Pythagorean gang was very upset with Hippasus who ended up sleeping with the fishes. 



There is a conspiracy theory Hippasus was drowned in the ocean for revealing the existence of irrational numbers.  When programming in computers, keep your mind open for all possibilities. Some people believe Humpty Dumpty did not fall off the wall, he was pushed.  



“The Godfather - Luca Brasi Sleeps with the Fishes” - Posted by TheFilmSpectrum.
“Humpty dumpty was pushed” – Posted by FAproduckshins



Saturday, June 16, 2012

QBasic 64 : INPUT Statement





Every school age kid is an expert at the input statement.  The most familiar input statement in the world is the Google search box.  INPUT the string (characters) you want to search then press enter.  The same is true for YouTube and other search engines.  It wasn’t always this easy to get input or data in to computers.

In the old days, image if you had to handwrite your internet search request to Google unto a special columnar input coding sheet.  Then you would have to give this sheet to a keypunch person who would use a keypunch machine to physically punch holes in a punch card.  They would give you back a report with the punched card of what they keypunched.  After you very carefully reviewed this, if correct, you would give it to a computer operator who would run your card through a computer punch card reader.  Depending on the jobs running on the system, maybe in about an hour or two possibly the next day, you would receive a report of Google search findings.
We have evolved from punch cards, to keyboards, to a mice, optical recognition, to slide and touch and even voice activated input.        

Below is a video of an ancient keypunch machine posted by ct1401:


Below is the sounds of a punch card reader created in Minecraft posted by ohmgane3sha:



In our programming, input is simple. Ask what you want and assign the input to a predefined variable.

 INPUT “Let’s multiply, what is your name”; Name
 INPUT “Enter a whole number”; Num1
 INPUT “Enter another whole number”; Num2
 INPUT “What is the product of these two numbers”; Ans

“A keyboard, how quaint” as Scotty from the future tries to use one, posted by movieclips:

Wednesday, June 13, 2012

A Lot of Something About Nothing - Zero


Most people are familiar with Roman numeral counting such as I, II, III, IV, V… representing our number of 1,2,3,4,5……

So then, what is the Roman numeral for zero?

There is no Roman numeral for zero as zero did not come into play into Western mathematics until about 1200 A.D.  The ancients did not really require the use of zero in their arithmetic.

Although zero is nothing, our mathematics is nothing without it.

The divisibility rule for zero is undefined.  Try dividing a number on your electronic calculator or in a computer program and it will return an error code.  Undefined is a term used when mathematicians have problems explaining a concept.  

Below is an interesting video “Zero and One” posted by TheAlexmeister:


For a historical perspective, the “Math Movie Zero” posted by SpookyKat4 provided different insight:

Tuesday, June 12, 2012

QBasic 64 : DIM Statement


Kids sometimes say, “I call dibs on it”  meaning they want to be first in line or are claiming a priority over something or somebody.  Also known as “I call front seat!”

In QBasic64 we don’t call this idea dibs we call it DIM.  DIM is used to define and claim variables.  People don’t like messy surprises and neither do computers.  To minimize programming surprises, you need to define variables to give the computer a heads-up of what you will be doing with data. 

For example, if you plan on working with data, you need to give names to your variables such as num1, num2 ,x, y, z, Bob or Mr.Jingles. You usually name variables that are easy for you to remember.  However, QBasic does have a few rules about how you name a variable, for example, the name can contain only letters and digits.  You cannot use a QBasic reserved word.

That’s right, QBasic calls dibs on a lot of words such as PRINT, CLS and DIM so you can’t use those as variables.  They are generally commands and functions of the QBasic language.

But wait, there’s more, not only do you get to name variables, you get to define them.  There are two basic data types, numbers and characters.  If you’re working with whole numbers, maybe define your variable as INTEGER.  If you’re working with or characters (text) define your variables as STRING.   

DIM Num1 AS INTEGER
DIM Num2 AS INTEGER

DIM Ans AS INTEGER
DIM Corr AS INTEGER

DIM x as STRING 
DIM MrJingles as STRING

Make sure your variables blend with your data and program logic otherwise you will learn the complier will let you know in no uncertain terms. 




“Will it Blend on a Dibs CommercialWill it Blend on a Dibs Commercial” posted by ntbreaththis.

Monday, June 11, 2012

You Can’t Handle The Truth: Ten

Children are most familiar with ten as the base of the decimal number system we commonly use in our mathematics. 

Scientists, mathematicians, anthropologists, sociologists, historians and philosophers all tend to agree we use base ten as our number  system because humans have ten fingers or digits. Really? They are in denial.  You want answers?  Do you really want me to answer the question why we use base ten?  You think you’re entitled to the truth?  You can’t handle the truth!



The truth of why we use base ten is stinky feet.  Humans have twenty digits, on two hands and two feet.  Why not use the digits on our toes for advanced counting?  You would double the size of your number system with a base twenty system. 

However, people of the ancient past stepped in a lot of doo-doo and other nasty stuff.  Even the most primitive people wore shoes of some type so not only did their feet smell but it was a hassle taking on and off your shoes every time you had a number ( >=  ) greater than or equal to eleven to manipulate in a calculation.  This is one reason why humans invented the abacus, so they didn’t have to use their toes for counting.  The abacus was the first computer made of wood.

It was the most decent act of human kindness to our noses use ten the base of our number system.  The divisibility rules for then are simple.  If a number ends in zero, it is divisible by ten.




Classic Movie Line #15” posted by DiNap44. “funny commercial ! (stinky feet)” posted by seknight86.

QBasic 64 : CLS Statement

In computer programming you do a lot of housekeeping.

Stuff can quickly get cluttered in the computer memory which can create programming disasters and nightmares.   Stuff can get cluttered on the display screen or on printed mediums.  Think of housekeeping as logical organization of stuff and computer code.

The command to keep display output nice and clean is the CLS statement or command. The CLS clears a display screen for new data to be displayed.  A two line computer program:

CLS
PRINT “Don’t be lazy and stupid in your computer housekeeping.”

If you aren’t good at housekeeping you will spend a lot of time cleaning up and debugging computer programs which can get ugly. 




Video posted by efyoo2.

Sunday, June 10, 2012

Love Potion Number Nine

There’s something magical about the counting numbers, 1,2,3,5…

They are whole numbers and almost seem natural to us.  Did you ever notice almost everything we enumerate are whole numbers.  You never see sports jerseys with numbers such as 3.2, 9.8,  4 and one fourth, 50% or the square root of sixteen.  My favorite sport jersey numbers are three (Anthony Paultanis), six (Al Kaline) and nine (Gordie Howe).

The barcodes (UPC or Universal Product Code) you see on almost every product you can buy at a store are whole numbers.  Vehicle license plates displayed on the back of cars and your social security numbers are whole numbers.  Home addresses and locker numbers in school are whole numbers.

The last single digit counting number is nine.  Nine is a composite number with factors of three.  The divisibility rule for nine is similar to three.  Add the digits of the number and if it is divisible by nine the entire number is divisible by nine.

In the very olden days, “Love potion number nine” by the searchers was a hit posted by barbieaslenkho. 



I think the greatest athlete to wear the number nine on a sports jersey was Gordie Howe of the Detroit Red Wings hockey team.  Nicked named “Popeye” by his teams mates for his muscular build, he went on to play for other hockey expansion teams in Houston and Hartford.  He played hockey with his sons and retired from professional hockey at the age of fifty-two.  I watched Gordie Howe in many games.  When he took a hit from someone, he didn’t retaliate right away.  He would “take your number” and cream that player later in the game.  When he went into the hospital for minor surgery, everyone in the National Hockey League thought he was going in to get his elbows sharpened.  A video posted by NYIandersFan21.


Friday, June 8, 2012

QBasic 64: Print Statement


Printing is a process of communicating information and ideas via output, usually text, numbers, images and data.

In southwestern France during World War II, four teenage boys and their dog Robot were seeking treasure when they stumbled upon a cave containing prehistoric painting on the wall in a series of caves.  These painting are believed to be about 18,000 years old. 

This is one of the earliest forms of “printing” in human history.  If you dare, take the virtual tour by clicking on the link below:


With verbal language came written language.  Written language used paper to communicate ideas and knowledge for thousands of years but books were laboriously copied by hand.  Human art such as painitings were a visual form of sharing ideas and information. In the 15th Century, Johannes Gutenberg created a printing press with movable type and initiated a revolution in the sharing of information.

In the 1800’s, typewriters were being invented.  The organization of the keyboard of your laptop are a vestige of the typewriter.  The letters are organized so that the hammers of the letters of the typewriter would not jam into each other while typing.


In the 1900’s, teletype machines were being invented.  You might recognized a teletype machine as a forerunner of computer printers.  Below is a video of a teletype machine posted by westernelectric:



In the 1980’s, microcomputers with word processing software and early matrix printers began to replace typewriters which are rare to see today.  The invention of television and computer monitors began to share information and data on screens.  More and more information is not being printed out on paper but rather stored in data files such as Portable Document Format (PDF) and other storage mediums.  We are approaching the point where all the books, papers, and images humans ever created can be stored on a single computer chip.

Print has come a long way. You are now ready to write you first computer program.  The syntax for the PRINT statement in QBasic64 is:

Print expression-list

Print “write something obnoxious”.   For example: Print “Hello Morons!”

This will display your message on the display screen of your laptop when you run and execute this one line program.

Byte Me!

In early personal computers, eight was and still is a magic number . It is a composite number and it is the cube of two: 2 x 2 x 2 =8 or two raised to the third power.
                                   

You see and use bytes all the time.  The file is fifty kilobytes or there is three gigabytes of memory on my memory stick or you have a gigabyte of random access memory(RAM).

A byte is a unit of data eight binary digits (0,1) long that represent a character such as a letter, number or symbol.  Bytes can from combinations of 256 characters which form our alphabet, numbers and special symbols.  Yes, two raised to the 8th power is 256. (2x2x2x2x2x2x2x2=256)

Byte are used to measure random access memory in computer.  In 1969, one of the most powerful computers had a RAM of four kilobytes that launched men into space sending them to the moon.

Today’s kids have two gigabytes or RAM and they are lost in space playing on computers Minecraft or Facebook.  With all the time kids spend on computers, parents would like to send them to the moon.

The divisibility rule for eight is if the last three digits are divisible by eight, the entire number is divisible by eight. Well, use a calculator. 

Below is a video posted by WOODSYMAN which a good introduction to bytes:   



Since you are working on electronic projects using circuit boards, this video gives a little different perspective about the flow of electricity.  Posted by KarBytes:


Thursday, June 7, 2012

Sieben Zwerges

Snow White and the seven dwarfs.  Heigh -ho. Heigh-ho, it’s off to work we go. Seven is a prime number but you’ll need to work to figure out if a number is divisible by seven.



Here is the rule, take the last digit in a number.  (a) Double that number then (b)subtract the doubled number from the rest of the digits.  (c) If that number is divisible by seven then the entire number is divisible by seven.

For example,  672: a) 2*2=4     b) 67-4=63     c) 63/9=7  okay
                      357: a) 7*2=14   b) 35-14=21   c) 21/3=7  okay

This is a technique you’ll need if you’re ever stuck on a deserted island in the middle of some ocean,  if there a thermonuclear holocaust which wipes out civilization as we know it or if you are taking a manual math test. Otherwise, since you live in the 21st Century, just use a calculator.

Schneewitchen und die sieben Zwerge posted by lemmatt:

Wednesday, June 6, 2012

The Original Six

Six is an even composite number with prime factors of two and three.

The divisibility rule for six is if a number is divisible by two AND three it is divisible by six.

Tomorrow night may be the end of the Stanley Cup Series if Los Angeles Kings wins the series 4-0 against the New Jersey Devils. 

The original six NHL teams were Detroit, Chicago, New York, Boston, Toronto and Montreal.  These teams played black and blue hockey for very tough men.  They didn’t wear helmets and goalies didn’t wear masks.  There were like dinosaurs compared to today’s players, slow but tough.     

Six was a big number in Detroit during the 1960’s because it was worn by Al Kaline, a hall of fame right fielder for the Detroit Tigers baseball team. 

“Baseball Hall of Fame - Biographies: Al Kaline” posted by TheBaseballHall:


Tuesday, June 5, 2012

Give Me Five

Give me five….five what?  Five donuts, five cookies or maybe five digits of another person’s representing a “hand shake” which is an American idiomatic greeting.  This is an example of the counting number or natural numbers, one ,two, three, four, five and so forth.


High Five Etiquette is very important and the following video is required viewing at the Tourettes Monkey Academy. 



(Video posted by dontbethatguyfilms)

Five is a prime number and a favorite among children with five digits on their hand.  Five and ten are the easiest numbers for human children to process especially for multiplication and division.  Do you wonder why humans use base ten (decimal system) as their number system?

Tourettes Monkey has no fingers but only two arms.  His favorite numbers are one and two.  He tends to think in base two number systems as do computer processors.  Here is a bit of knowledge, a computer is only a super fast switch whose millions of circuits are either on or off.    

The divisibility rules for five are easy.  If the number t ends in five or zero, it is divisible by 5.

Four Dimensions

Four is the first composite number.  Four and two are good friends.  Two times two is four.  Two is a factor of four.  Two plus two is four.  Two squared is four.


For the ancients there were four elements, fire, air, water and earth.

We live in a four dimensional universe that appears to be three dimensional.  The is up, down and sideways, or X,Y and Z. 


Einstein considered time a fourth component of dimension.  Even though we cannot see time we sense know we are moving through time and space.

When you think of the divisibility rules for four just remember fours best friend two.  If the last two digits of a number is divisible by four, the entire number is divisible by four. 

Monday, June 4, 2012

Three: Getting Crowded

The number three is three times the number one.

Two is company but three’s a crowd.

Not that two is romantically in love with one or one is romantically in love with two.  One, two and three are the Three Amigos of Prime Numbers.  It is the first and last time you will see three consecutive prime numbers.


With three things gets complicated.  To determine if a number is divisible by three you need to add all the digits in the number to obtain the sum.  If the sum is divisible by three, that number is divisible by three. 

The Three Amigos Salute should be learned by all school children. (Posted by antonioorlandojr)


Sunday, June 3, 2012

Two: Double Your Pleasure

The number two is double or twice the number one.

Two is the first even number and that make two a big shot in the world of even numbers.  Every even number is a composite number of two and is divisible by two.  In other words, two is the only even prime number.


If the last digit of a number is even, it is divisible by two. 

Two is usually easy to multiply.  Two is almost as popular as one.

For whatever reason, two is a big number for people on earth.  Humans have two legs, two arms,  two eyes and two ears. Since we have only one mouth but two ears, maybe listening is more important than talking.

“Here’s tip you’ll appreciate, it pays to have a smile that’s bright that make you look bright and make you feel just right….Double you pleasure, double your fun”....but for God’s sake, brush your teeth twice a day.

Video post by Videos78rpm:


Saturday, June 2, 2012

One Is The Loneliest Number

It is the only one, the first one, the most famous one, the number one.  True that one is the first odd number but it makes one the ultimate prime number.    

Loved by children because it is easy to multiply and divide. It has a special property that is easy to understand.  Children cherish the identity property because any number times one is the same number.  Any number divided by one is the same number.  Easy…

Yet, most students in mathematics don’t recognize one when they see it.  One is a master of disguises. For this reason, the number one has undergone extensive psycho-therapy because children do not really understand one.   One is used extensively to manipulate fractions or has one calls fractions, mini me’s.

One can appear to small such as 2/2,  20/20 or very large 1,000,000,000/1,000,000,000 but they are just one.  One can be used to add and subtract fractions and simplify  fractions because one hates complicated fractions. One can be used to manipulate equations.

One is the most versatile number of all the numbers but the most misunderstood.  This make one the loneliest number.  

“One Is The Loneliest Number - Three Dog Night (Lyrics)” Posted by xxdaydreamerxx11:


Introduction

He's coming......