Archive

Posts Tagged ‘david woodford’

Auxiliary Angle Method for Solving Trigonometry Equations

April 19, 2009 2 comments

This is a method of solving equations in the form asinx+bcosx = c where a and b are constants and c is another expression.

It involves rewriting letting asinx + bcosx = rsin(x+y) (or you could use cos(x+y)) where y is acute and then finding values for r and y, then with only one trig function to deal with the equation can be solved more easily.


For example

consider 2sinx + 3cosx = 3

Let 2sinx + 3cosx = rsin(x+y)

Now expand the sin(x+y) to get

2sinx + 3cosx = rsinx cosy + rcosx siny

Since y is constant and therefore cosy and sin y are constant we can compare the coefficients to get

2 = rcosy —–(1)
3 = rsiny ——(2)

We can solve these to find values for r and y.
To find y consider (2)/(1) to get

3/2 = tany
since sin/cos = tan and the r’s cancel
so y = 56.3 °

To find r consider (1)2+(2)2 to get
22+32 = r2
since sin2+cos2 = 1
so r =√13

So we can write

2sinx + 3 cosx = √13 cos(x+56.3) = 3

so x = cos<sup>-1</sup>(3/√13) -56.3

so x = cos-1(3/√13) -56.3

since cos-1(3/√13) = 33.7 for solutions between 0° and 90°

x = ±33.7 -56.3 + 180n where n is an integer


In General

asinx + bcosx = √(a2+b2) sin(x+tan-1(b/a))

If you have any questions, comments or corrections please leave them as a comment below

By David Woodford

Rational and Irrational Numbers

All real numbers are either rational or irrational.

A number x is rational if it can be written in the form a/b where a and b are integers and b≠0 and a number which cant be written in this form is irrational.

Most of the time we deal with rational numbers, for example all the integers are rational as they can be written in the form of themselves over 1, all fractions are obviously rational and also are terminating or repeating decimals. When an irrational number is written out it will appear as an infinite non repeating decimal. Examples of irrational numbers are π (pi) and √2, in fact many square roots are irrational numbers.

Numbers can usually be proved to be irrational by contradiction, by assuming that they are rational and writing them in the form p/q where p and q are co-prime. Then a contradiction is usually produced by showing that they both have common factor other than 1. For example when proving √2 is irrational you can show that p and q must both have a common factor of 2.

There infinitely many rational and irrational numbers, however whilst it is possible to use a method to count all the rational numbers, if you had an infinite amount of time, this cannot be done for the irrational numbers.

Showing a repeating decimal is rational

A repeating decimal can be shown to be rational using the following method:

Consider the repeating decimal x,

Multiply x by 10 n where n is the number of repeating digits
Now subtract x from x10 n to get (10n-1)x
This number will be a finite decimal as all the repeating terms after the decimal point should cancel.
divide through by (10n-1)x to get an expression for x in the form of a fraction.

eg let x = 1/7 = 0.142857142857142857………
then 1000000x = 142857.142857142857………
so 999999x = 142857.0
x=142857/999999
so 1/7 = 142857/999999 therefore 1/7 is rational

if you have any questions, comment or corrections please leave them as a comment below

By David Woodford

How to use Surds – Add, Multiply and Rationalise

Surds are roots to some power (usually square roots) that are left in their “root” form as opposed to being calculated as a decimal. In a way they are the power equivalent of fractions and are used when decimal value of a root isn’t needed, such as in the middle of a calculation, so it is better to leave the result more precisely as a surd.

Surds usually take the form a+b√c where b and c are non-zero

eg) √2
4+2√3

Simplifying Surds

It is easier to deal with surds if you can get the value in the square root to its lowest possible value by taking any square factors outside the root.

For example √50 = √(25×2) = 5√2

To do this I looked for any factors of 50 which are square, eg 25=5×5, can took these outside the square root – when taking a number outside the square root you obviously have to take the square root of the number so when you take out 25 you get a 5 left outside.

So in general

√(a2b) =a√b

This has the benefit of when multiple surds are in a calculation al the surds will be in their lowest terms so they will be easier to group

Adding and Subtracting Surds

Surds can easily be added just by considering then as another variable, so just add up all the coefficients.

eg) 2√3 +6√3 – 3√3 = 5√3

Note– only roots of the same number can be added and subracted in this way, roots of different numbers must be left as they are. This makes it important to simplify all surds as it means you will be able to spot all the surds that can be added or subracted.

