Tuesday, August 31, 2010

what is a quadrilateral

what is a quadrilateral

Introduction about learning quadrilaterals:A flat shape with four sides. A quadrilateral is a polygon with four 'side' or edges and four vertices's or corners. The sum of its four angles equals 360 degree. In this article we can learn properties of all quadrilateral.types of quadrilaterals:

types of quadrilaterals

A Small Favor Text + Video Walkthrough

Walkthrough, Thanks to Newgrounds, Tass, and Alan:



Second Locker Number: 1977

Kongregate Fission Mailed Badge:
All you need to do for the Fission Mailed is get the green vial, kill Milos, turn the green vial into a bomb, kill the Worm then return to the train area.

Alan's Super Quick Finish! All in 1 Text Walkthrough:
*Sigh* After writing for 15 minutes, I decided to watch Tassel's walkthrough and he did everything I wrote so I decided to not finish it.

Text Walkthrough from Newgrounds.com:
Round One
The Apartment

* Get the gun
* Charge it in the power generator
* Get the cigar

The Apartment Hallway

* Give cigar to the Insect Trader
* Get green hose

Outside the Apartment

* Click the metal ground switch to turn the water on.
* Walk Right

The Big Rock

* Walk right

The Blue Cactus

* Select your hose and drag it to faucet with running water
* Fountain will overflow and reveal secret hatch
* Enter hatch

The Worm's Lair

* Get objective to ELIMINATE MILOS
* Walk back to Transit entrance

Transit Entrance

* Click machine to de-activate gun.
* Enter Transit Lobby
Transit Lobby

* Click the alarm to move s! ecurity robot.
* Walk Left

Transit Waiting room

* Click garbage to get bottle
* Walk Right

Transit Lobby

* Talk to the Transit trader
* Trade bottle for red plug adapter.
* Observe Transit symbol - note whether it's showing a triangle, square or circle.
* Walk Left

Transit Waiting room

* Drag the red plug adapter to power outlet.
* Cord will plug in giving power to the coffee maker.
* Go down the stairs to the left

Generator room

* Click on the jacket on the ground to see the combination to Roy's locker
* Enter locker code 4827
* Get the mug
* Look at the combination sheet
* Look at code for triangle, circle or square depending on what was shown in Transit Lobby
* Enter appropriate code into shield keypad
* Charge your gun with generator
* Open the leftmost locker and get a cup with coffee beans
* Click on the fan control ! on the right wall turn it off
* Go to the waiting room and enter washroom

Washroom

* Open vent
* Look in vent and shoot out power supply.

Transit Waiting room

* Click on the coffee maker
* Put in the coffee beans
* Put in the mug
* Get mug of coffee
* Give mug of coffee to the guard.
* Enter Milos office

The Worm Solution
Milos Office

* Shoot Milos
* Return to the worm's lair

Worm's Lair

* Worm will give panel key
* Walk back and take Transit system to building #9

Building #9

* Use key to open security tower panel

Security chip puzzle solution

* Press big red buttons to turn them green
* Unplug patch cord, plug into next series of Red buttons, press them
* Repeat on final set
* Press top left switch to remove chip cap
* Move both sliders all the way to the right
* Press ! green left arrow
* Press square button
* Press green! right a rrow
* Get chip

Building #9

* Bring security chip to worm

Worm's Lair

* Get hacked chip
* Return to building #9

Building #9

* Put hacked chip into security tower
* Enter gates

Alternate Milos Solution
Milo's Office

* Don't shoot Milos
* Take Green Vial
* Bring Vial to Scavenger
* Get bomb from Scavenger
* Give bomb to the worm
* Watch him explode!
* Return to Milos to get Yellow code clearance
* Enter Building #9

ROUND TWO - BUILDING #9
Hallway

* Go into the first door

Kitchen

* Click on thermostat on wall
* Turn the temperature all the way up

Hallway

* Go into the 3rd door

Birdie's Office

* Pick up the mug
* Exit to Kitchen

Kitchen

* Put the mug in the microwave
* Turn the temperature down
* Go into h! ole in the wall

Harold's office

* Take the badge on the ground
* Look at the fish tank and get the code "173"
* Go into the fourth door on far wall

Waiting Room

* Talk to the secretary v 2.0 and book an appointment
* Then swap an appointment with the password 173
* Go into the Lobe's office

Lobe's Office

* Kill Senator Lobe

FAVOR WALKTHROUGHS
RETRIEVE THE BRIEFCASE

* Talk to Mr.Dog in Transit Waiting Room
* Exit and walk all the way to the right until you reach the Carboard box house.
* Enter the house.
* Shoot the scavenger and get the briefcase.
* Exit and head back to Transit lobby.
* Give briefcase to Mr.Dog

ELIMINATE BODYGUARD

* Talk to Mr.Blob in Transit Waiting Room
* Get coffeemaker working with red plug adapter, coffee beans and mug
* Give mug of coffee to guard
* Follow guard into washroom* Shoot guard

ELIMINATE TRANSIT TRADER

* Poin t gun at Insect Trader
* Holster gun to get mission
* Head into Milo's office
* Draw gun
* Holster gun, don't shoot Milos
* Take Green Vial
* Bring Vial to Scavenger
* Get bomb from Scavenger
* Trade bomb to Transit Trader
* Watch him explode!

MAKE A BABY DOLL

* Talk to Mr.Snakeman
* Get baby doll head from rock by big graffiti boulder
* Get popcorn bag from bathroom garbage
* Trade something for green sock from Transit Trader
* Combine popcorn with sock to make stuffed sock
* Combine baby doll head with stuffed sock to make a stuffed snake baby doll
* Give stuffed snake baby doll to Mr.Snake

Play Game Here



- Alan

tiny text generator

Area of a Triangle

With all this talk about triangles and their side lengths and angles, we shouldn't forget to discuss how to find the AREA of a triangle.

You are probably familiar with one formula for finding the area of a triangle:

Area = 1/2 (base)(height)

Compare this to finding the area of a rectangle:

The area of the rectangle is equal to the product of (base) x (height)..... (or length x width). However, by drawing a diagonal within the rectangle which joins two opposite corners, you can see that each newl! y-formed triangle is equal to half of the area of the original rectangle. Therefore, the area of a triangle is one-half the area of the rectangle, as shown by this triangle area formula. Even if you are looking at a triangle that doesn't immediately look like it is half of a rectangle, this formula still applies.

To prove it, you can draw a line in to represent the height, as I have shown here, thus creating two smaller triangles, and you can rearrange them to see that they indeed are equal to the area of half a rectangle:
That is one way to find the area of a triangle. However, if instead of base and height measurements, you are given lengths of sides or angles, this method won't work for you. In this case, you need to use a trig equation to solve for the area of a triangle.

Let's start w! ith the first equation we had above, and modify it. By the standard trig identities, we can show that:

height = (a)(SinC)

So substituting that into our formula:

Area = 1/2(base)(height)
Area = 1/2(b)(a)(SinC)

And this is the trig formula for solving the area of a triangle!

Area = (1/2)abSinC

You can use this to find the area of a triangle where you know any two sides and the angle between them! It's that easy!


solve triangle

Solving Quadratic Equations in AS3

ActionScript 3 provides a convenient way to solve quadratic equations. To refresh your memory, a quadratic equation takes this form:

a*x^2 + b*x+c = 0

Where a, b, and c are constants.

Solutions of a quadratic equation (its roots) may be real or imaginary. When getting the roots in ActionScript only real roots are considered. So, there can be 1, 2, or no roots found.

Here's how you use it:

import fl.motion.*
var results:Array = BezierSegment.getQuadraticRoots(a, b, c);

I ran some speed tests of the above against solving it manually. The built-in way is about 40% faster. Here is how I tested it. I ran each way 1,000,000 times. I think its pretty amazing that we can do this 2,000,000 times in like 3 seconds.



function getQuadraticRoots(a:Number, b:Number, c:Number):Array {
var r! esults:Array = new Array();
var sqt:Number = Math.sqrt(Math.pow(b, 2) - 4*a*c);
var root1:Number = (b+sqt)/(2*a);
var root2:Number = (b-sqt)/(2*a);
if (!isNaN(root1)) {
results.push(root1);
}
if (!isNaN(root2)) {
results.push(root2);
}
return results;
}
function testCustomFunction() {
var startTime:Number = new Date().getTime();
for (var i:int=0;i<1000000;++i) {
var results:Array = getQuadraticRoots(100*Math.random(), 100*Math.random(), 100*Math.random());
}
var endTime:Number = new Date().getTime();
trace("Custom time: "+(endTime-startTime));
}
testCustomFunction();

