Archive

Archive for the ‘Uncategorized’ Category

Factorizing Quadratics

April 16, 2008 1 comment

Factorising quadratics is basically putting them in brackets. In this section we will look at two different ways of factorising quadratics( for simple and complex ones) and when they should be used.

Note/ sometimes a quadratic cannot be factorized using whole numbers, this is when you must use the quadratic equation to find the values of x. See my earlier post and c++ program

Simple type

Use when there is no coefficent of x2

eg)x2+2x-8

start by opening 2 brackets with an x in each
(x )(x )
put the first sign in the first bracket. If the second sign is + put the same sign in both, if its – put the opposite sign in the second bracket
(x+ )(x- )
find the 2 numbers that will add(if both signs in brackets are +) or subtract(if the signs in the brackets are different) to make the middle number(2) and multiply to make the end number(8)
(x+4)(x-2)
and thats your quadratic factorized

Complex Type

Use when there is a coefficent of x2

eg) 8x2-14x-15
Before we can open brackets we need to split up the 14x
8x2 ?x ?x-15
the rule for the signs is the same as in the simple case, put the first sign before the first x term. If the second sign is + put the same sign in both, if its – put the opposite sign before the second x term
8x2-?x+?x-15
we also use the same rule for the to coefficients of x, they must add or subtract to make the middle number(14) but they must times to make the end number times the first(15×8=120)
8x2-20x+6x-15
we then take out the common factor of the first 2 terms(4x)
4x(2x-5) + 6x -15
we use the bracket(2x-5) as the common factor for the second 2 terms and find what we need to multiply by(3)
4x(2x-5)+3(2x-5)
we then take the 2 numbers in front of the brackets(4x and 3) as our second bracket
(4x+3)(2x-5)
and there we have a fully factorized quadratic

Area And Circumference of a Circle : pi

March 2, 2008 58 comments

This site is now at www.breakingwave.co.nr

This is a basic guide to using pi to find the area and circumference of a circle using pi. And also explores why pi makes our formulae work.

Circle radius and circumference

area =πr2

circumference = 2πr or πd

where r = radius and d=diameter

Area

First lets look at the area of a circle, given by area =πr2. This is simple enough to use, we multiply the radius by itself and then by pi.
Does this make sense?
Well r squared is at least going to be an area but it might be a bit small so we multipy by pi. However this doesn’t explain much until we consider what pi is, the easiest way i find to do this is as follows
If we imagine a square that the circle fits inside perfectly(so it touches all four sides like the one above) r squared would give us one quadrant, so the area of that square is 4 x r2 . Of course the circle’s area is a bit smaller so we need to find the ratio between the areas of the square and circle. If we then times this value by four we have a magic constant to multiply r squared by to find the area of a circle (we times by four because we need the area of 4 quadrants and r squared gives us one).
Now this magic constant is pi (which makes sense being just over 3, meaning the area of the circle is just over 3/4 of the area of the square).
Circumference
The circumference of a circle is given by 2πr or πd. This seems simple, we just multiply the diameter (2r) by our magic constant pi.
Does this also make sense?
seeing as we only have one r this time so only one length it seems we are just finding a factor to increase the length by to make a different length(the circumference) which makes sense.
Again lets consider the square into which our circle fits perfectly, the perimeter of this square would be 4 time the length of one of the sides.
Now the length of the sides = the diameter so the perimeter is 4d.
Notice again that the value we are trying to find for the square is multiplied by 4, but for a circle were going to need a ratio that is a bit smaller.
So we need to replace the 4, for a square, with another, smaller, number — it seems pi will do the job.
Conclusion
To me when I consider pi I don’t look at it as a magical fundamental constant, but more a magical fundamental constant multiplied by four, because when I consider how these formula work using pi this is how they seem to work.
So this new constant is really the ratio of
area of square to area of circle
perimeter of square to circumference of circle.
and it = pi/4 = 0.785398….
so if you have a value for a square and you want a similar value for the circle you just need to multiply it by this number and you’ll have your answer 🙂
I welcome comments, improvements or errors in this post. Please leave your comments below or email me at david.woodford.4@googlemail.com
thanks

By David Woodford

Quadratic Formula

February 24, 2008 9 comments

The quadratic formula is a quick(unless you can factorise) way of solving quadratic equations. You basically take the coefficient’s of x, x2 and numbers, put then in the formula, work out the two answers and have your 2 solutions of x. And if that wasn’t easy enough written a console program in c++ that will solve them for you(and gives dodgy answers for complex solution ie) imaginary answers when there are no real roots.

so for the general quadratic
ax2+bx+c=0

qdrtc2.gif


So what do you do, well enter a, b and c from the general equation into the formula, work out the answers and they are your solutions.

Whats the plus/minus thingy. You might be wondering what the thing is after the -b, well its a plus or minus sign. Because when you work out a square root it can have to answers, eg)root 9 = +3 and -3, he formula takes this into account by saying you must use the plus and the minus answers. This therefore means you will be 2 solutions to the quadratic, which makes sense as the graph is a curve and it therefore must cut the x-axis twice.