eg) 2√3 + 4√5 cannot by simplified

but

3√2 +2√50 = 3√2 +2×5√2=13√2

Multiplying and Dividing Surds

To multiply or divide surds just multiply or divide the values within the roots with each other and the coefficents of the roots with each other. When surds contain roots and non root parts multiply as if they were brackets

eg) 3√2 x 4√5 = 12√10

3√2 ÷ 4√5 = ¾ √(2/5)

(2+4√3) x (3+2√5) = 6 +4√5+12√3+8√15

Note – you may be able to further simplify the surd after you multiply

eg) 2√6 x √3 = 2√18=2×3√2 = 6√2

In general

(a+b√c) x (d + e√f) = ad + ae√f + db√c + be√fc

Rationalising and Conjugates of Surds

When simplifying fractions all surds are usually removed from the bottom. In order to do this both the top and the bottom of the fraction are multiplied by the conjugate of the botom. If there is only a root on the bottom you can simply multiply the top and bottom by the root on the bottom.

The conjugate of a surd is simply the surd with the sign of the coefficient of the root reversed so

a+b√c becomes a-b√c

So to rationalise the fraction

(2+√3)/(3+√4)

we multiply the top and bottom by 3-√4 to get

(3-√4)(2+√3)/(3+√4)(3-√4)

which once the brackets are expanded becomes

(6+3√3-2√4-√12)/5

as the √4 x √4 becomes √16 = 4 and the bottom is the difference of two squares.

By David Woodford

Derive Quadratic Formula

January 28, 2009 13 comments

If you want an explanation on using the formula go to the quadratic formula post (with a downloadable solver)

The quadratic formula,
x=-b +/- sqrt(b*b - 4ac)/2a

for the general equation ax2+bx+c=0

can be derived using the method of “completing the square” as follows.
starting with

ax2+bx+c=0

divide through by a

x2+bx/a+c/a=0

take the c part to the other side

x2+bx/a=-c/a

In order to complete the square we need to add half the coefficient of x (that’s b/2a) squared to both sides so we get

x2+bx/a + b2/4a2=-c/a +b2/4a2

Now we can factorise the left into a squared bracket (you can check this by multiplying it back out)

(x + b/2a)2=-c/a +b2/4a2

So if we square root both sides and take b/2a to the other side we have x on its own

x = -b/2a ±√(-c/a +b2/4a2)

Now to get this in the more traditional form we can take out 1/2a (Which means each term in the root is timesed by 4a2) from the square root to put the whole thing over 2a

x = (-b ±√(b2-4ac))/2a

David Woodford

Matrix Calculator, C++ Program by David Woodford

April 23, 2008 5 comments

Ive been learning c++ and doing matrices in maths as well so I’ve decided to combine to the two in a simple command based program. The basic idea of the program is that it can quickly multiply matrices together and perform reflection and rotation transformations on them. Below is a download of the program and the source code. In the following weeks ill also make some tutorials on doing matrices by hand (click here for my multiplication lesson). Later im hoping to add some more features to it like finding the inverse matrix and the determinate

Download now !!!!!!!!!!

So how to use the program, well first of all type help. This will then display a list of the commands and what they do. When using it type your command, eg mlt, on its own, the program will then ask you to enter which is the first matrix and the second matrix in the multiplication. Every value should have the enter key pressed after its typed.

The program allows up to 10 matrices to be stored in memory plus the answer to the last calculation. They are stored in an array and are given numerical values. The first one you define, using dim, is matrix 0 the second is matrix 1 etc. The answer to the last calculation is matrix 10. When the program ask you which matrix you want to use it is asking you to enter this value for the matrix

Using the let command allows you to give one matrix the value of another. The first matrix number you enter is the one that the values being assigned to, the second is the value thats being assigned. This command is useful if you want to store the answer, after youve done the next calculation, to do this type let, when prompted type matrix that you want to be given the value of the answer and then give the value 10 for the value its being assigned.

Below is the code, i wrote it in visual c++ 2008, for the program. You may have to make changes if you using a diffrent complier to the includes at the top.

Enjoy using, but only to check, note all angles are in degrees recomplie if you want radians.


// matrix.cpp : main project file.

#include “stdafx.h”
#include <iostream>
#include <cmath>
#include <string>
using namespace std;