import fl.motion.*;
function testBuiltInFunction() {
var startTime:Number = new Date().getTime();
for (var i:int=0;i<1000000;++i) {
var results:Array = BezierSegment.getQuadraticRoots(100*Math.random(), 100*Math.random(), 100*Math.random());
}
var! endTime:Number = new Date().getTime();
trace("Built-in ! time: "+ (endTime-startTime));
}
testBuiltInFunction();

solve quadratic

Boost Graph Library


http://www.informit.com/articles/printerfriendly.aspx?p=673259
http://www.boost.org/libs/graph/doc/dijkstra_shortest_paths.html

Manipulating C++ Graph Data Structures with the Boost Graph Library

By Jeff Cogswell

Date: Dec 1, 2006

Return to the article


Quickly becoming a de facto standard C++ library, the Boost library includes a powerful graph data structure that's also easy to use. Jeff Cogswell discusses some interesting theory behind graphs, and explains the Boost library's graph structures.

In advanced mathematics, a graph is a special data structure made up of lines (called edges) c! onnected together at endpoints (called vertices or nodes). This definition of the term graph is in contrast to a popular definition used in early math classes, where a graph is simply a plot of a function.

Many computer science and mathematical algorithms make use of graphs. Because graphs are so important in many algorithms, a data structure for a graph is equally important. Most languages don't have graph data structures built in; indeed, C++ doesn't. Therefore, when you need a graph data structure, you either have to code one yourself or make use of a third-party library offering a graph data structure.

The Boost library is quickly becoming a de facto standard C++ library, and it includes a graph data structure that's easy to use yet powerful. In this article, I discuss the theory behind graphs, and then we explore the Boost library's graph structures.

Grasping ! Graph Theory

As I already mentioned, a graph is simply! a set o f vertices (the points) connected by edges (the lines). When two vertices are connected by an edge, those two vertices are said to be adjacent. If you enjoy mathematics, you might like to know that this definition can be described a bit more technically by stating that a graph consists of a finite set of vertices along with a finite set of unordered pairs of distinct vertices; you can see that the pairs of vertices represent the edges of the graph.

Graphs provide a visual way of displaying underlying information. For example, a large airline serves many cities. The airline's web site might provide a map showing cities as dots, and lines connecting the cities representing flights between those cities. This map could be considered a graph. Similar graphs might include those showing a trucking company's delivery routes between cities, or bus routes between cities.

Although, technically speaking, a graph consists simply of vertices co! nnected by edges, this limited definition isn't particularly useful. Often, graphs are more useful when they have more associated information. For example, a flight map might also show the flight numbers associated with each flight. In this representation, a graph consists of vertices, edges, and numbers associated with the edges. When numbers are associated with edges, such graphs are called weighted graphs.

Certainly, some graphs might need more than one piece of data associated with each edge. For example, in addition to the flight numbers, the airline map might show the length of each flight. In terms of computer science, however, such information would still be considered individual pieces of data in the form of individual structures or objects associated with each edge, with each structure containing a flight number and a flight time

Similarly, a graph might need to have information attached to the vertices, such as city na! mes in the case of the airline map. In mathematics, you can ! attach n umbers to vertices and use such numbers in calculations.

Another somewhat limiting aspect of a traditional definition of a graph is that the edges connecting the vertices don't have directions. In real life, a system that can be modeled by a graph will likely have directions. For example, if you travel by train somewhere, you definitely want to feel comfortable that the tracks you're riding on from one city to the next are carrying the train in a single direction! When you add directions to graphs, you have what mathematicians call a directed graph, or digraph for short.

Important to graph theory is another type of graph, limited by the restriction that the graph can be drawn on a sheet of paper without any edges crossing. Such a graph is called a planar graph. The term planar is used because the graph can be drawn on a single plane. Of course, this plane might not always be flat in the geometrical sense; ! the plane could exist on a curved surface such as the surface of the Earth, in which case it still maps to two dimensions. That's getting into another interesting area of mathematics called topology, however, which we won't cover here.

Old and Famous Problems