When the root part is negative(before you find the root) there are no real roots, only complex ones. This means that the curve comes down above the x-axis and doesn’t cut it. If you work out the complex roots, using i for root(-1), your pair of answers will be a conjugate pair.

David Woodfords Quadratic Calculator
This is a console program that i wrote in c++ that will solve a quadratic for you. Just download the file and run it, follow the instructions and it will output the 2 answers for you. I tried to make it work for complex roots as well but somewhere in the decimal data types Ive messed up so only the second parts of the complex answers are correct – though im sure working out -b/2a isn’t too hard for you.
Download quadratic calculator


Other posts relating to the quadratic formula

Trevor Changes

February 20, 2008 Leave a comment

Its been a while since i last made some updates to trevor so i have. Ive also included to new levels in the download, although there some digging to do if you want to play the previous levels(there stored as a complied subclass of level, not as a text file in the levels folder).

DOWNLOAD

So what are the changes?

well really only that i have made the movement of trevor much smoother. On the first versions the screen was repainted evrey time the main game loop was run. This meant it could only move one block per frame, making the animation verey jumpy. Now ive made it so that it is repainted 4 times for evrey block he moves, so he moves 5px per frame at 10 frames a second, so the motion looks verey smooth.

Becuase people found the “simple to use” level design method to hard!!!!!!! ive made it even simpler. When your level is read in the borders are automatically added, so all you have to do is make sure your level isnt more than 19 lines high and 59 accorss and add and blank line and then end at the end. Simple!!!

Ive included 2 new levels for you to play. Just change the play.bat file so that it pass the game the level you want to plays file name as a parameter.

Happy trevoring. You can also visit the trevor section my site www.breakingwave.co.nr/computing/trevor/intro.htm

TREVOR PYTHAGORAS + C >> download update

February 7, 2008 Leave a comment

The latest version of trevor is now downloadable. I have made quite a few improvements to it since last time 🙂 and ive made a new level. To download click below, all posts on this blog also have a download on the left or from my site(www.breakingwave.co.nr — ull need to navigate away from the home page to see the trevor link in the nave bar)

DOWNLOAD

 

Whats new?

  • Trevors motion is much smoother. Ive added in frame between each execution loop so the motion appears smooth and less like hes jumping around
  • A scrolling screen. This means the screen follows trevor around the level, displaying 20 blocks either side, opposed to displaying the whole level. This allows much larger levels to be created
  • A text file reader allowing you to write your own levels for trevor in a text file with no knowledge of codeing 🙂

How to create you own level

After downloading trevor you can create your own levels, just follow the simple steps below

  1. Open up a plain text editor – like note pad found in accessories
  2. Each chracter in the file represents a object in the game.
  3. once you have produced you level design leave a blank line and then on the next line type “end”
  4. save you level in the levels folder of trevor
  5. edit the play.bat file to have the name of your level instead of test.lev — rember to put in the file extenstion(probably .txt)
  6. run play.bat

so how do i create objects?

The level can be 59 objects wide(so 59 characters across) and 19 high (so on 19 rows). For an empty space use any key other than the ones specified below. You will need to build a floor and walls using the ground object else the game will crash when trevor leaves the games area (you may also need a ceiling)

object codes:

ground — g
triangle — t
evil fish — >
spikes — s
spring — ^
heart — h
exit — e Note: when using exit it takes up a square of 9 objects referenced from the top left so make sure there is nothing 3 objects to the right and down

Note Trevor starts at around object 3 across 4 down ish

MOST IMPORTANTLY ENJOY >> for more trevorness visit my site www.breakingwave.co.nr

3 Clubs and Mills Mess Juggling Tutrials

February 2, 2008 Leave a comment

HI, ive just uploaded 2 new juggling tutorials to my Youtube account , thse are Mills mess and Juggling

Clubs. These are to go with my written tutorials on this blog as well as on my site (www.breakingwave.co.nr)

Any way here they are

Probablity of a Miracle = 0.149 :: the mathmatical proof

January 28, 2008 Leave a comment

Below is a mathematical proof that miracles can occur and a calculation of their probability.

any finite number divided by 0 = infinite

so 3 / 0 = infinite

which can be rearranged so

0 x infinite = 3

if a miracle is defined as something with probability 0 (ie it is impossible and would require divine intervention to occur) and we assume the universe is infinite in either time or space or both.

the expected number of success of n trials is the number of trials x the probability of success (eg if you threw a dice 12 times you’d expect 2 sixes). So if the universe is infinite then there are infinite trials and if a miracle if a miracle has probability 0 the expected number of miracle = infinite x 0 and as shown above this equals 3.

so to recap

3/0 = infinite

so 0 x infinite = 3

p(miracle) = 0

E(miracle) = n p = 0 x infinite = 3

so in all of time and space 3 miracles are expected. However as any finite number divided by 0 = infinite then all we can say is that in all of infinite time and space a finite number of miracles are expected.

From this we can calculate the probability of one miracle occurring using the poission distribution

if X = number of miracles

X ~ Po(3) as above

P(X = 1) = (e-331)/1! = 0.0498 x 3 = 0.149

So there you go, when the universe is infinite

The probability of a  single miracle is 0.149

or

P(miracle) = 0.149