class mat
{
public:
double mata[20][3];
int lgth;
void dimmat()
{
cout << “enter length of matrix” << endl;
cin >> lgth;
//    cout << “” << endl;

for(int n=0;n<3;n++)
{
cout << “enter values for row” << n << ” , each followed by ‘enter’:” << endl;
for(int m=0;m<lgth;m++)
{
cin >> mata[n][m];
}
}
}

void display()
{
int rcount = 0;
int ccount = 0;

while(rcount < 3)
{
while(ccount < lgth)
{
//cout << “matrix:”<<endl;
cout << mata[rcount][ccount] << ” , “;

ccount++;
}
cout << ‘\n’;
ccount=0;
rcount++;
}
}

/*void rotate()
{
mat mat2;
mat2.dimmat();
mat mat3;
mat3 = mult(this, mat2);
}*/
};

mat mult(mat A, mat B)
{
cout << “multiply started” << endl;

//char pause;

mat ans;
ans.lgth=B.lgth;

int rcount = 0;
int ccount = 0;
int c2 = 0;

while(rcount < 3)
{
//cout << “row: ” << rcount << ” started” << endl;
while(ccount < A.lgth)
{
//cout << “collum: ” << ccount << “started” << endl;

ans.mata[rcount][ccount] = 0;
while(c2 < 3)
{
ans.mata[rcount][ccount] = ans.mata[rcount][ccount] + (A.mata[rcount][c2] * B.mata[c2][ccount]);
c2++;
}
//cout << “value is: ” << ans.mata[rcount][ccount] << endl;
//cin >> pause;
c2=0;
ccount++;
}
ccount=0;
rcount++;
}

int smelly;
ans.display();
return ans;
}

mat rotate(mat A, int angle)
{
mat T;
T.lgth = 3;

mat matans;

//creat transformation matrix
double pi = 3.14159265;
double theta = (angle*pi)/180;
T.mata[0][0] = cos(theta);
T.mata[0][1] = 0 – sin(theta);
T.mata[0][2] = 0;

T.mata[1][0] = sin(theta);
T.mata[1][1] = cos(theta);
T.mata[1][2] = 0;

T.mata[2][0] = 0;
T.mata[2][1] = 0;
T.mata[2][2] = 1;

matans = mult(T, A);
return matans;
}

mat reflect(mat A, int angle)
{
mat matans;
mat T;
T.lgth = 3;
//creat transformation matrix
double pi = 3.14159265;
double theta = (angle*pi)/180;
T.mata[0][0] = cos(2 * theta);
T.mata[0][1] = sin(2 * theta);
T.mata[0][2] = 0;

T.mata[1][0] = sin(2*theta);
T.mata[1][1] = 0 – cos(2*theta);
T.mata[1][2] = 0;

T.mata[2][0] = 0;
T.mata[2][1] = 0;
T.mata[2][2] = 1;

matans = mult(T, A);
return matans;
}

void input()
{
string dim = “dim”;

string com;
int end = 0;

mat matans;
int matcount = 0;
mat mats[11];
while(end == 0)
{
cout << “enter command>”;
getline(cin, com);

if(dim == com)
{
cout << “matrix” << matcount <<endl;
mats[matcount].dimmat();
matcount++;
}
if(com == “rot”)
{
cout << “which matirx?” <<endl;
int matnum;
cin >> matnum;
cout << “what angle (degrees)” << endl;
int rotang;
cin >> rotang;
matans = rotate(mats[matnum], rotang);
mats[10] = matans;
}
if(com == “rlt”)
{
cout << “which matirx?” <<endl;
int matnum;
cin >> matnum;
cout << “what angle (degrees)” << endl;
int rotang;
cin >> rotang;
matans = reflect(mats[matnum], rotang);
mats[10] = matans;
}
if(com == “ans”)
{
matans.display();
}
if(com == “mlt”)
{
cout << “first matrix” << endl;
int mat1;
cin >> mat1;
cout << “second matirx” << endl;
int mat2;
cin >> mat2;

matans = mult(mats[mat1], mats[mat2]);
mats[10] = matans;
}
if(com == “dsp”)
{
cout << “which matirx?” << endl;
int matdsp;
cin >> matdsp;
mats[matdsp].display();
}
if(com == “let”)
{
cout << “which matirx?” << endl;
int mat1;
cin >> mat1;
int mat2;
cout <<“eaqual to (10 is answer matrix)” << endl;
cin >> mat2;
mats[mat1] = mats[mat2];
}
if(com == “help”)
{
cout <<“Davids Woodfords matrix calculator” << endl;
cout << “takes the following commands” << endl;
cout <<” ‘dim’    ::  allows you to dfine a matrix”<< endl;
cout <<” ‘rot’    :: roates a matrix through an agnle” << endl;
cout <<” ‘rlt’    :: reflects a matrix through the line y=tan(a) where a is given” << endl;
cout <<” ‘ans’    :: displays the answer to the last calculation” << endl;
cout <<” ‘mlt’    :: lets u multiply 2 matricies together” << endl;
cout <<” ‘dsp’    :: displays a matrix specified”<<endl;
cout <<” ‘let’    :: allows u to assign one matrix the value of another, eg answer”<<endl;
cout<<“===================================================================”<<endl;
cout <<“matricies are sotred in an array of 10, with numerical values starting at 0″<<endl;
cout<<“matrix 10 is the answer matrix”<<endl;
cout<<“any parameters will be asked for wen needed”<<endl;

}
}

}

