PAGES

Thursday, February 2, 2012

New Math & Fibonacci

NEW MATH & FIBONACCI PACES BIG BRAIN In 7th grade, New Math was introduced. I simply did not get it. In an effort to help, my mother took New Math class in the evenings. New Math was so time demanding, she dropped out of class! The next year, New Math was dropped from the school curriculum. I somehow made it past those days and went on to graduate from the university with a degree in Mathematics.

New Math is being introduced to the Big Brain. Don't worry, it's not the old version, but rather a sequence of mathematical applications designed to pace the Big Brain in various ways. The following is a list of potential math applications to run with Propeller chips from which there's an enormous amount of web based information. One area of interest is in the generation of Fibonacci numbers. You can play with these numbers using the Online Generator  or take a look at Bomber's creation of code posted at the Parallax Forum.

Code below. Description quote: "Using a Basic Stamp version of a Fibonacci number generator, I created a Propeller version. It is able to generate Fibonacci numbers up to 1,836,311,903! It is designed to run off of a C3 (using only TV output and an LED hooked up to pin 15). The code can be easily modified to give output to the PST or VGA output. EDIT: Rev 1.4 of code released. The main differencs are as follows: 1) No "magic" numbers  2) Waits for the monitor to 'initalize' (our monitor takes several seconds to realize it is recieving a signal)  3) Increased timing duration. EDIT: Rev 1.5 of code released. Adds a zero at the beginning of the sequence."

List of Big Brain Math Applications &
Numerical Subjects for Development
-------------------------------------------
Derivative calculator
Integral calculator
Definite integrator
Limit calculator
Equation solver
Expression simplifier
Factoring calculator
Expression calculator
Inverse function
Taylor series
Matrix calculator
Matrix arithmetic
Prime numbers
Number factoring
Fibonacci numbers
Bernoulli numbers
Euler numbers
Complex numbers
Factorial calculator
Gamma function
Combinatorial calculator
Fractions calculator
Statistics calculator
Equation editor
Graphing calculator


Program to Calculate Fibonacci Numbers
by Bomber

CON
  _clkmode = xtal1 + pll16x                            ' define clock frequency
  _xinfreq = 5_000_000
  
  CR          = $D                                     ' Carriage Return    
  
OBJ
 time    : "Timing"                                    ' Timing conviences
 TVtxt    : "tv_text"                                  ' Television Display Object

VAR
  long a, b, c                                         ' a and b are the last two numbers in the sequence
                                                       ' c is the new number being added to the end of the sequence.


PUB Main                                  
 TVtxt.start(12)                                       ' Start TV terminal       
 dira [15] := 1                                        ' Enable blinky light
 outa [15] := 1                                        ' Turn off blinky light (active low)   

 TVtxt.out($0)                                         ' Set the text color as on  
 TVtxt.out(0)
    
 a := 1                                                ' Make variable a = 1
 b := 1                                                ' Make variable b = 1


 repeat                                                ' Endless repeat


   a := b                                              ' Make a equal to b 
   b := c                                              ' Make b equal to c   
   c := a + b                                          ' Add a + b (stored in c)


   TVtxt.dec(c)                                        ' Display number
   TVtxt.out(CR)                                       ' Carriage Return
   
   if c == 1836311903                                  ' Prevent sequence from carrying over
     End
     
   time.Pause(250)                                     ' Wait for 1/4 of a second (250ms)
PUB End
  TVtxt.str(string(CR, "END OF COMPUTABLE SEQUENCE"))  ' Display error message
  
 repeat                                                ' Endless repeat
   outa [15] := 0                                      ' Blink LED (P15)
   time.Pause(250)
   outa [15] := 1
   time.Pause(250)