Graphs aren't just for representing data. They're often used in problem solving, and, as such, play a central role in many algorithms. Over the years, mathematicians have used graphs to solve many famous problems. One of the most famous is calculating how many colors are needed to color each country on a world map, such that no two adjacent countries share the same color. (If two countries touch at a single point, that point isn't considered a boundary.! ) People have long suspected that the answer is four, and thus! the pro blem can be to prove that any map can be colored with only four colors.

This assertion has been proven in various ways. One way employs graph theory—in particular, planar graphs. Remember that a planar graph is simply a graph that can be drawn on paper (that is, in two dimensions) without any edges crossing. The vertices in the graph represent countries, and the edges represent adjacencies. Thus, if a line connects two countries in a graph, the two countries share a common border. By this representation, the assertion becomes the following: Given any planar graph, a number can be associated with each vertex, and only four numbers are needed such that no two adjacent vertices share a single number. That hypothesis can then be proven using graph theory. (I won't go into the details here, but you can find information on the web if you're curious. It's called the "Four Color Theorem.")

Another famous problem that can be proven using graph t! heory is the "Seven Bridges" problem. The problem is based on the bridges of Konigsberg, Prussia. The problem is whether it's possible to walk across each bridge in that city once and only once (without cheating by swimming across a river), and ultimately return to the starting point. The famous mathematician Leonhard Euler solved the problem by using graph theory. (Unfortunately, his proof shows that it's impossible to perform the feat without jumping into one of the rivers.)

In Euler's proof of the Seven Bridges problem, he let the vertices of a graph represent the land masses, and the edges of the graph represented the bridges. To solve the problem, Euler associated a degree with each vertex; the degree is the number of edges touching the vertex. Euler proved that in order to complete a single circuit (that is, to cross each bridge once and only once and to return to your starting point), all the nodes must have a degree that's positive. If any ! nodes have an odd number of edges touching them, then the task! is impo ssible. The seven bridges in Konigsberg were constructed such that four of the nodes have odd degrees.

Graphs, Computers, and Popular Culture

Graphs show up all over the place in the world of computers. The Web itself is one massive graph, with each page being a vertex, and each link to another page an edge. Another place you see a graph concept is in social sites such as MySpace. In that sense, each profile is a vertex, and each friendship connection is an edge. That is, profiles are linked to other profiles via friend connections, just as vertices are linked to other vertices via edges.

In fact, the friendship link concept is used in a game people play, often called "Six Degrees of Kevin Bacon." The idea is that every Hollywood movie star is linked to Kevin Bacon by at most six links, an! d your job is to find the links. For example, take Jamie Foxx, who is two degrees from Kevin Bacon. One link goes like this: Jamie Foxx was in Booty Call with David Hemblen, who was in Where the Truth Lies with Kevin Bacon. (How did I know? I checked it out at The Oracle of Bacon.)

One popular social networking site, Facebook, uses graph theory to tell how members are connected to other members. If you're signed in, you visit a member's page, and that member is only a couple of links away, Facebook shows the connection. It says that person A is on your friend list, who has person B on his or her friend list, who in turn is friends with the person whose profile you're looking at. The FAQ even mentions using graph theory algorithms to make those connections visible.

Constructing a Simple Graph with Boost

If! you have to code a graph theory algorithm, you can either bui! ld the g raph data structures yourself, or use a library. The one I'm using for this article is found in the Boost library. Let's take a look at a first sample to show you how to use the Boost library's support for graph theory.

In general, a graph can be represented in a computer as a set of vertices and a set of edges connecting the vertices; the edges are simply pairs of vertices. Further, each vertex and each edge can have additional data attached to it, such as a number representing a weight, in the case of edges. This is essentially how Boost's Graph library works.

The Boost Graph library exists as templates, which means that you create your own classes and types based on the templates. However, the parameters for the templates all have defaults, so you can create a graph easily without having to do any customization.

Here's a short piece of code that demonstrates creating a graph and inserting vertices and edges into the graph. This code compiles completel! y, but it doesn't really do much other than create the graph:

#include <iostream>
#include <stdlib.h>
#include <boost/graph/adjacency_list.hpp>

using namespace boost;

int main(int argc, char *argv[])
{
adjacency_list<> mygraph;
add_edge(1, 2, mygraph);
add_edge(1, 3, mygraph);
add_edge(1, 4, mygraph);
add_edge(2, 4, mygraph);
return 0;
}

The mygraph variable is the graph itself. The type is adjacency_list, which is the fundamental graph template type in the Boost Graph library. I used the defaults for the parameters; thus, the parameters are an empty set with angle brackets (<>).

The add_edge function is a template helper function for adding items to the graph. To use it, you pass the values for two vertices. If the vertices don't already exist in the graph, they'll be added; then the edge connecting the two vertices will be add! ed. Thus, the preceding code creates a graph with four vertice! s, numbe red 1, 2, 3, and 4, with edges connecting 1 and 2, 1 and 3, 1 and 4, and finally 2 and 4.

This is just a basic example. To create more complex graphs, you'll need to define more data to associate with your edges and vertices. I take up that task in the next section.

Adding Values to Vertices and Edges

When you use a graph, normally you'll want to associate information with the vertices and edges. The Graph library uses an interesting approach for this goal. Items such as names or colors are stored in properties, which consist of a name (or tag) such as distance or name, and a type such as float or string. You can add properties to both vertices and edges.

BOOST_DEF_PROPERTY(edge, name);

When you define a graph, you can specify the types of properties associated with the graph. You can add ! as many properties as you want to vertices and edges. To defin! e proper ties, first you create a template type for each property type, and then you define the graph type before you instantiate the graph. For example, suppose you want to attach a distance to each edge, and a city name to each vertex. Here's the code to define the two property types:

typedef property<edge_weight_t, int> EdgeWeightProperty;
typedef property<vertex_name_t, std::string> VertexNameProperty;

The first line defines the EdgeWeightProperty type. The first parameter to the template is the tag for the property. I'm using one of the predefined tags, edge_weight_t, which means edge weight. The second parameter is int, meaning this property will hold an integer. The second line defines the second property; the tag is vertex_name_t, and the type is string.

Now that you have the property types defined, you can define a graph type:

typedef adjacency_list<vecS, vecS, undirectedS,
! VertexNameProperty, EdgeWeightProperty> Graph;

I'm using three predefined values for the first three parameters. The first and second parameters (vecS in both cases) indicate that I want the graph to use vectors for its internal storage, and the third parameter (undirectedS) says that I want an undirected graph. The fourth and fifth parameters (VertexNameProperty, EdgeWeightProperty, respectively) are the property types that I just defined, with the vertex type first, followed by the edge type.

At this point, you might wonder how you can specify more than one type of property for the edges and vertices. Here's how: Chain the properties together. The basic property template includes a parameter that can contain a property you already defined. Here's the vertex property definition again, but this time I'm defining two properties for vertex, a name and an index (using the predefined tag vertex_index2_t):

!  typedef property<vertex_index2_t, int>
VertexIndexP! roperty;
typedef property<vertex_name_t, std::string,
VertexIndexProperty> VertexNameProperty;

I've defined the index first, but the order really doesn't matter. The VertexNameProperty contains the VertexIndexProperty as its third parameter, thus creating a chain. You then pass the VertexNameProperty type to the fourth parameter of the graph definition, as before.

You also can condense your code a bit. This code is a bit less readable to somebody who is new to the Graph library, although once you understand the property mechanism it's pretty straightforward:

typedef property<vertex_name_t, std::string,
property<vertex_index2_t, int> > VertexProperties;

! I renamed the type VertexProperties, since it now contains two different properties. Also, notice the standard required space between the closing angle brackets, which is always needed in C++ so the parser doesn't think it's an insertion operator (>>). Don't forget that space, or you'll end up with compilation errors.

Manipulating Property Values

In order to access the properties of your graph, you need to obtain a helper object from the Graph library. You obtain one object for each property type. The objects are template objects, and you can obtain them after you've created an instance of your Graph type. Here are the lines that obtain objects for the three properties I declared in the preceding section:

property_map<Graph, vertex_name_t>::type
city_name = get(vertex_name, g);
property_map<Graph, vertex_index2_t>::type
city_index2 = get(vertex_index2, g);
property_map<Graph, edge_weigh! t_t>::type
edge_distance = get(edge_weight, g);
!

Don' t worry that the function name is the somewhat generic word get. The function is well-defined as a typed template, so it will compile just fine.

The first statement creates an object for obtaining the vertex_name property. Look closely at the parameters. On the left, the parameters to the template are the Graph type defined earlier, along with the tag for the property, vertex_name_t. On the right, inside the call to get, is not the tag name, but rather an enumeration type associated with the property, vertex_name. Each predefined tag name also includes an enumeration for each type. The Graph object itself, g, is the second parameter to the get function.

Remember, these three calls each obtain an object that you can use for getting properties for a vertex or edge. Although the sample code pieces I've been giving you so far haven't created any vertices, here's a sample line I'll use ! later on to obtain a property:

std::cout << city_name[*vp.first];

where vp.first is a pointer to a vertex. The object, city_name, works like a map, and it takes a vertex object as a parameter. It then returns the appropriate property—in this case, the city name.

Adding Vertices and Edges

After you've specified your property types and defined the graph type, you're ready to create an instance of the graph and add vertices and edges to the graph, along with values for the properties associated with the vertices and edges.

Let's start with a fresh graph, define some properties, and then add the edges and vertices along with their properties. I'll list all the code here so you don't have to piece together the fragments I've given you so far.

// Property types
typedef property<edge_weight_t, int> EdgeWeightProperty;
typedef property<vertex_name_t, std::string,
property<vertex_i! ndex2_t, int> > VertexProperties;

// Graph type typed ef adjacency_list<vecS, vecS, undirectedS,
VertexProperties, EdgeWeightProperty> Graph;

// Graph instance
Graph g;

// Property accessors
property_map<Graph, vertex_name_t>::type
city_name = get(vertex_name, g);
property_map<Graph, vertex_index2_t>::type
city_index2 = get(vertex_index2, g);
property_map<Graph, edge_weight_t>::type
edge_distance = get(edge_weight, g);

// Create the vertices
typedef graph_traits<Graph>::vertex_descriptor Vertex;
Vertex u1;
u1 = add_vertex(g);
city_name[u1] = "Los Angeles";
city_index2[u1] = 3;

Vertex u2;
u2 = add_vertex(g);
city_name[u2] = "Bakersfield";
city_index2[u2] = 2;

Vertex u3;
u3 = add_vertex(g);
city_name[u3] = "New York";
city_index2[u3] = 1;

// Create the edges
typedef graph_traits<Graph>::edge_descriptor Edge;
Edge e1;
e1 = (add_edge(u1, u2,! g)).first;
edge_distance[e1] = 100;

Edge e2;
e2 = add_edge(u1, u3, g).first;
edge_distance[e2] = 2500;

In the first section I define the property types, followed by the graph type. Then I create the instance, g, of the graph. Next, I obtain the property access objects that I talked about.

Then I start adding the vertices and edges. To add the vertices, I create my own type called Vertex from the vertex_descriptor, just to simplify the code a bit. I add the vertex by calling the helper function add_vertex, passing in g.

The graph adds the vertex and returns a vertex descriptor. Then I use the property access objects to assign the two properties for the vertex: city_! name and city_index2. Setting the properties is ! easy; I just use the vertex as an index into the map by putting the vertex name in brackets ([]).

Creating the edges is similar, except that the add_edge function returns a pair type rather than an edge type. So I just grab the .first member of the pair to get the edge itself. I save that in a variable; then I use that variable as an index to set the properties. Since mathematically an edge is really nothing more than a set of two vertices, that's all I have to pass to add_edge, along with the graph.

Iterating Through the Edges and Vertices

To iterate through the edges and vertices, you can obtain iterators by calling edges(g) and vertices(g), respectively. These functions return pairs that you can use in your iterations. Here are two blocks of code that iterate through the edges and vertices I created in the preceding section:

// Iterate through the vertices and print them out
typedef graph_tra! its<Graph>::vertex_iterator vertex_iter;
std::pair<vertex_iter, vertex_iter> vp;
for (vp = vertices(g); vp.first != vp.second; ++vp.first)
std::cout << city_name[*vp.first] << " " << city_index2[*vp.first] << std::endl;
std::cout << std::endl;

// Iterate through the edges and print them out
Vertex v1, v2;
typedef graph_traits<Graph>::edge_iterator edge_iter;
std::pair<edge_iter, edge_iter> ep;
edge_iter ei, ei_end;
for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
std::cout << edge_distance[*ei] << endl;

I purposely used two approaches in these two blocks of code to demonstrate a certain feature about the pairs that are returned. When I iterated through the vertices, I got back a pair, for which I created a typedef. Then, to access the vertex, I called vp.first. That's an iterator; like most iterators in C++, to get to the ins! tance itself, I dereferenced it. Thus, I could write out the c! ity name and index using this:

city_name[*vp.first]

and this:

city_index2[*vp.first]

If you don't want to work with pairs, however, the library includes a handy helper function called tie, which assigns the individual parts of the pair to the variables passed into the tie function. Since edges(g) returns a pair, calling this:

tie(ei, ei_end) = edges(g)

will save the first item in the pair into ei and the second into ei_end. Then, in the loop, you can access the edge simply with *ei, like so:

edge_distance[*ei]

Solving Problems with Graphs and Boost

Although the Six Degrees of Kevin Bacon game is for fun, the technique used to solve it, called the "Shortest Path" problem, has some practical uses beyond ruminating over movie stars. For example, if you use one of the popular shipping companies to ship a product from Bakersfield, California to ! Lake Mary, Florida, the shipper needs to find the shortest (that is, the least expensive) path to get the package to the destination. Most likely the package will travel through at least a few cities that the shipper considers hubs. Each city, then, is a vertex on the graph, and cities are connected by edges. The graph is weighted, since the distances between cities vary, as do the time and method to move a package from one city to the next. This is where the problem differs from the Six Degrees problem, since the Six Degrees problem doesn't have weights to the edges.

Mathematicians and computer scientists have developed various algorithms to solve graph theory problems, including the Shortest Path problem. Entire books have been written on the subject of solving problems with graph theory. Certainly, many of the big problems such as those dealing with product shipping involve large numbers of verti! ces and edges. (Think of the number of cities in the United St! ates, pr etty much all served by the United States Post Office.) Thus, these problems are best suited for computers.

The Boost library includes several well-known graph theory algorithms so you don't have to code them yourself. It includes several different Shortest Path algorithms, for example. The thing about the fun Kevin Bacon problem is that it's actually not all that interesting from a graph theory perspective, because all the edge weights are 1; by that I mean that when two actors are connected by having been in a movie together, there isn't a physical distance associated with the connection.

When the edge weight is 1, as with the Kevin Bacon problem, the algorithm becomes identical to an algorithm called "Breadth First Search" (BFS). BFS is used for iterating over vertices, starting at a beginning vertex called the root. The idea is that you start at the root vertex, and spread out to each vertex touching the root, marking ea! ch as visited. Then you continue for each of these vertices, visiting each unvisited vertex until you've covered the graph. Or you can stop when you find a particular vertex you want, in which case you've found the shortest path to the vertex you wanted.

The documentation for the Boost library includes a good demonstration of the Kevin Bacon game. Rather than write up similar code here, I suggest just checking out the documentation.

Of more interest to a lot of programmers than t! he Kevin Bacon game is another interesting problem of file dep! endencie s. Programs such as make and ant as well as spreadsheets need this algorithm. For example, if you're writing spreadsheet software, and the spreadsheet contains cells with formulas referencing other cells, you need to figure out the order in which to evaluate the formulas. If cell A1 has a formula that makes use of cell A2, and A2 has a formula, then you have to evaluate the formula in A2 before you can evaluate the one in A1. That's a dependency algorithm. The same applies to compilation order in programs such as make and ant. If file 1 depends on file 2, then you have to know to compile file 2 before file 1. The documentation for the Boost Graph library includes a sample that solves the file dependency problem.

Conclusion

The Boost library definitely has a sharp learning curve. The documentation doesn't flow ni! cely, and it takes awhile to wade through it to flesh out the vital topics. However, once you've passed the learning curve, the library is incredibly powerful, and really does make sense. The designers have done a fine job of implementing a library using templates.

Be sure to check out the online documentation; even though I've criticized it a bit here, it contains a lot of useful information. But also look at the samples, as they provide some good starting points. The entire library can be found at the Boost web site.


C++ Boost

(Python) dijkstra_shortest_paths

// named parameter version
template <typename Graph, typename P, typename T, typename R>
void
dijkstra_shortest_paths(Graph& g,
typename graph_traits<Graph>::vertex_descriptor s,
const bgl_named_params<P, T, R>& params);

// non-named parameter version
template <typename Graph, typename DijkstraVisitor ,
typename PredecessorMap, typename DistanceMap,
typename WeightMap, typename VertexIndexMap, typename CompareFunction, typename CombineFunction,
typename DistInf, typename DistZero, typename ColorMap = default>
void dijkstra_shortest_paths
(const Graph& g,
typename graph_traits<! Graph>::vertex_descriptor s,
PredecessorMap predecessor, DistanceMap distance, WeightMap weight,
VertexIndexMap index_map,
CompareFunction compare, CombineFunction combine, DistInf inf, DistZero zero,
DijkstraVisitor vis, ColorMap color = default)

This algorithm [10,8] solves the single-source shortest-paths problem on a weighted, directed or undirected graph for the case where all edge weights are nonnegative. Use the Bellman-Ford algorithm for the case when some edge weights are negative. Use breadth-first search instead of Dijkstra's algorithm when all edge weights are equal to one. For the definition of the shortest-path problem see Section Shortest-Paths A! lgorithms for some background to the shortest-path problem! .

There are two main options for obtaining output from the dijkstra_shortest_paths() function. If you provide a distance property map through the distance_map() parameter then the shortest distance from the source vertex to every other vertex in the graph will be recorded in the distance map. Also you can record the shortest paths tree in a predecessor map: for each vertex u in V, p[u] will be the predecessor of u in the shortest paths tree (unless p[u] = u, in which case u is either the source or a vertex unreachable from the source). In addition to these two options, the user can provide there own custom-made visitor that can takes actions during any of the algorithm's event points.

Dijkstra's algorithm finds all the shortest paths from the source vertex to every other vertex by iteratively ``growing'' the set of vertices S to which it knows the shortest path. At each step of the algori! thm, the next vertex added to S is determined by a priority queue. The queue contains the vertices in V - S[1] prioritized by their distance label, which is the length of the shortest path seen so far for each vertex. The vertex u at the top of the priority queue is then added to S, and each of its out-edges is relaxed: if the distance to u plus the weight of the out-edge (u,v) is less than the distance label for v then the estimated distance for vertex v is reduced. The algorithm then loops back, processing the next vertex at the top of the priority queue. The algorithm finishes when the priority queue is empty.

The algorithm uses color markers (white, gray, and black) to keep track of which set each vertex is in. Vertices colored black are in S. Vertices colored white or gray are in V-S. White vertices have not y! et been discovered and gray vertices are in the priority queue! . By def ault, the algorithm will allocate an array to store a color marker for each vertex in the graph. You can provide you own storage and access for colors with the color_map() parameter.

The following is the pseudo-code for Dijkstra's single-source shortest paths algorithm. w is the edge weight, d is the distance label, and p is the predecessor of each vertex which is used to encode the shortest paths tree. Q is a priority queue that supports the DECREASE-KEY operation. The visitor event points for the algorithm are indicated by the labels on the right.

DIJKSTRA(G, s, w)
for each vertex u in V
d[u] := infinity
p[u] := u
color[u] := WHITE
end for
color[s] := GRAY
d[s] := 0
INSERT(Q, s)
while (Q != Ø)
u := EXT! RACT-MIN(Q)
S := S U { u }
for each vertex v in Adj[u]
if (w(u,v) + d[u] < d[v])
d[v] := w(u,v) + d[u]
p[v] := u
if (color[v] = WHITE)
color[v] := GRAY
INSERT(Q , v)
else if (color[v] = GRAY)
DECREASE-KEY(Q, v)
else
...
end for
color[u] := BLACK
end while
return (d, p)
initialize vertex u






discover vertex s

examine vertex u

examine edge (u,v)

edge (u,v) relaxed



discover vertex v



edge (u,v) not relaxed

finish vertex u

Where Defined

! boost/graph/dijkstra_shortest_paths.hpp

Parameters

IN: const Graph& g
The graph object on which the algorithm will be applied. The type Graph must be a model of Vertex List Graph and Incidence Graph.
Python: The parameter is named graph.
IN: vertex_descriptor s
The source vertex. All distance will be calculated from this vertex, and the shortest paths tree will be rooted at this vertex.
Python: The parameter is named root_vertex.

Named Parameters

IN: weight_map(WeightMap w_map)
The weight or ``length'' of each edge in the graph. The weights must all be non-negative, and the algorithm will throw a negative_edge exception is one of the edges is negative. The type WeightMap must be a model of Readable Property Map. The edge descriptor type of the graph needs to be usable as the key type for the weight map. The value type for this map must be the same as the value type of the distance map.
Default: get(edge_weight, g)
Python: Must be an edge_double_map for the graph.
Python default: graph.get_edge_double_map("weight")
IN: vertex_index_map(VertexIndexMap i_map)
This maps each vertex to an integer in the range [0, num_vertices(g)). This is necessary for efficient updates of the heap data structure [6! 1] when an edge is relaxed. The type VertexIndexM! ap must be a model of Readable Property Map. The value type of the map must be an integer type. The vertex descriptor type of the graph needs to be usable as the key type of the map.
Default: get(vertex_index, g). Note: if you use this default, make sure your graph has an internal vertex_index property. For example, adjacenty_list with VertexList=listS does not have an internal vertex_index property.
Python: Unsupported parameter.
OUT: predecessor_map(PredecessorMap p_map)
The predecessor map records the edges in the minimum spanning tree. Upon completion of the algorithm, the edges (p[u],u) for all u in V are in the minimum spanning tree. If p[u] = u then u is either the source vertex or a vertex that is not reachable from the so! urce. The PredecessorMap type must be a Read/Write Property Map whose key and value types are the same as the vertex descriptor type of the graph.
Default: dummy_property_map
Python: Must be a vertex_vertex_map for the graph.
UTIL/OUT: distance_map(DistanceMap d_map)
The shortest path weight from the source vertex s to each vertex in the graph g is recorded in this property map. The shortest path weight is the sum of the edge weights along the shortest path. The type DistanceMap must be a model of Read/Write Property Map. The vertex descriptor type of the graph needs to be usable as the key type of the distance map. The value type of the distance map is the element type of a! Mon! oid formed with the combine function object and the zero object for the identity element. Also the distance value type must have a StrictWeakOrdering provided by the compare function object.
Default: iterator_property_map created from a std::vector of the WeightMap's value type of size num_vertices(g) and using the i_map for the index map.
Python: Must be a vertex_double_map for the graph.
IN: distance_compare(CompareFunction cmp)
This function is use to compare distances to determine which vertex is closer to the source vertex. The CompareFunction type must be a model of Binary Predicate and have argument types that match the value type of the DistanceMap property map.
Default: std::less<D> with D=typename property_traits<DistanceMap>::value_type
Python: Unsupported parameter.
IN: distance_combine(CombineFunction cmb)
This function is used to combine distances to compute the distance of a path. The CombineFunction type must be a model of Binary Function. The first argument type of the binary function must match the value type of the DistanceMap property map and the second argument type must match the value type of the WeightMap property map. The result type must be the same type as the distance value type.
Default: std::plus<D> with D=typename property_traits<DistanceMap>::value_type
Pyth! on: Unsupported parameter.
IN: distance! _inf(D i nf)
The inf object must be the greatest value of any D object. That is, compare(d, inf) == true for any d != inf. The type D is the value type of the DistanceMap.
Default: std::numeric_limits<D>::max()
Python: Unsupported parameter.
IN: distance_zero(D zero)
The zero value must be the identity element for the Monoid formed by the distance values and the combine function object. The type D is the value type of the DistanceMap.
Default: D()with D=typename property_traits<DistanceMap>::value_type
Python: Unsupported parameter.
UTIL/OUT: color_map(ColorMap c_map)
This is used during the execution of the algorithm to mark the ! vertices. The vertices start out white and become gray when they are inserted in the queue. They then turn black when they are removed from the queue. At the end of the algorithm, vertices reachable from the source vertex will have been colored black. All other vertices will still be white. The type ColorMap must be a model of Read/Write Property Map. A vertex descriptor must be usable as the key type of the map, and the value type of the map must be a model of Color Value.
Default: an iterator_property_map created from a std::vector of default_color_type of size num_vertices(g) and using the i_map for the index map.
Python: The color map must be a vertex_color_map for the graph.
OUT! : vi sitor(DijkstraVisitor v)
Use this to specify actions that you would like to happen during certain event points within the algorithm. The type DijkstraVisitor must be a model of the Dijkstra Visitor concept. The visitor object is passed by value [2].
Default: dijkstra_visitor<null_visitor>
Python: The parameter should be an object that derives from the DijkstraVisitor type of the graph.

Complexity

The time complexity is O(V log V).

Visitor Event Points

  • vis.initialize_vertex(u, g) is invoked on each vertex in the graph before the start of the algorithm.
  • vis.examin! e_vertex(u, g) is invoked on a vertex as it is removed from the priority queue and added to set S. At this point we know that (p[u],u) is a shortest-paths tree edge so d[u] = delta(s,u) = d[p[u]] + w(p[u],u). Also, the distances of the examined vertices is monotonically increasing d[u1] <= d[u2] <= d[un].
  • vis.examine_edge(e, g) is invoked on each out-edge of a vertex immediately after it has been added to set S.
  • vis.edge_relaxed(e, g) is invoked on edge (u,v) if d[u] + w(u,v) < d[v]. The edge (u,v) that participated in the last relaxation for vertex v is an edge in the shortest paths tree.
  • vis.discover_vertex(v, g) is invoked on vertex v when the edge (u,v) is examined and v is WHITE. Since a vertex is colored GRAY when it is discover! ed, each reacable vertex is discovered exactly once. This ! is also when the vertex is inserted into the priority queue.
  • vis.edge_not_relaxed(e, g) is invoked if the edge is not relaxed (see above).
  • vis.finish_vertex(u, g) is invoked on a vertex after all of its out edges have been examined.

Example

See example/dijkstra-example.cpp for an example of using Dijkstra's algorithm.

Notes

[1] The algorithm used here saves a little space by not putting all V - S vertices in the priority queue at once, but instead only those vertices in V - S that are discovered and therefore have a distance less than infinity.

[2] Since the visitor parameter is passed by value, if your visitor contains state then any changes to the state during the algorithm will be made to a copy of the visitor object, not the visitor object! passed in. Therefore you may want the visitor to hold this state by pointer or reference.


Copyright © 2000-2001 Jeremy Siek, Indiana University (jsiek@osl.iu.edu)



//=======================================================================
// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//=======================================================================
#include <boost/config.hpp>
#include <iostream>
#include <fstream>

#include <boost/graph/graph_traits.hpp>
#include <! boost/graph/adjacency_list.hpp>
#include <boost/graph! /dijkstr a_shortest_paths.hpp>

using namespace boost;

int
main(int, char *[])
{
typedef adjacency_list < listS, vecS, directedS,
no_property, property < edge_weight_t, int > > graph_t;
typedef graph_traits < graph_t >::vertex_descriptor vertex_descriptor;
typedef graph_traits < graph_t >::edge_descriptor edge_descriptor;
typedef std::pair<int, int> Edge;

const int num_nodes = 5;
enum nodes { A, B, C, D, E };
char name[] = "ABCDE";
Edge edge_array[] = { Edge(A, C), Edge(B, B), Edge(B, D), Edge(B, E),
Edge(C, B), Edge(C, D), Edge(D, E), Edge(E, A), Edge(E, B)
};
int weights[] = { 1, 2, 1, 2, 7, 3, 1, 1, 1 };
int num_arcs = sizeof(edge_array) / sizeof(Edge);
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
graph_t g(num_nodes);
property_map<graph_t, edge_weight_t>::type weightmap = get(edge_weight, g);
for (std::size_! t j = 0; j < num_arcs; ++j) {
edge_descriptor e; bool inserted;
tie(e, inserted) = add_edge(edge_array[j].first, edge_array[j].second, g);
weightmap[e] = weights[j];
}
#else
graph_t g(edge_array, edge_array + num_arcs, weights, num_nodes);
property_map<graph_t, edge_weight_t>::type weightmap = get(edge_weight, g);

solve graph

February 22-26

Week at a glance:

Mon. Section 9.3 pg. 493 10-16,37-53,78-83

Tues. Section 9.4 pg. 5-12,15-31odd

Wed. Section 9.4 pg.499 35-47,54-70/Quiz 1-10

Thurs. Section 9.5 Pg. 505 17-45odd,49,55-60,65-70

Fri. no school


Resources to supplement the class lessons:

Section 9.3 Factoring Trinomials Day 2
Videos:
http://www.phschool.com/atschool/academy123/english/academy123_content/wl-book-demo/ph-274s.html
http://www.glencoe.com/sec/math/algebra/ca/ca_05/personal_tutor/chapter10/Alg1_10_1.swf
http://www.phschool.com/atschool/academy123/english/academy123_content/wl-book-demo/ph-276s.html


Section 9.4 Factoring Trinomials Ax^2 + Bx + C
Videos:
http://www.phschool.com/atschool/academy123/english/academy123_content/wl-book-demo/ph-278s.html
http://www.phschool.com/atschool/academy123/english/academy123_content/wl-book-demo/ph-278s.html

Section 9.5 Factoring Differences of Squares
Videos:
http://www.phschool.com/atschool/academy123/english/academy123_content/wl-book-demo/ph-282s.html


Another way: Factor Trinomials Using Grouping
Videos:
http://www.phschool.com/atschool/academy123/english/academy123_content/wl-book-demo/ph-284s.html

phschool.com math

Tutor Next's Math Tutoring

Tutor Next is an excellent online tutoring service which provides online tutoring to K-12 and college students at a cheap rate. Students can try the service for free before deciding to use it, by using the online demonstration.

Tutor Next delivers personal tutoring to students. Their tutors can provide math help with exam preparation, math questions, and the various types of math problems.

Tutors from the service will deliver excellent homework help for students at their own place and during their own time. They will help with difficult questions and individual math problems.

Tutor Next provides students with algebra help! , calculus help, and physics help.

next tutor

Preparing Hydroponics Nutrient Solutions, From Concentrations to Weights

In a previous post, I explained how concentrations are given in hydroponic gardening and what they actually mean. For example, I exemplified that 200 ppm of N equals a solution which contains 200 mg per liter of nitrogen although the form in which nitrogen is present is not described by the concentration data. In this post, I intend to explain how nutrient concentrations can be translated adequately to a mass weight of a certain salt that will be the actual source of the nutrient.

Let us start by supposing that you have a certain solution recipe given in concentration data, for example, the solution demands 200 ppm N and 700 ppm K (this is just an example as 700 ppm of K is too high for any hydroponic nutrient solution). This means that the solution requires 200 mg per liter of nitrogen and 700 mg per liter of potassium. Our mission now is to translate this concentration information into the! actual amount of a given salt that needs to be weight and dissolved.

The first thing we need to do is find a suitable salt or salts that can give us the nutrients we want in the appropiate forms. In this case, we will use potassium nitrate (KNO3) as a source of both nitrogen and potassium. This salt gives the plant nitrogen as NO3(-) ions and potassium as K(+) ions.

Our next step is to figure out how much solution we want to prepare. In this case, let's suppose we want to prepare 100L (around 32 gal) of nutrient solution.

Following this, we must calculate how much much K(+) and how much NO3(-) need to be added in order to achieve the concentrations we desire. Since K(+) contains a single K atom, we need 700 mg/L of K(+) in order to achieve 700 ppm of K, for the nitrate ion (NO3(-)), since it contain! s more atoms, we need to know how much of the nitrate ion is a! ctually nitrogen. In order to do this we calculate what fraction of nitrogen resides in nitrate by relating their molar mases (you can google nitrate molar mass and nitrogen molar mass to get this values or calculate them using your periodic table) . The calculation would be 14/62 which equals 0.22. This means that 22% of each nitrate ion is nitrogen. If 22% of each nitrate ion is nitrogen then we need 200ppm x(100/22) of nitrate in order to get the concentration of nitrogen we want. The result is that we need 909 mg of nitrate per liter in order to achieve our required concentration of 200 ppm.

Since our salt is KNO3 and not K or NO3 by themselves we need to decide which nutrient we want to fit in an exact manner. For this example I will take NO3(-). Since we want to weight 909mg per liter of NO3(-) we see how much KNO3needs to be weight in order to achieve this amount for 100 liters. For this we use the relationship between the molar mases of nitrate and the salt, potassium nitrate. The equation is 62/101, which equals 0.61, meaning 61% of potassium nitrate is nitrate. Since we want to know how much is 100% knowing that 61% is 909mg per liter we calculate 909ppm x 100/61, which equals 1490mg per liter which needs to be multiplied by 100 in order to find the amount needed for 100 liters of solution. The final result is that 149 g of potassium nitrate are needed in order to achieve a concentration of 200 ppm of N in 100 liters of solution.

Now what happened to the potassium ? Since we added potassium nitrate, we also added potassium with the salt. We now need to calculate the concentration of potassium which we get when we arrive at a concentration of 909 ppm for ntirate. Since we know nitrate is 61%, then potassium must be 39% of the concentration so 1! 490 ppm x 0.39 equals 581 ppm.

As you can see, we ! matched our nitrogen requirement perfectly but ofset our potassium requirement by an important amount. This problem is due to the fact that each salt gives two nutrients to a soltuion. Meaning that a good salt combination needs to be used in order for our errors to be reduced when preparing the hydroponic nutrient solutions. This problem can be solved by using the hydroponic nutrient solution calculator I described in an earlier post, however, it is important to know how the calculator works in order to understand its possible errors.

As you can see, preparing nutrient solutions and turning concentrations into weights can be a little bit daunting at first but with practice and the aid of calculator tools, the preparation of custom hydroponic solutions becomes very easy and paves the way towards major improvements for any commercial or hobbyst hydroponic gardener.


molar concentration calculator

Chocolate Math Mystery


My youngest and I are heading into Philadelphia tonight for a chocolate dessert feast, so it seems apt that a friend sent me this bit of mathematical magic this morning - with a plea to explain how it works.

Chocolate Calculator:

This is pretty neat. Don’t say your age; you will probably lie anyway!

DON’T CHEAT BY SCROLLING DOWN FIRST

It takes less than a minute. W! ork this out as you read.

Be sure you don’t read the bottom until you’ve worked it out!

  1. First of all, pick the number of times a week that you would like to have chocolate (more than once but less than 10)
  2. Multiply this number by 2 (just to be bold)
  3. Add 5
  4. Multiply it by 50 — I’ll wait while you get the calculator
  5. If you have already had your birthday this year add 1759. If you haven’t, add 1758.
  6. Now subtract the four digit year that you were born.

You should have a three digit number

The first digit of this was your original number (i.e., how many times you want to have chocolate each week).

The next two numbers are YOUR AGE! (Oh YES, it is!!!!!)

THIS IS THE ONLY YEAR (2009) IT WILL EVER WORK, SO SPREAD IT AROUND WHILE IT LASTS!


So how does it work?
Expressed algebraically, the procedure if you have had your birth! day can be written as:
50 (2n +5) + 1759 - y
where n! is the number you chose and y the year you were born

The author asserts that this will produce a number where the digit in the 100's place is n and the remaining digits are your age or 100*n + age. If you have had your birthday this year, your age in 2009 can be written in terms of your birth year, y, as
age = 2009 - y
So the formula should produce 100*n + (2009 - y).

It is trivial (I love saying that) to show that

50 (2n +5) + 1759 - y = 100*n + (2009 - y)

This will not work if your age is greater than 99, but as long as you are younger than that, the last two digits will always be your age even if the number of times you want to eat chocolate in a week is greater than 10 -- so in either case eat all the chocolate you want!

math words a to z

Speed Math: Multiplying Decimals

Went through the chapter on Multiplying Decimals. The concept is the same as any other multiplication, but one use of it is super-cool.
If you need to multiply 8 x 88, make it 8.0 x 88. Essentially, you're multiplying 80 x 88 and can just add a decimal point at the end of your answer. Super-awesome!
To Do
Hopefully will get to go through the next chapter (Multiplying Using Two Reference Numbers) today itself.
Tables upto 20!

math problems decimals

Sarah Palin Answer Generator

Interview Sarah Palin will generate Sarah Palin-like answers to interview questions. An example:

Q: What is your foreign policy experience?

Alaska that we take the fight to the problems on Wall Street. Well, it certainly does because our our next door neighbors and you can actually see Russia from land here in Alaska, from an island in Alaska. We have got to play an appropriate role in the trade sector today we've got to show the support, in this nation, at this time. It is from Alaska that we take the fight over there. Oil and Gas Conservation Commission, overseeing the oil and gas development in our state to produce more for the right reasons and serving for the other party, also.


math answer generator

What I've been working on...

Busy, busy time here at Woodberry.  We're approaching trimester exams; today was the last day of class before exam week.  Sunday is "consultation day," during which teachers will be in their classroom all afternoon.

My general (non-AP) physics class follows approximately the AP physics B curriculum... except that we spend from September through February on mechanics only.  The upcoming exam in that class will consist of seven problems, each one based on an authentic AP physics B problem from the last 20 years. 

I've spent the week creating new exam preparation exercises, especially for general physics.  I wrote some new exam-style questions based on AP problems; I followed these up with quizzes, and then multiple choice review exercises with the "clickers," a.k.a. classroom response system.

Things are still too hectic for now to post specifics -- baseball tryouts concluded yesterday, and I'm way behind on my grading.  But next week I will be able to start posting again.  I think these clicker review exercises will be well worth a look.

GCJ

P.S. In case you're confused, the picture is of Woodberry Forest baseball captain and soon-to-be Georgia Tech Yellow Jacket Paul Kronenfeld.  And yes, Mr. Kronenfeld IS in fact a physics student.

how to graph the equation and identify the y-intercept

Need calculus help?

Do you having trouble on Polynomial Functions, binomial theorem or rational function? I believe some of you having trouble on this precalculus topics, then you need someone that having expertise on precalculus help. If you're a college student you might need calculus help on such topics as integral or differential equation or maybe definite integers.
Based on your grade, if you're having trouble on precalculus or calculus topics, you may try free precalculus help or free calculus help out there. Some paid tutor might provide you with ! free course so you can decide their quality based on how they help you solving your problem on study. You may also consider to use expert calculus tutor to help you by one on one tutoring about your problem. Having someone to tutor you about precalculus or calculus topics is a good idea but you must make sure that the tutorial is at the pace as your learning speed. Before asking help from expert calculus tutor, make sure the tutor have a good reputation to address your problem correctly and can adapt various matter that his student faced.


help calculus

Cursing, Swearing, using Bad Words, NO BIG DEAL! REALY!

Cursing, Swearing, using Bad words, no big deal! Really!

I have always held that there are no such things as bad words. As such, I will use many of them in this post. If you get offended by such words, then please, stay, because this is for you. I will address the use of swear words in as many forms as I can remember and show why they are no big deal.

There are three ways in which swears words are considered bad.

1. Words are socially unacceptable
2. Words are hijacked from original meanings to mean something deragatory
3. And most commonly, they are "bad" words because of ones faith or religion

All three purposes are simply not valid and I will show why. And for number three, I will show why it is not valid to say one particular word is bad, biblically. Oh yes, I can argue from the bible as well.

1. Some words are bad because they are socially acceptable.

I have to admit, this is possibly! the worst argument I have ever heard. When I was a christian, I still had a major problem with this. Why? Because words have meaning, and meaning is what is important, no particular word. If I were to call you a mother fucker, you would likely be highly offended. But what if I said "you enjoy intimate relations with your mom"? Now, you would likely think about it for a moment then be upset, but it doesn't have the same power as "mother fucker" because you believe that some how "mother fucker" is a bad word.

If I say "fuck you", you will inherently get more upset than if I were to say "screw you" or "violate you" or "do you in the rear". The last two are likely to illicit a law instead of anger. But why? They mean the same thing, and have the same linguistic value as "fuck you" does. When you give words more power based on the sound it makes coming out of someones mouth, you denigrad the meaning and value of words by making one word better or worse than a! nother. You wouldn't the term "they" is better than "them" wo! uld you? They mean virtually the same thing. We should apply the same logic to all words. Instead of specific sounds being offensive, we need to look at the meaning of a word. I assure you I can say much more offensive things without the so called "bad words". There is nothing more ridiculous than completely insulting someone without one cuss word then having them get upset at "fuck you". We get upset at these particular words and not others because we UNDERSTAND what they mean. Other language is often not fully understood and doesn't convey the feelings to people any more, like cuss words do.

Thus, in society, we decided that, since we don't like these feelings being conveyed, that we can demonize the words that convey them. Whats worse, words in a society, and in meaning, change over time. If you went back 200 years ago and told King George "Fuck You" he wouldn't have the slightest idea what you were talking about. Phrases that have to universal meaning cannot! be held as bad. In 100 years, we won't know what the phrase means either. So what you are doing is picking one set of words that convey a specific meaning in any given society time table, and deciding they are bad. That simply is not acceptable. Meaning is important. Meaning and the feelings conveyed are more important than the actual words used. Which leads me to point number 2.

2. Some words are bad even though they have valid definitions of use.

Bitch, bastard, ass hole. All these types of words have valid meanings associated with them. A bitch is a female dog. A bastard is a son born whose father is not known, and ass is an animal. But they have been hijacked, once again, for the feelings they convey, and by consequence, making them "bad words". Not long ago, I did a random test on some people I knew. I didn't tell them at first, but I did after words. I told one of the women she was a bitch. She immediately got upset at me. Didn'! t slap me, but she wanted to. I told another woman separately! that sh e was acting like a female dog. She laughed and said she supposed she was. (she happens to be one that thinks swearing is wrong). I did the same with some male co-workers with "bastard". The one called bastard felt hurt and got upset, the one who I used the definition on, said he had no father, didn't even blink. And finally, I called one of my friends an ass hole in anger, and the other a butt hole in anger. You guessed it, the one who I called butt hole just apologize (he didn't need to, I set him up) and the one I called ass hole immediately got defensive and angry.

Words have meaning. That meaning is why we get upset. But in place of discerning what someone is saying, we have put in a set of words that are considered "bad words" so that we know what feelings are being conveyed and know when to properly get upset or offended. The problem is that now the words themself are offensive separate from their meanings. If I call you a donkeys butt, or a but! t hole, or an ass hole, all three should illicit the same response, but that simply doesn't happen. The demonizing of specific words has, in a way dumbed down our society. Or perhaps, it is just a symtom of that dumbing down. Either way, in the case of these type of words, they cannot be bad words because they are still valid in use of very real things. If I say bitch, why should that get someone more angry than a female dog? They are the same thing, and bitch is still used in dog shows and by dog trainers today. Another word, hell, is sometimes demonize, like when someone says "what the hell" or "go to hell". How can a word be a "bad word" when that word is in the bible? The bible is the most widely read book among those of faith in our country today. Yet most who read it would list "hell" as a bad word. That doesn't even make sense. It is the feelings conveyed, the idea conveyed, that should be what gets to people, not specific words, and especially not words that! have actual common uses.

3. Swear words are bad ! because the bible says so.

Now, this one is one of my favorites because it is simply a misunderstanding or lack of knowledge that causes this belief. Now, I could go into the myriad of ways in which "using gods name in vain" is specifically bad in the bible. I could go on about how "in vain" doesn't mean the same thing it does now, and that "in vain" is not as good a translation as "in a falsehood" according to the direct hebrew translation bible. This would mean that swearing in gods name, that is, making an oath in gods name, is what it is prohibiting. But thats not nearly as relevant. Why? Because, GOD is a generic term not used in the bible. God and Lord are not the names of God. In the Old Testament, God is given the name El half of the time, and Yahweh the other half of the time. Those of the Yahweh persuasion deemed his name so holy that it couldn't be written or spoken. Thus, in the original OT text, YHWH is written, not Yahweh. These are the names of ! god, and those are what you should not say in falsehood. God damn it, could mean any god or gods. God is a generic term used for any and every other deity. In english, we capitalize the word to mean THE god, by which we mean the christian god. This capitalization in no way indicates that this is the name of god. It is ignorant to say so! Thus god damn it cannot be taking "the name of the lord your god in vain" because you aren't using "the name of the lord your god in vain".

Moving to the new testament, christians like to quote Ephesians 4:29 "Do not let any unwholesome talk come out of your mouths, but only what is helpful for building others up according to their needs, that it may benefit those who listen.".
Now, to many, this means, no swearing. However, we have already discussed the problem with that. I can say something so foul and insulting that you should be left embarassed with out ever saying a "swear" word. So, is it okay to say somethin! g nasty as long as I don't swear? I have met many christians w! ho seem to think so. They never swear but they sure say some mean things about people and too them. Surely you can't think that the christian god is so lame and shallow as to think that only words deemed socially bad are things you can't say? No, that is a ridiculous premise. And until christians stop saying bad things about people in a nice or non-swear word laden way, they cannot claim this scripture for anything, especially swear words. The simple reality about this is this. If I say you are the best damn piano player in the whole fuckin world, that is a nice thing I just said about you. Nothing unwholesome was said of you. Yet if you are a christian, you are likely going to be offended. But I clearly didn't violate any religious principles in the bible. What I violated was your self installed, socially generated sense of what particular words are acceptable. And that is not enough to decide that one particular word, rather than what the words mean, is bad or offensive. !

Conclusion:

In the conclusion I want to address one further complaint about swearing. It is usually given by people who consider them selves intellectuals or intelligent. They like to say swear words are only used by those who aren't smart enough to articulate their feelings. That intelligent people don't need to use swear words. Well, I call them like I see them. And that is bull shit. As long as society views specific words as "bad" then they will continue to have a bigger impact on people than spelling out the actually feeling or action you wish to convey. If I say "I am very angry and am not going to do what you say no matter what you tell me so just leave me alone" it doesn't have the power that "kiss my ass!" does. As well, it shortens the discourse considerably when using swear words to convey feelings either in anger or in jest. Simply using one word over another, as long as it is in proper usage, does not make on inferior or less int! elligent. Fact is, if I don't use swear words, many people si! mply don 't understand what I just said. So in some ways, it is easier to communicate with people using swear words.

If we want to advance in our society, we must learn to get past such pettying labeling as "bad words". Words are just words. What I am MEANING is much more important than the actual words used. Words are a tool that, in and of themselves, cannot be inherently bad or good, they simply are. They are there to use when we need them to convey actions, requests, feelings, desires, pain, pleasure and so much more. The sooner we learn thes, the sooner we can move on to actually discussing issues that really matter, and give a big FUCK YOU to people whose only recourse in a discussion is to demonize the actual words you use, in place of real discussion.

big words and definitions

Snap Game for Factoring Trinomials

This game of Snap is one that your students can play on the computer to practice factoring trinomials. One card displaying a quadratic equation is shown, and the other pile of cards is made up of factors of quadratic equations. Cards from this pile are flipped over. You "snap" when the factors from a card in this pile match up to the quadratic equation shown. This would be easy to make up several  decks of cards for different students to play on their own for extra practice and a little fun competition.

Solving quadratic equations by factoring

Infinite Geometric Series


OVERVIEW:

  • Finding the Sum of Numbers in a Sequence
  • Sigma Notation
  • Infinite geometric series Formula

Finding the Sum of Numbers in a Sequence
(a) What is the sum of the integers from 1 to 5000?

Credit to Paul for being our Gauss today.

We imagine the se! quence of all the numbers 1 to 5000 in the top row while the bottom row has all the numbers from 5000 to 1.

Example:
1, 2, 3, ... 5000
5000, 4999, 4998, ... 1

We find the sum of each column in our table and see that they're all 5001. Refer to slide 4 of June 3's slide for a better understanding of what I'm talking about.

We know that there are 5000 of these terms. We also know that if we want to find the sum of the integers between 1 to 5000, then we would have to multiply the number of terms by the total we have then divide by 2. We divided by 2 because there were two sequences we added.

Example: 5000 * 5001 / 2 = 12 502 500

Another way of solving this problem is to pull out the equation (found on June 3's slide #7) and plugging in the appropriate numbers, which Mr. K has a distaste for using this method because we're not really understanding the concept but just plugging numbers into an equation.

(b) What is the sum of all m! ultiples of 7 between 1 & 5000?

The lowest multiple of 7 between 1 and 5000 is 7.
The highest multiple of 7 between 1 and 5000 is 4998.
There are 714 terms that are multiples of 7 between 1 and 5000.

We then imagine, again, that table, listing all the numbers in the sequence from 1 to 5000 (that are multiples of 7) in the top row and all the numbers in the sequence from 5000 to 1 (that are multiples of 7) in the bottom row, and find the sum of each column.

Example:
7, 14, 21, ..., 4998
4998, 4991, 4984, ..., 7

Add the top row and the bottom row, and you find that under each column in our imaginary table is 5005.

We multiplied the number of multiples of 7 between 1 and 5000 by the sum of the first and last terms of the sequence and divided that by 2 because we've counted the sequence twice and we get 1 786 785.

(c) What is the sum of all integers from 1 to! 5000 inclusive that are not multiples of 7?

Well, we have the sum of all the integers from 1 to 5000. We have the sum of all the multiples of 7 between 1 and 5000. So if we find the difference of those two numbers, we find the sum of all the integers from 1 to 5000 inclusive that are not multiples of 7.

12 502 500 - 1 786 785 = 10 715 715

Sigma Notation
Left Question:
  • The k = 1 means that you start with 1 and evaluate 3k.
  • The! number above the sigma symbol, 4, means to keep evaluating 3k! until k = 4, then add all the terms.

Right Question:
  • The k = 0 means that you start with 0 and evaluate 2^k.
  • The number above the sigma symbol, 3, means to keep evaluating 2^k until k = 3, then add all the terms.

Then Mr. K says to find another sigma notation that is equivalent to the two questions on the slide. Of course, "mathematics is the science of patterns" is the common phrase that Mr. K always says, and yes, there're patterns here.

Also, a quick way of figuring out the answer to the sigma notation in question is to add the first and last term, then multiply by 2. Example: In the left question, [3(1) + 3(4)] * 2 = 30


Infinite geometric series Formula

The formula given in the above slide is something that we already derived from the previous class.

To answer the question "why is that the formula?" let's first use an example to help better our understanding of infinite geometric series. We make a square, cut it in half, and shade the half. We take the unshaded region of the square, cut that in half, and shade the half. Then we take another unshaded region of the square, cut that in half, and shade that half, and so on. So, firstly, we got 1/2 of the square shaded, then 1/2 + 1/4 shaded, then 1/2 + 1/4 + 1/8 shaded, then 1/2 + 1/4 + 1/8 + 1/16 s! haded, and so on. If we continue this pattern and keep cutting! and sha ding the square in half an infinite number of times, then we would've a shaded square.

1/2 + 1/4 + 1/8 + 1/16 + 1/32 ... = 1

The formula that we derived from the previous class was

Sn = t1*(1-r^infinity) / (1-r)

If we take r and raise it to the power of infinity, that would equal zero.
Example: r = 1/2

1/2 * 1/2 * 1/2 * 1/2 ... = 0

So, in the part of the formula where it says (1-r^infinity), that part of the formula is going to equal (1-0) = 1 anyways, and multiplying a number by 1 won't really have a visible effect. It's more efficient to just not include the (1-r^infinity) into the formula.

Plug in the numbers into the equation, BING! BANG! BOOM! you have the result. Have a nice day.


END NOTES
  • Start on Exercise 47: Infinite geometric series. You should have finish! ed all the questions in the exercise book up to 47.
  • Tomorrow, we will finish off the lesson the infinite geometric series.
  • Hopefully, we will be on task and finish the course tomorrow, and do a review on Friday.
  • Next scribe is Francis.

geometric series