int main()
{
cout << “Welcome to David Woodfords Matrix calculator” << endl << endl;
cout<<“type ‘help’ for a list of commands” <<endl;
//    mat mata;
//    mata.dimmat();

/*    mat matb;
matb.dimmat();

mat matans;
matans = mult(mata, matb);
//    mata.display();
*/
//rotate(mata, 30);
input();
return 0;
}

Trevor Pythagoras 08 Download

After a long wait ive just uploaded the most recent version of treovor pythagoras.

download and play Trevor Pythagoras now!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

For those of you who dont know what trevor pythagoras is, its a game which I (David Woodford) have created in my free time about a penguin called trevor. Trevors aim is to collect the triangles without dieing on the spikes or evil fish. The game is made in java and is complied as java application, which means i cant embed it yet.

For the “proper” instuructions go to my last trevor post

Note: the controlls are WASD not arrows

Whats new:

  1. The first thing youll ntice is my lovley start up screen, the trevlaunch file, this is just a verey basic JFrame with a button that iniates the game. The code associated with the button is identical to that in the main method of the game file. You can still run it straight from the game file using the other batch file provided
  2. My amazing background. The game now kind of supports backgrounds, the default is some iceburgs in alska. To change this just edit the background file(its one of the giffs in the img folder) but keep the dimensions the same. The background doesnt quite work as it moves at a different speed but ill sort it sometime
  3. You can finally kill fish!!! If you jump on the fish now you can in theory kill them, the code for this seems a bit 50:50. well 10:90 but it can work. It should work if the fish is directly below you or below and to the side in which your travelling, if you can make it work 100% ill be happy to update the game and give you a mention
  4. Ive still allowed you to create custom levels, to play these use edit and run the other(not play.bat) batch file as you did before
  5. Hmm thats about it. i cant remeber my last upload so there might be some chages i havnt mentioned but their the main ones.

enjoy playing and dont forget to email me changes

trevor@breakingwave.hyperphp.com

http://www.breakingwave.hyperphp.com is my new file sharing site– may it a visit

Proof of Cosine Rule

February 17, 2008 3 comments

Below is the proof by Pythagoras’s theorem of the cosine rule, a2=b2+c2– 2bccosA.

This assumes you understand Pythagoras’s theorem (visit pythagoras’s theorm to view my lesson on it), how to use basic trigonometry(basic trigonometry lesson). If you want to learn how to use the cosine and sine rule, opposed to just learning the proof) visit by sine and cosine rule page.

The proof is done using the letters of the following triangle

Triganometry Trianlge

and we are trying to prove the cosine rule:

a2=b2+c2– 2bccosA

In triangle CBL
a2 = (c-x)2 + h2
a2 = c2 – 2cx + x2 + h2
h2 = a2 -c 2– x2 + 2cx <<EQN1

in triangle CLA
b2 = h2 + x2
h2 = b2 – x2 <<EQN2

eqn1 – eqn2 :: 0 = a2 – c2 – b2 +2cx
a2 = c 2+ b2 – 2cx <<EQN3

in CLA
cosA = x/b
x = bcosA

in eqn3

a2 = c2 + b2 – 2bccosA

 

 

So there is the proof for the cosine rule using pythagorases therom. If you found that usefull try looking at my other maths lessons