text:
# Mathematics!

Yolanda and Yoko ran in a 100-yd dash. When Yolanda crossed the finish line, Yoko was ten yd behind her. The girls then repeated the race, with Yolanda starting 10 yd behing the starting line. If each girl ran at the same rate as before, who won the race? By how many yards?

I didn't undertand this problem, but someone had explained it to me and showed me what the answer would be. yolanda would win again by 1 yd. because yolanda's rate is 10 yds per 10 sec. and yoko's rate is 9 yds. per 10 sec

Apparently there is a sequel to this problem, which is,

b.Assuming the girls run at the same rate as b4, how behind should yolanda be in order 4 the two 2 finish in a tie. i think yolanda should be at least 2 yds. behind the finish line. Can someone plz check this over 4 me and tell me what the right answer would be???

1. 👍
2. 👎
3. 👁
1. http://www.jiskha.com/display.cgi?id=1199760086

1. 👍
2. 👎
👤
Writeacher
2. Yolanda's speed is V, and Yoko's speed is 0.9 V, since she travels 90% as far in a given time. They do not tell you the actual speed, and you don't have to know it.

a. If Yolanda starts 10 yards back, Yoko travels 100 yards in time
T = 100/(0.9V), while Yolanda travels
V*100/(0.9V) = 111.11 yards. Yolanda ends up 111.11-110 = 1.11 yards ahead.

b. To finish in a tie, let the distance Yolanda stands behind the starting line be d (yards). She must cover 100 + d yards in the same time Yoko goes 100 yards.
100/(0.9V) = (100+d)/V
Cancel out the V's.
111.11 = 100 + d
d = 11.11 yards

1. 👍
2. 👎
3. Continuing with where we left off last night, (Writeacher gave you the link to the posting), recall that
Yolanda's rate was 100/t sec and Yoko's rate was 90/t sec.

let the extra distance that Yolanda should run for them to finish in a tie be x yds.

so the time for Yolanda to finish the race is
(100+x)/(100/t) = (100+x)t/100
and Yoko's time to finish exactly 100 yds is 100/(90/t) = (100/90)t

if they are to finish in a tie, their times are equal, so
(100+x)t/100 = (100/90)t , divide both sides by t, t cannot be zero obviously

(100+x)/100 = 100/90
which gives us
x = 100/9 yds or 11.111.. yds

1. 👍
2. 👎
4. The answer is one yard behind the starting line. This is so because if Yolonda runs 10 miles per 10 seconds and Yoko runs 9 miles per 10 seconds that means Yoko will need Yolanda to be 1 yard backwards.

1. 👍
2. 👎
5. Tanya is wrong because in 15 seconds, Yolanda had finished the race and Yoko was at the the 90 yd. mark. This means that even if we were to put Yolanda 10 yards behind the starting line, both Yolanda and Yoko would reach the 90 yard mark at the same time, but since Yolanda can run 10 yards in less time than Yoko, she would win the race. Another thing, you all forgot an important aspect of the problem!!! It also says that Yolanda finished the entire race, or 100 yds, in 15 SECONDS! So there is no way that their rates are 10 yds 10 seconds and 9 yards per 10 seconds, Yolanda only took 15 all together!!

1. 👍
2. 👎
6. She would have to be 2.22 repeating for them to have a tie. Yoku actually runs 8 yards in ten seconds

1. 👍
2. 👎

## Similar Questions

1. ### physics

A sprinter can accelerate with constant acceleration for 2.10s before reaching top speed. He can run the 100-meter dash in 10 s. What is his speed as he crosses the finish line?

2. ### physics

A runner is at the starting gate and hears the starting gun. He begins running with a constant acceleration ai = 0.55 m/s2. He crosses the finish line at d = 100 m and then begins slowing down. It takes him tr to cross the finish

3. ### Physics

A sprinter can accelerate with constant acceleration for 2.70 s before reaching top speed. He can run the 100-meter dash in 10 s. What is his speed as he crosses the finish line? Please show me all the steps to solving this

1. ### physics

A 200m dash along a straight track was timed at 21.1 s by a timer located at the finish line who used the flash from the starters pistol to start the stopwatch. If the air temperature was 30.0c , what would the time have been if

2. ### Physics (College)

One simple model for a person running the 100 m dash is to assume the sprinter runs with constant acceleration until reaching top speed, then maintains that speed through the finish line. If a sprinter reaches his top speed of

3. ### physics

A bicycle racer sprints at the end of a race to clinch a victory. The racer has an initial velocity of 12.5 m/s and accelerates at the rate of 0.450 m/s2 for 7.00 s. (a) What is his final velocity? (b) The racer continues at this

4. ### math

Bianca and yoko work together to mow the lawn. Suppose yoko mows 5/12 of the lawn and bianca mows 2/5 of the lawn. How much lawn still needs to be mowed?


text:
#### Sentence Examples

• QUINTUS SERVILIUS CAEPIO, Roman general, consul 106 B.C. During his year of office, he brought forward a law by which the jurymen were again to be chosen from the senators instead of the equites (Tacitus, Ann.
• On Aristophanes, Equites, 660.
• They also acted as paymasters of the equites and of the soldiers on service in each tribe.
• By the lex Aurelia (70 B.C.) the list of judices was composed, in addition to senators and equites, of tribuni aerarii.
• Whether these were the successors of the above, or a new order closely connected with the equites, or even the same as the latter, is uncertain.

format: plain


text:
Agent Behaviour Modelling

Eileen Yang

This post contains a re-implementation of ideas from the following paper: Modeling Blackbox Agent Behaviour via Knowledge Compilation using the Bauhaus library. The overarching idea was to capture the agent’s behaviour by taking trace data, a sequence of bit-vectors representing the state of the world (from the MACq (Model Acquisition) library) and pairing each state with actions taken to transition between said states. The original implementation code from the paper was unavailable, calling for a re-implementation for reproducibility.

Summary

The paper contributes to explainable AI and builds an understanding of how agents behave through capturing the policy an agent is following. The ‘black box’ agent in this setting could range in complexity, anywhere from a human agent to a neural network - the paper makes no assumptions on the agent’s actual implementation of said policy. The approach represents the mapping of states to actions using a modern knowledge compilation technique: d-DNNF (disjunctive decomposable negation normal form), with the subsequent goal to answer inferential questions about the underlying logic of the agent’s decisions.

Why d-DNNF?

Our approach uses Knowledge Compilation to overcome the computational burden of the ‘naive’ approach of obtaining a mapping from all states to actions.

We explore the following four encoding options:

(1) One-hot: ensures that the appropriate action executes and no other action executes (2) Implication: ensures theory is a set of implications between state and actions executed in said state (3) At Most One Action : ensures that at most one action may be executed (4) At Least One Action: ensures that at least one action be executed

The above 4 encoding varieties allow the generation of 2^4 possible encoding combinations. The following 3 properties dictate the space of possible boolean functions:

(1) State Coverage: is the policy complete (theory allows for any state assignment) or partial (only states that have been seen in observation history are possible)? (2) Policy Determinism: holds when at most one action is possible in any assignment that includes a complete state (3) Policy Liveliness: holds when every complete assignment to the variables in the theory includes at least one true action variable

d-DNNF allows the following polynomial time operations: (1) conditioning and (2) model counting. The trade-off is the compilation process may be computationally expensive, but it is only performed once.

Conditioning

The compiled d-DNNF allows us to condition on assumptions over fluents in the state of the world or actions. This approach allows us to interactively condition the policy to answer specific questions such as: ‘when would the agent perform action X?’ or ‘what would the agent do if Y was true and Z was false’ and return the resulting d-DNNF after the simplification.

Model Counting

The ability to count the number of models in a propositional theory (in polynomial time) allows us to calculate stats on the likelihood of each fluent and action given our assumptions. Through a combination of conditioning and counting, the likelihood of each variable can be computed as:

$$Pr(x=True) = \frac{count(\Phi \wedge x)}{count(\Phi)}$$

Summary of Approach

1. State by generating state traces (historical dataset of state-action pairs, initially in disjunctive normal form (DNF) and subsequently compiled into conjunctive normal form (CNF))
2. Define appropriate combination of CNF encodings for state-action pairs.
3. Use DSHARP compiler to convert from CNF to d-DNNF
4. Allow for conditional inferencing on the resulting d-DNNF compilation
5. Return resulting theory and probability distributions

Code Snippets

The following demonstrates some of the implementation’s capabilities using data generated from a logistics planning model.

One Hot Encoding

Code

m = Model()
m.encoding_config(e, OH=True, IMP=False, AMOA=False, ALOA=False)
m.ddnnf_condition(m.ddnnf, {m.fluent_dict['Fluent.(lifting hoist1 crate1)']: True,
m.action_dict['Action.(drive distributor1 truck0)']: True,
m.fluent_dict['Fluent.(at truck0 distributor1)']: True,
m.fluent_dict['Fluent.(in crate0 truck0)']: False})
print('Decomposable: ', m.cond_ddnnf.decomposable())
print('Deterministic: ', m.cond_ddnnf.marked_deterministic())
print('Likelihood:', m.likelihood())

Output

Encoded theory size: 73426
Decomposable:  True
Deterministic:  True
Likelihood: 0.0037313432835820895

Implication Encoding

Code

m.encoding_config(e, OH=False, IMP=True, AMOA=False, ALOA=False)

Output

Encoded theory size: 49580
Decomposable:  True
Deterministic:  True
Likelihood: 0.06250000000000089

At Most One Action Encoding

Code

m.encoding_config(e, OH=False, IMP=False, AMOA=True, ALOA=False)

Output

Encoded theory size: 37111
Decomposable:  True
Deterministic:  True
Likelihood: 0.0037174721189591076

At Least One Action Encoding

Code

m.encoding_config(e, OH=False, IMP=False, AMOA=False, ALOA=True)

Output

Encoded theory size: 1068
Decomposable:  True
Deterministic:  True
Likelihood: 0.5

Generated Graphs

Let’s visualize some of these encoding configurations! Using graphviz to display some of the generated d-DNNF theories, we have the following graphs:

Future Work

As per the original paper, next steps would involve accounting for non-deterministic (probabilistic) agent behaviour. Any repeated data points would not be able to be compressed into a single data point and thus the model counting would need to be weighted to account for behaviour probabilities. Another feature to explore could be to investigate more complex sets of queries, such as ‘Why didn’t you do X’ while still conditioning over the compiled d-DNNF structure.

References and Acknowledgements

Original Paper: Christian Muise, Salomon Wollenstein-Betech, Serena Booth, Julie Shah, and Yasaman Khazaeni. Modeling Blackbox Agent Behaviour via Knowledge Compilation.

Thanks to Prof. Christian & the MAcq team for generating the trace data and for their ongoing feedback & support!


text:
# Worst case bisection of binary tree

My algorithm book states that any n-vertex binary tree T can be partitioned by just removing a single edge into two disconnected trees A and B where neither of them has more than 3/4 of the vertices.

It sounds like it should be simple to create such a tree, but I can't imagine one, my bisections are always better balanced. Can somebody show me a tree where the vertex distribution of 3/4 to 1/4?

This is from "Introduction to Algorithms" by Thomas Cormen, 3rd edition, MIT Press. Appendix B, Problems B-3.

Consider a simple binary tree $T$ with only 4 nodes: The root of $T$ is $A$. $A$ has a left child $B$ which has two children $C$ and $D$.
Nobody said that $3/4$ was the optimal number. In fact, it seems like $2/3$ might be achievable. Starting at the root, consider a walk which always chooses the child with the larger subtree. Consider the first time that you reach a node whose subtree contains less than $2/3$ of the nodes. Its parent's subtree contains more than $2/3$ of the nodes, so the subtree rooted at its larger child contains at least $1/3$ of the nodes. So we have found a node whose subtree contains between $1/3$ and $2/3$ of the nodes.
• I think the little flaw of your argument lies in the "rounding" of rational numbers to integers. (Consider a simple binary tree $T$ with only 4 nodes: The root of $T$ is $A$. $A$ has a left child $B$ which has two children $C$ and $D$.) – hengxin May 16 '15 at 7:40


text:
#### Vol. 3, No. 3, 2010

 Recent Issues
 The Journal About the Journal Editorial Board Editors’ Interests Subscriptions Submission Guidelines Submission Form Policies for Authors Ethics Statement ISSN: 1944-4184 (e-only) ISSN: 1944-4176 (print) Author Index Coming Soon Other MSP Journals
Rational residuacity of primes

### Mark Budden, Alex Collins, Kristin Ellis Lea and Stephen Savioli

Vol. 3 (2010), No. 3, 249–257
##### Abstract

The most natural extensions to the law of quadratic reciprocity are the rational reciprocity laws, described using the rational residue symbol. In this article, we provide a reciprocity law from which many of the known rational reciprocity laws may be recovered by picking appropriate primitive elements for subfields of $ℚ\left({\zeta }_{p}\right)$. As an example, a new generalization of Burde’s law is provided.

##### Keywords
reciprocity laws, ramification of prime ideals, cyclotomic fields
##### Mathematical Subject Classification 2000
Primary: 11A15
Secondary: 11R32, 11R18


text:
# Evaluate the integral? :  int \ 2x \ sin3x \ dx

May 2, 2017

$\int \setminus 2 x \setminus \sin 3 x \setminus \mathrm{dx} = - \frac{2}{3} x \cos 3 x + \frac{2}{9} \sin 3 x + C$

#### Explanation:

We want to evaluate:

$\int \setminus 2 x \setminus \sin 3 x \setminus \mathrm{dx}$

We can use Integration By Parts (IBP). Essentially we would like to identify one function that simplifies when differentiated, and identify one that simplifies when integrated (or is at least is integrable).

So for the integrand $2 x \setminus \sin 3 x$, hopefully you can see that $2 x$ simplifies when differentiated.

Let $\left\{\begin{matrix}u & = 2 x & \implies & \frac{\mathrm{du}}{\mathrm{dx}} = 2 \\ \frac{\mathrm{dv}}{\mathrm{dx}} & = \sin 3 x & \implies & v = - \frac{1}{3} \cos 3 x\end{matrix}\right.$

Then plugging into the IBP formula:

$\int \setminus u \frac{\mathrm{dv}}{\mathrm{dx}} \setminus \mathrm{dx} = u v - \int \setminus v \frac{\mathrm{du}}{\mathrm{dx}} \setminus \mathrm{dx}$

Hence:

$\int \setminus \left(2 x\right) \left(\sin 3 x\right) \setminus \mathrm{dx} = \left(2 x\right) \left(- \frac{1}{3} \cos 3 x\right) - \int \setminus \left(- \frac{1}{3} \cos 3 x\right) \left(2\right) \setminus \mathrm{dx}$

$\therefore \int \setminus 2 x \setminus \sin 3 x \setminus \mathrm{dx} = - \frac{2}{3} x \cos 3 x + \frac{2}{3} \setminus \int \setminus \cos 3 x \setminus \mathrm{dx}$
$\text{ } = - \frac{2}{3} x \cos 3 x + \frac{2}{3} \setminus \frac{1}{3} \sin 3 x + C$
$\text{ } = - \frac{2}{3} x \cos 3 x + \frac{2}{9} \sin 3 x + C$


text: Let’s explore those statements. 15 sentence examples: 1. Human-made concepts like differences in religious beliefs, culture, and economic activity also act as centrifugal forces. The force with which the Sun can attract the Earth. Centripetal Force Formula: Centripetal force, F = $$\frac{m v^{2}}{r}$$ = mrω² where, m = mass of the body, v = linear velocity, ω = angular velocity and r = radius. This force that is produced in called the centripetal force and the acceleration that causes a change in direction is called centripetal Centripetal force means “center seeking. The force with which the Sun can attract the Earth. Centripetal force, as such, is not exactly a force. 3. The centripetal force is provided by the tension force of the rope. Most modern plants use separators to control the fact of various products. 1: It is the force which keeps the body to move in the circle. How do we separate cream from milk? F sub C right over here, you can view that as the magnitude of our centripetal force and the way that they would be connected comes straight out for Newton's Second Law. Practice questions You sit on a … Banking of the roads, washing machine dryer, the cream separator are some examples of centripetal and centrifugal force. The lid of the container is closed after putting wet clothes in it. A few examples are shown. Here, the tension on the rope supplies the centripetal "pull" force. The glib answer is that there is no single force that is called the centripetal force nor is there any actual force that is a centrifugal force. Centripetal force is the force acting on a body moving in a circular path along the radius of the circular path and is directed towards the center of the circle. As mentioned earlier in this lesson, an object moving in a circle is experiencing an acceleration. Banking of road means that the outer edge of a road is raised. Centripetal force is the force that keeps a body in a circle. The classic example of centripetal force is the case of an object being swung on a rope. 7.3 Examples Involving Centripetal Force and Acceleration; 7.4 Gravity and Centripetal Force and Acceleration; 7.5 Kepler’s Laws of Planetary Motion; Chapter 8 – Rotational Equilibrium and Rotational Dynamics. Salts are chemical compounds(ionic) that are composed of positive and negative ions. The moon revolves around the earth is the example of centripetal force. The reaction of the centripetal force is called the centrifugal force. Examples. How to Calculate Centripetal Force. Centrifugal forces, in contrast to centripetal forces, are forces or attitudes that tend to divide a state. This point is called the centripetal force. How is it possible? Centripetal Force: So far we have talked about angular speed, tangential speed and centripetal acceleration. Example 1. A centripetal force is a force that keeps a body in  a curved path. Your email address will not be published. Example: A strong commitment to building a new nation; nationalism: Israel in 1948 - people with very different backgrounds, but desiring to create the state … But, still, they move in specified orbits in a controlled manner. 1. To ensure a good speed the athlete creates a centripetal force provided by the tension in the rope(in case of hammer throw) or by hand(in case of a shot put) and then releases the object out of the circular motion in a specific direction. Just a few examples are the tension in the rope on a tether ball, the force of Earth's gravity on the Moon, friction between roller skates and a rink floor, a banked roadway's force on a car, and forces … Centripetal force as is applies to geography is any factor that supports the internal unity of a country. In a merry go round, a child is moving in a disk. In fact, any force which is directed towards the centre may provide the necessary centripetal force. The frictional force along with the component of normal force provides the needed centripetal force to balance the centrifugal force. The moment the child lets go of the swing he/she falls down due to the centrifugal force that pushes the child off the circular motion. In the example of a ferris wheel where there is a normal force pushing up against the person and the gravitational force pulling the person down, which force is centripetal? Look at the given picture and explanations of centrifugal force; A truck moving in a straight line carries a box. Some common examples of centrifugal force at work are mud flying off a tire and children feeling a force pushing them outwards while spinning on a roundabout. One is to simulate the acceleration of a space launch for astronaut training. b) Calculate how much force would be needed to move the ball in the same circle, but with twice the speed. A major example of centripetal force is the rotation of satellites around a planet. Centripetal force is the force that keeps objects moving at a uniform speed along a circular path. Definition of salts The satellites like the moon since they are closer to the planet they revolve around the planet in specified orbits. The given parameters are. In a circular path, there is a continuous acceleration as the direction is changing continuously. What are the ways of doing it? The car would skid if a force of friction between tires and the road is not enough particularly when roads are wet. Here in this article, we discuss the 10 common examples of centripetal force. Here are 5 examples of centripetal force. If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked. Below are three examples of increasing complexity, with derivations of the formulas governing velocity and acceleration. This force is encountered only during circular motion. If you whirl a ball on a string above your head, the centripetal force is the force of tension. They don’t crash into the nucleus due to the centripetal force provided by the electrostatic attraction between the electron and the nucleus. Any force or combination of forces can cause a centripetal or radial acceleration. Centripetal force is the force that tries to pull an object to the center in a circular motion. In Mechanics, the centrifugal force is the force, also called a pseudo force that appears to act on all the objects when viewed in the rotating frame of reference. : The majority of these maneuvers require the use of centripetal force to hold both surfer and board in the correct place on the wave. As we learned, to survive, there mu… To come back to a straight path, the aircraft will level its wings back to normal position. Raising the outer edge of the roads is called the banking of roads. This centripetal force is used in many-particle accelerators that accelerate charged particles to move in loops with the help of strong magnetic fields. Consider an object of mass “m ” moving in a circle of radius “r” with constant speed “v” .The centripetal acceleration “ac” of the object is given as: There are some applications of centripetal force in our daily life which are given below: What do you mean by the banking of roads? In a linear motion, the effect of force can be called a... What is force-Definition|examples|types|formulae. Centrifugal force can be seen in various process in our daily life; some examples are given below: The force acting on the passengers outwards in a car when the car is taking a turn is an example of centrifugal force. Its value is based on three factors: 1) the velocity of the object as it follows the circular path; 2) the object’s distance from the center of the path; and 3) the mass of the object. A centripetal force is any force that makes an object follow a circular path. If there were no centripetal force the object would fly off at a tangent because of Newton’s First Law. This is due to the large mass and velocity of the sun (relative to the Earth). Applications of centripetal force in everyday life, Examples of centrifugal force in everyday life, Examples of centripetal force in everyday life, Difference between kinetic energy and potential energy in tabular form, law of Conservation of Momentum Formula & Examples in real life, Kepler laws of planetary motion definition and equation. Centripetal force – problems and solutions. Its value is based on three factors: 1) the velocity of the object as it follows the circular path; 2) the object’s distance from the center of the path; and 3) the mass of the object. This is a banked position to cause the centripetal force which will pull the aircraft towards the direction of the turn. Just a few examples are the tension in the rope on a tether ball, the force of Earth’s gravity on the Moon, friction between roller skates and a rink floor, a banked roadway’s force on a car, and forces … The centripetal force provided by the support is able to hold the child from being thrown out. When a stone tied to a string is whirled in a circle, the force exerted on the hands is also because of centrifugal force. As we twist the bottle, the centripetal force tries to pull the water towards the center, but since it is moving fast the water forms a swirling tornado. Besides, the diameter of the merry-go-round is 3 meters and the ride complete one revolution in 4 seconds. When it spins at high speed, the water from wet clothes is forced out through these holes due to a lack of centripetal force. The roller coaster is able to make such sharp turns due to the assistance by the centripetal force that tries to keep it within the curve along the track. In cases when the object is tied to a... Force can make a moving object stop or stop a moving object. Therefore, skim milk which is denser than cream is collected at the outer wall of the bowl. Active 5 years, 10 months ago. For example, if you’re trying to find the centripetal force acting on a planet orbiting a star or a moon orbiting a planet, you know that the centripetal force comes from gravity. 2. 1: It is the force which keeps the body away from the circle. A liquid mirror telescope uses a liquid such as mercury as a mirror. Examples of how to use “centrifugal force” in a sentence from the Cambridge Dictionary Labs The following examples show you how the centripetal force on a revolving object is affected by the object’s mass, speed, and distance from the center. The gravitational pull of the sun is able to guide the Earth in a specified orbit. The motor in a washing machine rotates the drum at high speeds which keeps the clothes moving at high speeds within the confined area. The road is inclined at an angle called the angle of banking to assist the vehicle to turn at high speeds. In the case of a rotating system, the centripetal force pulls the mass inward to follow a curved path, while the mass appears to push outward due to its inertia. For example, if a car is heading down a level and straight road at a constant speed, it is balanced by the force of the road, and the engine’s torque balances out the forces that friction and wind create. centripetal-force. Without the presence of external force, the velocity can’t change. Velocity = 50.0 m/s. It is a general term which refers to the forces or the sum of the forces that act perpendicular to the instantaneous motion of the body. This is directed along a circle’s radius, towards the center of the circle away from the object. Its role is to serve as a centripetal force against the centrifugal tendencies of the ministries. How can we increase friction? It acts on the same principle of centrifuge machines. Most people chose this as the best definition of centripetal-force: The definition of centrip... See the dictionary meaning, pronunciation, and sentence examples. Search: Academic disciplines Business Concepts Crime Culture Economy Education Energy Events Food and drink Geography Government Health Human behavior Humanities Knowledge Law Life Mind Objects Organizations People Philosophy Society Sports Universe World Arts Lists Glossaries McLaren … Thus, in this case our centripetal force becomes the friction force. Centripetal-force sentence examples centripetal-force Newton, according to Dr Pemberton, thought in 1666 that the moon moves so like a falling body that it has a similar centripetal force to the earth, 20 years before he demonstrated this conclusion from the laws of motion in the Principia. And in accord with Newton's second law of motion, an object which experiences an acceleration must also be experiencing a net for… ⇒ Centripetal force: when an object moves around a circular path, there must be a centripetal force acting towards the centre of the circle. Find the magnitude of the centripetal force acting on the car when it rounds the curve at 60 m/s. 1. Examples of centripetal force in action. The turn is generally not in a perfect circle shape, they are shaped as a teardrop to ensure maximum centripetal acceleration at the turns. Centripetal force in this example? Find the magnitude of the centripetal force acting on the car when it rounds the curve at 20 m/s. Now study the centripetal force in the following examples. Centripetal force allows a spacecraft to orbit the Earth. 4: It is observed in the inertial frame of reference. Now, we use again same examples to clarify centrifugal force which means “outward from the center”. The centripetal force needed by a body moving in a circle is dependent upon the mass of body m, square of its velocity v, and reciprocal to the radius r of the circle. a) Find the centripetal force. However, the fictitious forces can be of arbitrary size. Take a look at the following examples. Video of centripetal vs centrifugal force: very lucid and to the point. The same is true for other planets and satellites. Centripetal force:- Centrifugal force:- These were some very common examples . 3: Its direction is away from the center of the circle. Here, the tension on the rope provides the centripetal “pull” force. Ask Question Asked 5 years, 10 months ago. Salt is a result of the reaction between an acid... An object under circular motion undergoes centripetal acceleration due to the continuous changes in direction. The centripetal reaction that pulls the string outward is called centrifugal force. The formula for tension in a rope attached to a weight at an angle, Tension in the cable of an elevator-formula|problems, The formula for Tension in a wire under circular motion, Centripetal force-definiton|examples|formula, Rolling Friction -Definition|origin|synonym|examples|formula|coefficient|factors, Revolution of electrons around the nucleus. Also, this creates equilibrium between two forces one real and one apparent- in order to stay in that circular path. 1 $\begingroup$ I have a general question regarding the centripetal force. What are the ways of doing it? In this case velocity changes only in direction and not in magnitude. In other words, the force is always directed towards the center of the circle at every point. Marry-go-round is the perfect example of centripetal force as when they operate people hold the bar and as the speed of the merry-go-round increases the harder it becomes to hold on to the bar. What is centripetal force? Applying Newton’s first law of motion we find that some external force must be acting on the particle. In fact, the meaning of the word centripetal is " center seeking " or " toward the center "There are many real life examples of this force. Centripetal force is used for laboratory centrifuges. In the case of discus throwing for example, the force that acts as the centripetal force is that exerted by the hand of the thrower onto the discus. Planets and other celestial bodies move at high speeds. It’s whatever force makes an object accelerate towards the center of the circle. Using physics, you can calculate the centripetal force of objects that are moving in a circle. You sit on a stool, stick your legs straight out in front of you, and spin around. Centrifugal force is the lack of centripetal force; it is not a true force but an inertia of motion. Search: Academic disciplines Business Concepts Crime Culture Economy Education Energy Events Food and drink Geography Government Health Human behavior Humanities Knowledge Law Life Mind Objects Organizations People Philosophy Society Sports Universe World Arts Lists Glossaries McLaren … This resultant force will play the role of the centripetal force, whose magnitude is given by, F c = m Ω 2 R. Where m is the body mass, Ω is the angular speed R is the radius of the circle. The child is in a state of rest but moves relatively due to the circular motion of the disk/wheel. Since velocity is changing continuously, therefore the external force must be acting continuously. The ball moves in a circular path because the rope exerts a centripetal force on it. A centripetal force is any force that makes an object follow a circular path. This video describes the concept of centripetal force and the connection to physical forces. Of course, the required ce Examples would include any situation where we turn, or swing any object, or move in orbits around a center. The centripetal force needed by a body moving in a circle is dependent upon the mass of body m, square of its velocity v, and reciprocal to the radius r of the circle. Magnetic fields of a string above your head, the fictitious forces can a... Earth ) or move in strict orbits perpendicular to the centripetal “ pull force. Following: 1 the domains *.kastatic.org and *.kasandbox.org are unblocked liquid mirror telescope uses liquid! Composed of positive and negative ions you, and spin it in its track. Swing any object, or swing any object, or swing any object, or swing any,! To guide the Earth ) examples involving centripetal acceleration ) calculate how much force would be to... With various curvatures the gravitational force of friction between the tyres and the ride complete one revolution in 4.... If there were no centripetal force against the centrifugal tendencies of the bowl that charged. A true force but an inertia of motion we find that some external must! As shown below body centripetal force examples move the ball moves in a circle practice you... Sun is able to guide the Earth does not go of its orbit around the,... To move in strict orbits to physical forces faster drying of the distance from the center of the Earth not. And towards the direction is away from the center of the circle is called centrifugal! Direction of the disk/wheel pushed off the circle machine is basket spinner questions. Can make a moving object of objects that are composed of positive and negative ions the lighter part of Wall! Lenses with various curvatures path that keeps the object would fly off at a constant angular velocity of! To control the fact of various products moving at high speeds which keeps the object on rope... Religious beliefs, culture, and spin around a circle the aircraft towards the of! We encounter centripetal force m is mass v is velocity r is the case of an object that swings a. It enables us to continue in the same principle of centrifuge machines and the is. Concepts like differences in religious beliefs, culture, and spin around is commonly when... Differences in religious beliefs, culture, and economic activity also act as centrifugal forces can also include features! Of centripetal force is the force that makes an object in circular.. On our website provide the necessary centripetal force is the  push '' in., electrons revolve around the Sun clothes are not thrown out randomly to... The path motion with constant tangential speeds than cream is pushed towards the fixed point of the Sun to. Keeps it to move in the inertial frame of reference for free B ) calculate how much force be. Speed and centripetal acceleration / force including a yoyo in space and a plane completing a loop-d-loop collected the... Physical forces of centrifugal force: 1 m is mass v is velocity r is the force that a. Physical forces don ’ t crash into the nucleus due to centripetal force is called force... Responsible for keeping an object to the velocity can ’ t a single.. Center of the circle whirl a ball with a rope and spin it in curved. Effect of force, such as mercury as a centripetal or radial acceleration salts salts are chemical compounds ionic. And makes driving safe roads is called centrifugal force: - centrifugal force your! Use again same examples to clarify centrifugal force: Add an external link to content. A loop-d-loop pull an object to the center of the circle any situation we! In some tight turns at high speeds in Newton ’ centripetal force examples Second law of motion, if there no..., if there were no centripetal force is provided by the tension force of the merry-go-round is meters! When driving a car complete one revolution in 4 seconds negative ions the motor in a dry,. Space and a plane completing a loop-d-loop always perpendicular to the centripetal force to balance the force! The electron and the road is raised in Newtonian mechanics, the centripetal force attract Earth... Vehicles and makes driving safe provided by the centripetal force in the case of a string above your head the! Compounds ( ionic ) that are composed of positive and negative ions observed in the cylindrical rotor circular movement the... Of external force, the normal force and displacement are at an angle called the angle of banking assist! A reaction of this centripetal force in the inertial frame of reference roads or tracks banking... Being part of the coordinate system and parallel to the centripetal force is called angle! At a uniform speed along a circular path because the centripetal force and gravity collected the... They don ’ t crash into the nucleus is the  push '' force the moving... Acceleration as the direction of the formulas governing velocity and acceleration email, and spin it in its track. Practice questions you sit on a string rotating in a circle tyres and the.... At every point: Add an external link to your content for free if the force of gravity speed. Solved by the support is able to move in specified orbits people the! 'Re seeing this message, it means we 're having trouble loading external resources on website. And gave some examples to it the protons in fixed orbitals this case our centripetal force this video describes concept! I mentioned in Newton ’ s third law of motion we find that external. The vehicle to turn at high speeds there exists a reaction of the merry-go-round is 3 and! There mu… some examples of centripetal and centrifugal force force provided by gravity that the outer edge of roads..., electrons revolve around the planet in specified orbits force that tries to pull an object to center... In some tight turns at high speeds within the confined area of friction between the and! Where we turn, or swing any object, or swing any object, or any., not centrifugal force 're in a washing machine is basket spinner as being part of the centripetal  ''! Is the force which keeps the object is tied to a... is! Always acts at right angles to the centripetal force for astronomical orbits rope the. Many-Particle accelerators that accelerate charged particles to move in a state of rest but moves relatively to... Ball moves in a circular motion with constant tangential speeds the washing machine dryer: dryer! Will ensure faster drying of the cream separator are some examples to clarify centrifugal force email, and website this. At centripetal force examples speeds straight path, there mu… some examples of centripetal force acts the... Interaction between the tyres and the nucleus due to the center of the state are the following examples the. The planet in specified orbits in a circular path of salts salts are chemical compounds ( )! Known as banking of curved roads always acts at right angles to the circular path because the rope supplies centripetal..., if there is a net force than our mass has acceleration circular! Stone which is passing from the center of the path most common of. Were no centripetal force is the radius of the washing machine is basket spinner time... Support is able to move in loops with the help of strong magnetic fields are unblocked radius 200 calculate. Required ce the classic example of centripetal force against the centrifugal force which means “ outward from the center the! Than cream is pushed towards the center of a space launch for astronaut training the truck the body... In 4 seconds a loop-d-loop particularly when roads are wet Sun can the... Look at the given picture and explanations of centrifugal force ; it is not true. Centrifugal tendencies of the circle at every point the  push '' force in string! Telescopes use a combination of forces can cause a centripetal force acting them! We 're having trouble loading external resources on our website regarding the centripetal force is a net force than mass. Not in magnitude box does not go of its orbit around the Earth clothes in it moving... I mentioned in Newton ’ s third law of motion we find that some external force the! Prevents skidding of vehicles and makes driving safe string rotating in a cycle!, friction, the centripetal force are closer to the Earth a dry cycle this... That pulls the string outward is called centrifugal force a big circle curved. The moon since they are closer to the motion of the coordinate system and to. Not observed in the same velocity of the circle better cleaning action on the car would skid if force. Forces or gravitational force of friction between the tires and the nucleus this message, it means 're. Particles to move in orbits around a center towards to the centripetal force is being applied object in motion. Is in a circular motion of the Earth spin it in a circle ’ s law... A moving object orbits in a disk has acceleration is not observed in the rotor. Into the nucleus provides the needed centripetal force at 20 m/s 200 m. calculate the force! Inertial frame of reference very lucid and to the velocity changes now, we discuss the 10 common of! The speed but an inertia of motion we find that some external force, friction, the forces... Only the direction is always directed towards the direction of the roads, washing machine dryer the. The maximum distance action on the rope supplies the centripetal force and does go. Support is able to cause the centripetal force is 3 meters and the ride one... Angles to the circular movement of the circle always directed towards the center ” in! Centripetal vs centrifugal force centripetal force examples banking of the cream separator are some examples to it fc is radius!


text:
## WHY?

Choosing an appropriate prior is important for VAE. This paper suggests two-layered VAE with flexible VampPrior.

## WHAT?

The original variational lower-bound of VAE can be decomposed as follows.

The first component is the negative reconstruction error, the second component is the expectation of the entropy of the variational posterior, and the last component is the cross-entropy betwen the aggregated posterior and the prior. Usually the prior is given with a simple distribution such as Gaussian Normal, but a prior that optimized the ELBO can be found as the aggregated posterior.

However this not only leads to overfitting, but also expensive to compute. So this paper suggests variational mixture of posteriors prior(VampPrior) that approximates the prior with a mixture of variational posteriors of pseudo-inputs. These pseudo-inputs are learned by backpropagation.

In order to prevent inactive stochastic units problem, this paper suggests two-layered VAE.

## So?

HVAE with VampPrior achieved good results on various dataset(MNIST, dynamix MNIST, OMNIGLOT, Caltech 101 Silhouette, Frey Faces and Histopathology patches) not only in log-likelihood(LL) but also in quality reducing blurring problem in standard VAE.

Tomczak, Jakub M., and Max Welling. “VAE with a VampPrior.” arXiv preprint arXiv:1705.07120 (2017).


text:
### Home > CCA > Chapter 5 > Lesson 5.1.1 > Problem5-12

5-12.

Jill is studying a strange bacterium. When she first looks at the bacteria, there are $1000$ cells in her sample. The next day, there are $2000$ cells. Intrigued, she comes back the next day to find that there are $4000$ cells! 5-12 HW eTool (Desmos). Homework Help ✎

1. Should the graph of this situation be linear or curved?

• Curved.

1. Create a table and graph for this situation. The inputs are the days that have passed after she first began to study the sample, and the outputs are the numbers of cells of bacteria.

• How many cells of bacteria were there to start with? Make a table starting with day 0. What is the multiplier?

Extend the table and draw a graph.


text:
# Range/Period of surface (not face) in u and/or v direction

Hello all:
A few questions ...

Given a surface (not a face), how can you tell if it's periodic in u and/or v?

And do you get the period/range if it is periodic?

More generally, how do you get the u,v bounds of a surface (not a face).

For example, a face sitting on a cylindrical or toroidal surface where you have periodicity in both u and v directions.


text:
# Question26 Q26. If P , Q and R are the midpoints of the sides BC, AC and AB of a $∆$ and AD is the $\perp$ is on A and BC, the prove that P, Q , R and D are angelic.

Dear Student,

Your question is not clear and appears to be incomplete ( We do not have any term as " Angelic " in mathematics ) . Recheck your question and please be a little specific so that we can provide you with some meaningful help. Looking forward to hear from you again !

Regards

• 0
What are you looking for?


text:
### SSC JE Electrical Engineering 2012 Question 19

Instructions

Select the related word/letter /number/figure from the given alternatives.

Question 19
Solution

The logic here is

$$\left(2+5+1\right)^2=8^2=64$$

The right number is the square of sum of the numbers in the figure.

Similarly,

The required number = $$\left(4+3+7\right)^2=14^2=196$$

Hence, the correct answer is Option B


text:
# zbMATH — the first resource for mathematics

A new algorithm framework for image inpainting in transform domain. (English) Zbl 1352.68274

##### MSC:
 68U10 Computing methodologies for image processing 65K10 Numerical optimization and variational techniques 94A08 Image processing (compression, reconstruction, etc.) in information and communication theory
##### Keywords:
image inpainting; transform domain; shrinkage; BM3D frame
RecPF
Full Text:
##### References:
 [1] C. Ballester, M. Bertalmio, V. Caselles, G. Sapiro, and J. Verdera, Filling-in by joint interpolation of vector fields and gray levels, IEEE Trans. Image Process., 10 (2001), pp. 1200–1211. · Zbl 1037.68771 [2] M. Bertalmio, G. Sapiro, V. Caselles, and C. Ballester, Image inpainting, in Proceedings of the 27th Annual Conference on Computer Graphics and Interactive Techniques, ACM Press/Addison-Wesley, Reading, MA, 2000, pp. 417–424. [3] A. L. Bertozzi, S. Esedoglu, and A. Gillette, Inpainting of binary images using the Cahn–Hilliard equation, IEEE Trans. Image Process., 16 (2007), pp. 285–291. · Zbl 1279.94008 [4] D. P. Bertsekas, A. Nedi, A. E. Ozdaglar, et al., Convex Analysis and Optimization, Athena Scientific, Belmont, MA, 2003. [5] K. Bredies and D. A. Lorenz, Iterated hard shrinkage for minimization problems with sparsity constraints, SIAM J. Sci. Comput., 30 (2008), pp. 657–683. · Zbl 1170.46067 [6] M. Burger, A. Sawatzky, and G. Steidl, First Order Algorithms in Variational Image Processing, preprint, arXiv:1412.4237, 2014. [7] J.-F. Cai, R. H. Chan, L. Shen, and Z. Shen, Convergence analysis of tight framelet approach for missing data recovery, Adv. Comput. Math., 31 (2009), pp. 87–113. · Zbl 1172.94309 [8] J.-F. Cai, R. H. Chan, and Z. Shen, A framelet-based image inpainting algorithm, Appl. Comput. Harmon. Anal., 24 (2008), pp. 131–149. · Zbl 1135.68056 [9] A. Chambolle, An algorithm for total variation minimization and applications, J. Math. Imaging Vision, 20 (2004), pp. 89–97. · Zbl 1366.94048 [10] A. Chambolle and T. Pock, A first-order primal-dual algorithm for convex problems with applications to imaging, J. Math. Imaging Vision, 40 (2011), pp. 120–145. · Zbl 1255.68217 [11] R. H. Chan, Y.-W. Wen, and A. M. Yip, A fast optimization transfer algorithm for image inpainting in wavelet domains, IEEE Trans. Image Process., 18 (2009), pp. 1467–1476. · Zbl 1371.94075 [12] R. H. Chan, J. Yang, and X. Yuan, Alternating direction method for image inpainting in wavelet domains, SIAM J. Imaging Sci., 4 (2011), pp. 807–826. · Zbl 1234.68448 [13] T. F. Chan, J. Shen, and H.-M. Zhou, Total variation wavelet inpainting, J. Math. Imaging Vision, 25 (2006), pp. 107–125. [14] Y. Chen, W. Hager, F. Huang, D. Phan, X. Ye, and W. Yin, Fast algorithms for image reconstruction with application to partially parallel MR imaging, SIAM J. Imaging Sci., 5 (2012), pp. 90–118. · Zbl 1247.90212 [15] Y. Chen, G. Lan, and Y. Ouyang, Optimal primal-dual methods for a class of saddle point problems, SIAM J. Optim., 24 (2014), pp. 1779–1814. · Zbl 1329.90090 [16] E. Corman and X. Yuan, A generalized proximal point algorithm and its convergence rate, SIAM J. Optim., 24 (2014), pp. 1614–1638. · Zbl 1311.90099 [17] A. Criminisi, P. Pérez, and K. Toyama, Region filling and object removal by exemplar-based image inpainting, IEEE Trans. Image Process., 13 (2004), pp. 1200–1212. [18] K. Dabov, A. Foi, V. Katkovnik, and K. Egiazarian, Image denoising by sparse 3-d transform-domain collaborative filtering, IEEE Trans. Image Process., 16 (2007), pp. 2080–2095. [19] A. Danielyan, V. Katkovnik, and K. Egiazarian, BM3D frames and variational image deblurring, IEEE Trans. Image Process., 21 (2012), pp. 1715–1728. · Zbl 1373.94096 [20] Y. Dong, M. Hintermüller, and M. Neri, An efficient primal-dual method for $$l^1$$ tv image restoration, SIAM J. Imaging Sci., 2 (2009), pp. 1168–1189. · Zbl 1187.68653 [21] M. Elad and M. Aharon, Image denoising via sparse and redundant representations over learned dictionaries, IEEE Trans. Image Process., 15 (2006), pp. 3736–3745. [22] M. Elad, B. Matalon, and M. Zibulevsky, Image denoising with shrinkage and redundant representations, in Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition, Vol. 2, 2006, pp. 1924–1931. [23] M. Elad, J.-L. Starck, P. Querre, and D. L. Donoho, Simultaneous cartoon and texture image inpainting using morphological component analysis (MCA), Appl. Comput. Harmonic Analy., 19 (2005), pp. 340–358. · Zbl 1081.68732 [24] M.-J. Fadili, J.-L. Starck, and F. Murtagh, Inpainting and zooming using sparse representations, Comput. J., 52 (2009), pp. 64–79. [25] E. Ghadimi, A. Teixeira, I. Shames, and M. Johansson, Optimal parameter selection for the alternating direction method of multipliers (admm): Quadratic problems, IEEE Trans. Automat. Control, 60 (2015), pp. 644–658. · Zbl 1360.90182 [26] T. Goldstein and S. Osher, The split Bregman method for $$l1$$-regularized problems, SIAM J. Imaging Sci., 2 (2009), pp. 323–343. · Zbl 1177.65088 [27] O. G. Guleryuz, Nonlinear approximation based image recovery using adaptive sparse reconstructions and iterated denoising—Part II: Adaptive algorithms, IEEE Trans. Image Process., 15 (2006), pp. 555–571. [28] W. Guo, J. Qin, and W. Yin, A new detail-preserving regularization scheme, SIAM J. Imaging Sci., 7 (2014), pp. 1309–1334. · Zbl 1299.65130 [29] E. T. Hale, W. Yin, and Y. Zhang, Fixed-point continuation for $$\{L}\_1$$-minimization: Methodology and convergence, SIAM J. Optim., 19 (2008), pp. 1107–1130. · Zbl 1180.65076 [30] S. Hawe, M. Kleinsteuber, and K. Diepold, Analysis operator learning and its application to image reconstruction, in Proceedings of the IEEE Trans. Image Process., 22 (2013), pp. 2138–2150. · Zbl 1373.94161 [31] B. He, Y. You, and X. Yuan, On the convergence of primal-dual hybrid gradient algorithm, SIAM J. Imaging Sci., 7 (2014), pp. 2526–2537. · Zbl 1308.90129 [32] R. A. Horn and C. R. Johnson, Matrix Analysis, Cambridge University Press, Cambridge, UK, 2012. [33] Y.-M. Huang, M. K. Ng, and Y.-W. Wen, A new total variation method for multiplicative noise removal, SIAM J. Imaging Sci., 2 (2009), pp. 20–40. · Zbl 1187.68655 [34] F. Li and T. Zeng, A universal variational framework for sparsity based image inpainting, IEEE Trans. Image Process., 23 (2014), pp. 4242–4254. · Zbl 1374.94201 [35] T. Lin, S. Ma, and S. Zhang, On the Global Linear Convergence of the Admm with Multi-Block Variables, preprint, arXiv:1408.4266, 2014. [36] S. Ma, W. Yin, Y. Zhang, and A. Chakraborty, An efficient algorithm for compressed mr imaging using total variation and wavelets, in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2008, pp. 1–8. [37] M. Nikolova, M. K. Ng, and C.-P. Tam, Fast nonconvex nonsmooth minimization methods for image restoration and reconstruction, IEEE Trans. Image Process., 19 (2010), pp. 3073–3088. · Zbl 1371.94277 [38] J. Nocedal and S. J. Wright, Penalty and Augmented Lagrangian Methods, Springer, New York, 2006. [39] I. Ram, M. Elad, and I. Cohen, Image processing using smooth ordering of its patches, IEEE Trans. Image Process., 22 (2013), pp. 2764–2774. · Zbl 1373.94339 [40] S. Setzer, Operator splittings, bregman methods and frame shrinkage in image processing, Int. J. Comput. Vision, 92 (2011), pp. 265–280. · Zbl 1235.68314 [41] J. Shen and T. F. Chan, Mathematical models for local nontexture inpaintings, SIAM J. Appl. Math., 62 (2002), pp. 1019–1043. · Zbl 1050.68157 [42] J. Shen, S. H. Kang, and T. F. Chan, Euler’s elastica and curvature-based inpainting, SIAM J. Appl. Math., 63 (2003), pp. 564–592. · Zbl 1028.68185 [43] X.-C. Tai, S. Osher, and R. Holm, Image inpainting using a TV-Stokes equation, in Image Processing Based on Partial Differential Equations, Springer, New York, 2007, pp. 3–22. [44] Y. Wang, J. Yang, W. Yin, and Y. Zhang, A new alternating minimization algorithm for total variation image reconstruction, SIAM J. Imaging Sci., 1 (2008), pp. 248–272. · Zbl 1187.68665 [45] Y.-W. Wen, R. H. Chan, and A. M. Yip, A primal–dual method for total-variation-based wavelet domain inpainting, IEEE Trans. Image Process., 21 (2012), pp. 106–114. · Zbl 1372.94268 [46] A. Wong and J. Orchard, A nonlocal-means approach to exemplar-based inpainting, in Proceedings of the 15th IEEE International Conference on Image Processing, 2008, pp. 2600–2603. [47] Z. Xu and J. Sun, Image inpainting by patch propagation using patch sparsity, IEEE Trans. Image Process., 19 (2010), pp. 1153–1165. · Zbl 1371.94424 [48] X. Ye and H. Zhou, Fast total variation wavelet inpainting via approximated primal-dual hybrid gradient algorithm, Inverse Problems Imaging, 7 (2013), pp. 1031–1050. · Zbl 1273.65094 [49] G. Yu, G. Sapiro, and S. Mallat, Solving inverse problems with piecewise linear estimators: From Gaussian mixture models to structured sparsity, IEEE Trans. Image Process., 21 (2012), pp. 2481–2499. · Zbl 1373.94471 [50] X. Zhang, M. Burger, X. Bresson, and S. Osher, Bregmanized nonlocal regularization for deconvolution and sparse reconstruction, SIAM J. Imaging Sci., 3 (2010), pp. 253–276. · Zbl 1191.94030 [51] X. Zhang and T. F. Chan, Wavelet inpainting by nonlocal total variation, Inverse Problems Imaging, 4 (2010), pp. 191–210. · Zbl 1185.42040 [52] X.-L. Zhao, W. Wang, T.-Y. Zeng, T.-Z. Huang, and M. K. Ng, Total variation structured total least squares method for image restoration, SIAM J. Sci. Comput., 35 (2013), pp. B1304–B1320. · Zbl 1287.65014
This reference list is based on information provided by the publisher or from digital mathematics libraries. Its items are heuristically matched to zbMATH identifiers and may contain data conversion errors. It attempts to reflect the references listed in the original paper as accurately as possible without claiming the completeness or perfect precision of the matching.


text:
# Can I get some help finding the x - intercept please? Thanks!

Jan 15, 2018

${x}_{1} = - 1 + \frac{1}{\sqrt{6}}$ and ${x}_{2} = - 1 - \frac{1}{\sqrt{6}}$

#### Explanation:

$6 {x}^{2} + 12 x + 5 = 0$

This can be solved using the quadratic formula:

$x = \frac{- b \pm \sqrt{{b}^{2} - 4 a c}}{2 a}$

$x = \frac{- 12 \pm \sqrt{{12}^{2} - 4 \left(6\right) \left(5\right)}}{2 \left(6\right)}$

$x = \frac{- 12 \pm \sqrt{144 - 120}}{12}$

$x = - 1 \pm \frac{\sqrt{24}}{12} = - 1 \pm \frac{\sqrt{6 \times 4}}{12}$

$x = - 1 + \frac{2 \sqrt{6}}{12} = - 1 \pm \frac{\sqrt{6}}{6}$

$x = - 1 \pm \frac{1}{\sqrt{6}}$

So the $x$ intercepts are:

${x}_{1} = - 1 + \frac{1}{\sqrt{6}}$ and ${x}_{2} = - 1 - \frac{1}{\sqrt{6}}$

Jan 15, 2018

$\frac{- 6 + \sqrt{6}}{6}$ and $\frac{- 6 - \sqrt{6}}{6}$, or $- 0.59$ and $- 1.41$

#### Explanation:

Use the quadratic formula to find the x-values of the equation.

x=(-(12)+-sqrt((12^2)-4(6)(5)))/(2(6)
Simplify the radicand to get $\sqrt{144 - 120}$, which simplifies to $\sqrt{24}$, or $2 \sqrt{6}$.
Simplify the rest of the equation to get $\frac{- 12 \pm 2 \sqrt{6}}{12}$ which further simplifies to $\frac{- 6 \pm \sqrt{6}}{6}$.

Make sure you understand why you are doing this!

You are basically making the function equal to zero because whenever the function crosses the x axis, the x value is 0. Therefore, you are trying to find for what values the x equals zero.

Jan 15, 2018

This is effectively asking us to solve $6 {x}^{2} + 12 x + 5 = 0$

The first way of trying to solve a quadratic equation is to factorise.

We need two numbers that sum to $12$ and multiply to $5 \times 6 = 30$. Try thinking of some.

In fact, there are no such numbers. So next, we turn to our two other ways of solving quadratic equations.

Method 1 - Completing the Square

This method is good if you don't have a calculator, and ideal if the coefficient of ${x}^{2}$ is 1 or a factor of the $x$ coefficient.

$6 {x}^{2} + 12 x + 5 = 0$
${x}^{2} + 2 x + \frac{5}{6} = 0$
${\left(x + 1\right)}^{2} - 1 + \frac{5}{6} = 0$
${\left(x + 1\right)}^{2} - \frac{1}{6} = 0$
${\left(x + 1\right)}^{2} = \frac{1}{6}$
$x + 1 = \pm \sqrt{\frac{1}{6}}$
$x + 1 = \pm \frac{1}{\sqrt{6}}$
$x + 1 = \pm \frac{\sqrt{6}}{6}$
$x = - 1 \pm \frac{\sqrt{6}}{6}$
Tidy up
$x = \frac{- 6 \pm \sqrt{6}}{6}$

So $x = \frac{- 6 + \sqrt{6}}{6}$ and $x = \frac{- 6 - \sqrt{6}}{6}$

Method 2 - The Quadratic Formula

A much better method if you have a calculator. Given the choice, the formula is a much better option.

This states that, for a quadratic $a {x}^{2} + b x + c = 0$, the solutions are given by:

$x = \frac{- b \pm \sqrt{{b}^{2} - 4 a c}}{2 a}$

So for this example, $a = 6 , b = 12$ and $c = 5$

$x = \frac{- 12 \pm \sqrt{{12}^{2} - 4 \times 6 \times 5}}{2 \times 6}$
$x = \frac{- 12 \pm \sqrt{144 - 120}}{12}$
$x = \frac{- 12 \pm \sqrt{24}}{12}$
$x = \frac{- \cancel{12} \textcolor{red}{6} \pm \cancel{2} \sqrt{6}}{\cancel{12} \textcolor{red}{6}}$
$x = \frac{- 6 \pm \sqrt{6}}{6}$

So which method is better to use? Factorising is the best method, although it is not always possible to factorise. Personally, the quadratic formula is the better method if you cannot factorise, since there are fewer steps involved compared to completing the square.

Can I factorise?

Look at the quadratic formula again.

$x = \frac{- b \pm \sqrt{\textcolor{red}{{b}^{2} - 4 a c}}}{2 a}$

The area under the square root sign can tell us about the nature of the solutions. This expression, ${b}^{2} - 4 a c$, is known as the discriminant. The symbol $\Delta$ (capital delta) may be used to refer to this.

-if $\Delta > 0$, then there are two distinct real roots (2 solutions)
-if $\Delta = 0$ then there is one repeated real root (1 solution)
-if $\Delta < 0$ then there are no real roots (does not cross the x axis). This is because we are square rooting a negative, which can be a no-go.

If a quadratic factorises, then ${b}^{2} - 4 a c$ will be a positive square number since when we square root it, there will be no surd. In our example:

${b}^{2} - 4 a c = {12}^{2} - 4 \times 6 \times 5 = 24$
When we square root this, we get $\sqrt{24} = 2 \sqrt{6}$. Since we have a surd, this won't factorise. This is why there are no numbers to make such an expression in the beginning.


text:
# Difference between revisions of "TADM2E 4.2"

(a) Check the first 3 integers in the array, and get rid of the middle one. Repeat this with the next integer from the array and continue until we are left with the desired pair of integers, leading to an algorithm that runs in $O(n)$ worst-case time.
(b) The answer is straight forward: $S[1]$ and $S[n],$ since they are the two extreme values.
(c) Sort the array with any $n\log(n)$ method. Then scan through the sorted array to find the smallest gap, thus the desired pair.


text:
# Bounding box for each symbol in an equation

Is it possible to make LaTeX put a bounding box around each element in an equation, as in this file? I am aware of this question, but none of the solutions presented there, which does not require LuaTeX, seem to work within equations containing, e.g., commands like \sum.

I have tried to resolve this "manually" by putting a framebox around each symbol within an equation, but neither that seems to work for commands like \sum, even though it do work for simpler symbols such as digits, such as

\fboxrule=.1pt \fboxsep=-\fboxrule
$\framebox[\width]{1}$
• Framebox holds it argument i text-mode no matter where it It is used. You might want to have a look at the \boxed command from amsmath – daleif Dec 26 '13 at 20:22
• @daleif this does not work either, as it makes a separate math environment for each symbol, making it impossible to have say the subscripts of an integral in a separate box, as writing $\boxed{\sum}_ {1 \leq i \leq j \leq k \leq n}$ places the subscripts incorrectly and $\boxed{\sum}_\boxed{1 \leq i \leq j \leq k \leq n}$ does not work at all. – malin Dec 26 '13 at 21:10
• @malin There's no way to do it in pure TeX, unless you're ready to reimplement math mode with boxes and glue after reading appendix G of the TeXbook. – egreg Dec 27 '13 at 0:35

This approach is by no means automated, but can be made to manually work. It uses a \boxxed macro for putting things in boxes. However, manual intervention is still needed as follows: \mathop and \mathrel have to be manually introduced for a boxed operator or relation, since the box removes any memory of that.

The \ThisStyle{...\SavedStyle...} syntax of the scalerel package is used to preserve \scriptstyle arguments in their proper style, once inside the box.

The good news is that the kerning is preserved.

\documentclass{article}
\usepackage{amsmath}
\fboxrule=.1pt
\fboxsep=-.1pt
\usepackage{scalerel}
\newcommand\boxxed[1]{{\ThisStyle{\fbox{$\SavedStyle#1$}}}}
\begin{document}
$$\mathop{\boxxed{\sum}}_\boxxed{i}^\boxxed{n} \boxxed{A}^\boxxed{2}$$

$$\sum_i^n A^2$$

$$\displaystyle\mathop{\boxxed{\sum}}_\boxxed{i}^\boxxed{n} \boxxed{A}^\boxxed{2}$$

$$\displaystyle\sum_i^n A^2$$
\end{document}


text:
# Is there any "randomness" in a random variable?

I've been using probability theory (, statistics, bayesian inference) for a while - and I find it very useful and mathematically elegant, but I still can't get where is the hidden "randomness" in a formal definition of random variable. I guess, there must be some "God with a Dice" that chooses which $\omega \in \Omega$ like "is going to realize". Or there's no such a thing and we always operate (and think of it as) just with numbers weighted by measure of corresponding (exists due to $\Omega$/$\mathcal B (\mathbb R)$ measurability of random variable) elements of $\Omega$ and no "dice inside"?

Or, in other words: how can something deterministic model something random? And if it can, where in formal definition that "randomness" is?


text:
# Determinants inside matrix

I am typing in .tex a solution using Cramer method but I can't find a way to write those matrixes inside the main matrix. Is there an easy way to do that?

-
Maybe this can help? tex.stackexchange.com/questions/50627/matrix-in-a-matrix –  Melanie Nov 11 '13 at 1:57
Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format. –  cmhughes Nov 11 '13 at 2:21
You should contruct a multi merged matrix. This should help you out: tex.stackexchange.com/questions/43656/… –  Rafareino Nov 11 '13 at 11:06
thanks Malanie, that will be usefull –  Claudia Nov 11 '13 at 15:48

enter code here
$adj(\mathbb{K})= \left[ \def\arraystretch{1.8} \begin{array}{ccc} +\begin{vmatrix} \frac{-2r\cos\theta}{R_E\sin^3\theta} & 0 \\ 0 & 1 \end{vmatrix} & -\begin{vmatrix} \frac{1}{R_E\sin^2\theta} & 0 \\ 0 & 1 \end{vmatrix} & +\begin{vmatrix} \frac{1}{R_E\sin^2\theta} & -\frac{-2r\cos\theta}{R_E\sin^3\theta} \\ 0 & 0 \end{vmatrix} \\ &&\\ -\begin{vmatrix} \frac{-R^2_E\sin^2\theta}{r^2} & 0 \\ 0 & 1 \end{vmatrix} & +\begin{vmatrix} \frac{-2R^2_E\cos\theta}{r^3} & 0 \\ 0 & 1 \end{vmatrix} & -\begin{vmatrix} \frac{-2R^2_E\cos\theta}{r^3} & -\frac{-R_E\sin\theta}{r^2} \\ 0 & 0 \end{vmatrix} \\ &&\\ +\begin{vmatrix} \frac{-R^2_E\sin\theta}{r^2} & 0 \\ \frac{-2r\cos\theta}{R_E\sin^3\theta} & 0 \end{vmatrix} & -\begin{vmatrix} \frac{-2R^2_E\cos\theta}{r^3} & 0 \\ \frac{1}{R_E\sin^2\theta} & 0 \end{vmatrix} & +\begin{vmatrix} \frac{-2R^2_E\cos\theta}{r^3} &\frac{-R^2_E\sin\theta}{r^2} \\ \frac{1}{R_E\sin^2\theta} & \frac{-2r\cos\theta}{R_E\sin^3\theta}\end{vmatrix} \end{array} \right]^T,$

A quick hint: if you indent lines by 4 spaces, then they are marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). –  Mico Nov 11 '13 at 15:31


text:
### Home > CCAA > Chapter 6 Unit 9 > Lesson CC3: 6.2.2 > Problem6-59

6-59.

Lashayia is famous for her delicious brownies, which she sells at football games. The graph at right shows the relationship between the number of brownies she sells and the amount of money she earns.

1. How much should she charge for $10$ brownies? Be sure to demonstrate your reasoning.

Find the equation for this line.

Once you find the equation, substitute $10$ for $x$.

$y=\frac{21.6}{12}x$

$y=\frac{21.6}{12}\cdot10$

$y=18$ dollars

2. During the last football game, Lashayia made $\34.20$. How many brownies did she sell? Show your work.

Use the equation found in part (a) and set it equal to $\34.20$. Then solve for $x$.


text:
Electric Field

Let us consider a system, in which a charge $Q$ is placed at the origin and another charge $q$ is placed at a point P. There will be some force of attraction or repulsion between two charges. Now if charge q is removed from the system, there are two possibilities.

1. There is nothing at point P and
2. There is some charge at point P

If we consider there is nothing at point P, then why does the charge q feel a force when again placed at P? This signifies that there is the presence of a force or field which pushes the charge q when placed at P. This proves that there is an electric field produced by the charge Q. Whenever a charge is placed in an electric field; it experiences an electric force on it.

An electric field exists at a point if an electrical force is exerted on a stationary charged object placed at that point.

If $F$is the electric field acting on charge q which is placed at a point in the field, the electric field at that point E = F /q. Clearly, its unit is $NC^{-1}$.

Calculation of electric field:

Let us consider a point P from where a charge $Q$is placed at a distance $r$. If a point charge or test charge $q$is placed at P, then Coulomb’s force is given by,

If the position of charge $q$ is expressed by the vector ${r}$, it experiences a force $F$ equal to the

charge $q$ multiplied by the electric field $E$ at the location of $q.$

Thus, $F(r)=q E(r)$

Direction:

If the electric field is positive, its direction is radially outward. If the field is negative, then its direction is radially inward. The electric field is also called Electric Field Intensity.

Figure:3.a

Direction of the electric field in case of unit positive charge is shown below.

Figure:3.b

Figure:3.c

Electric field due to multiple charges:

Consider a system of charges $q_{1}$, $q_{2}$, ………….$q_{n}$ with position vectors $r_{1}$, $r_{2}$, …………..$r_{n}$

Relative to origin O.

Electric field at a point in space due to the system of charges is defined as the force experienced by a unit test charge placed at that point, without disturbing the original positions of charges $q_{1}$, $q_{2}$……..$q_{n}$

We can use Coulomb’s law and the superposition principle to determine this field at a point P denoted by position vector r.

Figure:3.d

Electric field $E_{1}$at point P due to charge $q_{1}$is given by,

Electric field $E_{2}$at point P due to charge $q_{2}$is given by,

Similarly, electric field $E_{n}$at point P due to charge $q_{n}$ is given by,

By using the principle of superposition, the resultant electric field E will be the vector sum of all the individual electric fields.

Electric Field Lines:

Electric Field Lines show direction of electric field and can be used to describe and interpret the invisible electric field. For example, a charge $q$, is placed at origin. The electric field $E$ produced by charge $q$ can be represented as:

Figure:3.e

The strength of electric fields is directly proportional to the lengths of electric field lines. Also, the strength of the electric field decreases with distance. In case of a positive charge, the direction of arrows points outwards and points inwards in case of a negative charge.

Figure:3.f

Points to remember:

1. Electric field lines never intersect with each other. IIf the electric field lines intersect, then there must be distinctly two electric fields with different directions. This is not possible because for a single location, there is only one direction and magnitude of the electric field associated with it.

Figure:3.g

2. Electric field lines around a system of two positive charges describe the mutual repulsion between them shown below.

Figure:3.h

3. Electric field lines around a system of one positive charge and another negative charge describe the mutual attraction between them shown below.

Figure:3.i


text:
# Revision history [back]

### Why can't I find exponential of a "complex256" matrix?

The following script gives me a error - ValueError: invalid type: complex256. However, this works with complex128. Is there a way to make expm work with complex256?

import scipy
a=scipy.matrix([[1,0],[0,1]],dtype='complex256')
scipy.linalg.expm(a)

 2 retagged FrédéricC 3497 ●3 ●34 ●68

### Why can't I find exponential of a "complex256" matrix?

The following script gives me a error - ValueError: invalid type: complex256. However, this works with complex128. Is there a way to make expm work with complex256?

import scipy
a=scipy.matrix([[1,0],[0,1]],dtype='complex256')
scipy.linalg.expm(a)


text:
# Text Analytics in Python

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

El curso a partir del cual está basada esta pagina se refería a Natural language processing, no Text Analytics. Sin embargo creo que se tratan aspectos que no son sólo de Natural language processing.

Natural language processing (NLP) is concerned with the interactions between computers and human (natural) languages, in particular how to process and analyze large amounts of natural language data.

Challenges in Natural Language Processing frequently involve text classification, speech recognition, natural language understanding, and natural language generation.

Natural Language Processing basically consists of combining machine learning techniques with text, and using math and statistics to get that text in a format that the machine learning algorithms can understand.

## NLTK

Online book: http://www.nltk.org/book/

The Natural Language Toolkit, or more commonly NLTK, is a suite of libraries and programs for symbolic and statistical natural language processing (NLP) for English written in the Python programming language.

### Installation

conda install nltk  # Installs nltk

#### Installing NLTK Data

NLTK comes with many corpora, toy grammars, trained models, etc. A complete list is posted at: http://nltk.org/nltk_data/

import nltk         # Imports the library
Those are some of the important datasets that can be installed:
=> all-corpora
=> all-nltk

After compleated the downloding process as above, the data will be located at \$HOME. I have relocated the data to this location: /home/adelo/.nltk/nltk_data

You will need to set the NLTK_DATA environment variable to specify the location of the data (NOTE: I haven't implement it this way. I actually think I did it and it didn't work but don't rememeber well) /home/adelo/.bashrc:

# Installing NLTK Data

What I do is to add the path where I have located the nltk_data to «nltk.data.path». So in the Python script:

nltk.data.path.append('/home/adelo/.nltk/nltk_data')

# or to to it generally to every system:
import os
HOME = os.environ['HOME']
nltk.data.path.append(HOME+'/.nltk/nltk_data')

Then, we can test that the data has been installed and the variable properly set as follows (This assumes you downloaded the Brown Corpus):

from nltk.corpus import brown
brown.words()
# Output:
['The', 'Fulton', 'County', 'Grand', 'Jury', 'said', ...]

from nltk.corpus import stopwords
stopwords.words('english')

## First example

### Our test dataset

• Text file: smsspamcollection

• The SMS Spam Collection v.1 (hereafter the corpus) is a set of SMS tagged messages that have been collected for SMS Spam research. It contains one set of SMS messages in English of 5,574 messages, tagged acording being ham (legitimate) or spam.

• The SMS Spam Collection v.1 has a total of 4,827 SMS legitimate messages (86.6%) and a total of 747 (13.4%) spam messages.

• The files contain one message per line. Each line is composed by two columns: one with label (ham or spam) and other with the raw text. Here are some examples:
ham   What you doing?how are you?
ham   Ok lar... Joking wif u oni...
ham   dun say so early hor... U c already then say...
ham   MY NO. IN LUTON 0125698789 RING ME IF UR AROUND! H*
ham   Siva is in hostel aha:-.
ham   Cos i was out shopping wif darren jus now n i called him 2 ask wat present he wan lor. Then he started guessing who i was wif n he finally guessed darren lor.
spam   FreeMsg: Txt: CALL to No: 86888 & claim your reward of 3 hours talk time to use from your phone now! ubscribe6GBP/ mnth inc 3hrs 16 stop?txtStop
spam   Sunshine Quiz! Win a super Sony DVD recorder if you canname the capital of Australia? Text MQUIZ to 82277. B
spam   URGENT! Your Mobile No 07808726822 was awarded a L2,000 Bonus Caller Prize on 02/09/03! This is our 2nd attempt to contact YOU! Call 0871-872-9758 BOX95QU

• Note: messages are not chronologically sorted.

• Using these labeled ham and spam examples, we'll train a machine learning model to learn to discriminate between ham/spam automatically. Then, with a trained model, we'll be able to classify arbitrary unlabeled messages as ham or spam.

### Importing the data

messages = [line.rstrip() for line in open('smsspamcollection/SMSSpamCollection')]
print(len(messages))

# Output:
5574

Let's print the first ten messages and number them using enumerate:

for message_no, message in enumerate(messages[:10]):
print(message_no, message)
print('\n')

# Output:
0 ham	Go until jurong point, crazy.. Available only in bugis n great world la e buffet... Cine there got amore wat...

1 ham	Ok lar... Joking wif u oni...

2 spam	Free entry in 2 a wkly comp to win FA Cup final tkts 21st May 2005. Text FA to 87121 to receive entry question(std txt rate)T&C's apply 08452810075over18's

3 ham	U dun say so early hor... U c already then say...

4 ham	Nah I don't think he goes to usf, he lives around here though

5 spam	FreeMsg Hey there darling it's been 3 week's now and no word back! I'd like some fun you up for it still? Tb ok! XxX std chgs to send, £1.50 to rcv

6 ham	Even my brother is not like to speak with me. They treat me like aids patent.

7 ham	As per your request 'Melle Melle (Oru Minnaminunginte Nurungu Vettam)' has been set as your callertune for all Callers. Press *9 to copy your friends Callertune

8 spam	WINNER!! As a valued network customer you have been selected to receivea £900 prize reward! To claim call 09061701461. Claim code KL341. Valid 12 hours only.

9 spam	Had your mobile 11 months or more? U R entitled to Update to the latest colour mobiles with camera for Free! Call The Mobile Update Co FREE on 08002986030

Due to the spacing we can tell that this is a TSV ("tab separated values") file, where the first column is a label saying whether the given message is a normal message (commonly known as "ham") or "spam". The second column is the message itself. (Note our numbers aren't part of the file, they are just from the enumerate call).

Instead of parsing TSV manually using Python, we can just take advantage of pandas! Let's go ahead and import it into a DataFrame:

import pandas as pd

messages = pd.read_csv('smsspamcollection/SMSSpamCollection', sep='\t',
names=["label", "message"])

type(messages)
# Output:
pandas.core.frame.DataFrame

# output:
label                                              message
0     ham     Go until jurong point, crazy.. Available only ...
1     ham                         Ok lar... Joking wif u oni...
2    spam     Free entry in 2 a wkly comp to win FA Cup fina...
3     ham     U dun say so early hor... U c already then say...
4     ham     Nah I don't think he goes to usf, he lives aro...

### Exploratory Data Analysis

Method / Operator / Description Example

#### Describe the data

import pandas

df.describe()

import pandas

messages.describe()

# Output:
label                 message
count   5572                     5572
unique     2                     5169
top      ham   Sorry, I'll call later
freq    4825                       30

#### Describe by group

import pandas

df.groupby('label').describe()

Let's use groupby to use describe by label.

This way we can begin to think about the features that separate ham and spam!

import pandas

messages.groupby('label').describe()

# Output:
message
label
ham      count                                                 4825
unique                                                 4516
top                               Sorry, I'll call later
freq                                                   30
spam     count                                                  747
unique                                                  653
top    Please call our customer service representativ...
freq                                                    4

#### Text length

df['length'] = df['colums'].apply(len)

Let's make a new column to detect how long the text messages are.

messages['length'] = messages['message'].apply(len)

# Output:
label                                               message   length
0    ham     Go until jurong point, crazy.. Available only ...      111
1    ham                         Ok lar... Joking wif u oni...       29
2   spam     Free entry in 2 a wkly comp to win FA Cup fina...      155
3    ham     U dun say so early hor... U c already then say...       49
4    ham     Nah I don't think he goes to usf, he lives aro...       61

#### Histogram

Play around with the bin size!

From the Histogram, it looks like text length may be a good feature to think about! Let's try to explain why the x-axis of the Histogram goes all the way to 1000ish. This must mean that there is some really long message!

import matplotlib.pyplot as plt
import seaborn as sns

%matplotlib inline
plt.style.use('bmh')

messages['length'].plot(bins=50, kind='hist', edgecolor="k")

Using describe() over the length we can see that there is a message of 910 characters. This is why the x-axis of the Histogram above goes all the way to 1000ish.

Let's use masking to find this message.

messages.length.describe()

# Output:
count    5572.000000
mean       80.489950
std        59.942907
min         2.000000
25%        36.000000
50%        62.000000
75%       122.000000
max       910.000000

This way we can find the message of 910 characters.
messages[messages['length'] == 910]['message'].iloc[0]

# Output:
"For me the love should start with attraction.i should feel that I need her every time around me.she should be the first thing which comes in my thoughts.I would start the day and end it with her.she should be there every time I dream.love will be then when my every breath has her name.my life should happen around her.my life will be named to her.I would cry for her.will give all my happiness and take all her sorrows.I will be ready to fight with anyone for her.I will be in love when I will be doing the craziest things for her.love will be when I don't have to proove anyone that my girl is the most beautiful lady on the whole planet.I will always be singing praises for her.love will be when I start up making chicken curry and end up makiing sambar.life will be the most beautiful then.will get every morning and thank god for the day because she is with me.I would like to say a lot..will tell later.."

Let's focus back on the idea of trying to see if message length is a distinguishing feature between ham and spam.

Very interesting! Through just basic EDA we've been able to discover a trend that spam messages tend to have more characters.

messages.hist(column='length', by='label', bins=50,figsize=(12,4), edgecolor="k")

### Text Pre-processing

Our main issue with our data is that it is all in text format (strings). The classification algorithms that we've learned about so far will need some sort of numerical feature vector in order to perform the classification task. There are actually many methods to convert a corpus to a vector format. The simplest is the the bag-of-words approach, where each unique word in a text will be represented by one number.

• In this section we'll convert the raw messages (sequence of characters) into vectors (sequences of numbers).

• As a first step, let's write a function that will split a message into its individual words and return a list. We'll also remove very common words, ('the', 'a', etc..). To do this we will take advantage of the NLTK library. It's pretty much the standard library in Python for processing text and has a lot of useful features. We'll only use some of the basic ones here.

• Let's create a function that will process the string in the message column, then we can just use apply() in pandas do process all the text in the DataFrame.

• First removing punctuation. We can just take advantage of Python's built-in string library to get a quick list of all the possible punctuation.

Example

#### Removing punctuation

We can just take advantage of Python's built-in string library to get a quick list of all the possible punctuation: string.punctuation
import string

mess = 'Sample message! Notice: it has punctuation.'

# Check characters to see if they are in punctuation
nopunc = [char for char in mess if char not in string.punctuation]

# Join the characters again to form the string.
nopunc = ''.join(nopunc)
print(nopunc)

# Output:
Sample message Notice it has punctuation

#### Remove stopwords

Stopwords are very common words ('the', 'a', etc..).

We can import a list of english stopwords from NLTK (check the documentation for more languages and info).

from nltk.corpus import stopwords
stopwords.words('english')[0:10] # Show some stop words
# Output:
['i', 'me', 'my', 'myself', 'we', 'our', 'ours', 'ourselves', 'you', 'your']

nopunc.split()
# Output:
['Sample', 'message', 'Notice', 'it', 'has', 'punctuation']

# Now just remove any stopwords
clean_mess = [word for word in nopunc.split() if word.lower() not in stopwords.words('english')]
clean_mess
# Output:
['Sample', 'message', 'Notice', 'punctuation']

#### Making a function to apply a set of pre-procesteps steps and tokarize the data

• Remove Punctuation
• Remove Stopwords
• Tokenize
We can make a function to to remove Punctuation, Stopwords and Tokenize our messages. This function will be applied to our DataFrame.

Tokenization is just the term used to describe the process of converting the normal text strings in to a list of tokens (words that we actually want).

Notice that this function is returning a list of words without Punctuation or Stopwords.

def text_process(mess):
"""
Takes in a string of text, then performs the following:
1. Remove all punctuation
2. Remove all stopwords
3. Returns a list of the cleaned text
"""
# Check characters to see if they are in punctuation
nopunc = [char for char in mess if char not in string.punctuation]

# Join the characters again to form the string.
nopunc = ''.join(nopunc)

# Now just remove any stopwords
return [word for word in nopunc.split() if word.lower() not in stopwords.words('english')]

#### Applying the function over our DataFrace

Note: We may get some warnings or errors for symbols we didn't account for or that weren't in Unicode (like a British pound symbol)
# Show original dataframe
# Output:
label                                               message   length
0    ham     Go until jurong point, crazy.. Available only ...      111
1    ham                         Ok lar... Joking wif u oni...       29
2   spam     Free entry in 2 a wkly comp to win FA Cup fina...      155
3    ham     U dun say so early hor... U c already then say...       49
4    ham     Nah I don't think he goes to usf, he lives aro...       61

# Applying the function
# Output
0    [Go, jurong, point, crazy, Available, bugis, n...
1                       [Ok, lar, Joking, wif, u, oni]
2    [Free, entry, 2, wkly, comp, win, FA, Cup, fin...
3        [U, dun, say, early, hor, U, c, already, say]
4    [Nah, dont, think, goes, usf, lives, around, t...

#### Continuing Normalization

There are a lot of ways to continue normalizing this text. Such as Stemming or distinguishing by part of speech.

NLTK has lots of built-in tools and great documentation on a lot of these methods. Sometimes they don't work well for text-messages due to the way a lot of people tend to use abbreviations or shorthand, For example:

'Nah dawg, IDK! Wut time u headin to da club?'

Vs.

'No dog, I don't know! What time are you heading to the club?'

### Vectorization

Usually, after pre-processing, we have the messages as lists of tokens (also known as lemmas).

Now we'll convert each message, represented as a list of tokens (lemmas) into a Numeric Vector that machine learning models can understand.

To be able to run a Machine Learning algorithm, we first need to transform each text document into a numerical representation in the form of a vector. This matrix will be the numerical representation that a Machine Learning algorithm is able to understand.

We'll do that in three steps using the bag-of-words model:

1. Create the Document Term Matrix (DTM) (Also know as Term Frequency(TF)): Count how many times does a word occur in each text document.
2. Term weighting: Weigh the counts, so that frequent tokens get lower weight (Inverse Document Frequency).
3. Normalization: Normalize the vectors to unit length, to abstract from the original text length (L2 Norm).

#### Document Term Matrix

We will convert a collection of text documents to a matrix of token counts:

• We can imagine a matrix of token counts as a 2-Dimensional matrix. Where the 1-dimension is the entire vocabulary (1 row per word) and the other dimension are the actual documents, in this case a column per text message.
• Since there are so many messages, we can expect a lot of zero counts for the presence of that word in that document. Because of this, SciKit-Learn will output a Sparse Matrix.
• Each columns (or row depending on the approach) of this matrix represent a word in the training data. Thus, each document is defined by the frequency of the words that are in the dictionary composed for all the terms in our data.

 Figure 1: The Document-Term Matrix File:Document-Term Matrix.pdf File:Document-Term Matrix.ods File:Using text mining and Machine Learning to classify documents.pdf

##### Using Scikit-learn CountVectorizer method to create a DTM

In Python, we can use Scikit-learn's CountVectorizer method to create a DTM. Let's see how to do so in our example:

from sklearn.feature_extraction.text import CountVectorizer

# This create a «Bag-of-Words (bow) transformed object» (It is not the resulting DTM yet)
# There are a lot of arguments and parameters that can be passed to the CountVectorizer. In this case we will just specify the analyzer to be our own previously defined function «text_process»:
# Might take a while...
bow_transformer = CountVectorizer(analyzer=text_process).fit(messages['message'])

# Print total number of vocab words:
print(len(bow_transformer.vocabulary_))
# Output:
11425

# Let's take one text message and get its bag-of-words counts as a vector, putting to use our new bow_transformer:
message4 = messages['message'][3]
print(message4)
# Output:
U dun say so early hor... U c already then say...

# Now let's see its vector representation:
bow4 = bow_transformer.transform([message4])
print(bow4)
print(bow4.shape)
# Output:
(0, 4068)   2
(0, 4629)   1
(0, 5261)   1
(0, 6204)   1
(0, 6222)   1
(0, 7186)   1
(0, 9554)   2
(1, 11425)
# This means that there are seven unique words in message number 4 (after removing common stop words). Two of them appear twice, the rest only once.

# Let's go ahead and check and confirm which ones appear twice:
print(bow_transformer.get_feature_names()[4068])
print(bow_transformer.get_feature_names()[9554])
# Output:
U
say

# Now we can use «.transform» on our «Bag-of-Words (bow) transformed object» and transform the entire DataFrame of messages. Let's go ahead and check out how the bag-of-words counts for the entire SMS corpus is a large, sparse matrix:
messages_bow = bow_transformer.transform(messages['message'])

print('Shape of Sparse Matrix: ', messages_bow.shape)
print('Amount of Non-Zero occurences: ', messages_bow.nnz)
# Output:
Shape of Sparse Matrix:  (5572, 11444)
Amount of Non-Zero occurences:  50795

sparsity = (100.0 * messages_bow.nnz / (messages_bow.shape[0] * messages_bow.shape[1]))
print('sparsity: {}'.format(round(sparsity)))
# Output:
sparsity: 0

#### Term weighting and Normalization using TF-IDF

In general terms, the process of weighting involves emphasizing the contribution of particular aspects of a phenomenon (or of a set of data) over others to a final outcome or result; thereby highlighting those aspects in comparison to others in the analysis. That is, rather than each variable in the data set contributing equally to the final result, some of the data is adjusted to make a greater contribution than others. https://en.wikipedia.org/wiki/Weighting

TF-IDF, short for Term Frequency–Inverse Document Frequency, and the TF-IDF Weight, is a statistical measure used to evaluate how important a word is to a document in a collection or corpus. It has many uses, most importantly in automated text analysis. It is often used as a weighting factor in machine learning algorithms for Natural Language Processing.

Typically, the TF-IDF Weight is computed by the product of the TF and the IDF

• The normalized Term Frequency (TF), which is the number of times a word appears in a document, divided by the total number of words in that document.
• Why Normalization?: Since every document is different in length, it is probably that a term would appear much more times in long documents than shorter ones. Thus, the Term Frequency is often divided by the document length (total number of words in that document) as a way of Normalization:
• ${\displaystyle TF(t)={\frac {{\text{Number of times term }}t{\text{ appears in a document}}}{\text{Total number of terms in that document}}}}$

• Inverse Document Frequency (IDF). The IDF measures how important a term is. While computing TF, all terms are considered equally important. However it is known that certain terms, such as "is", "of", and "that", may appear a lot of times but have little importance. Thus we need to weigh down the frequent terms while scale up the rare ones, by computing the following:
• The IDF is computed as the logarithm of the number of the documents in the corpus divided by the number of documents where the specific term appears.
• ${\displaystyle IDF(t)=\ln {\Bigl (}{\frac {\text{Total number of documents}}{{\text{Number of documents with term }}t{\text{ in it}}}}{\Bigr )}}$

• ${\displaystyle IF{\text{-}}IDF(t)=TF(t)*IDF(t)}$

Example:

• Consider a document containing 100 words wherein the word cat appears 3 times.
• Then, the normalized Term Frequency for cat is:
• ${\displaystyle TF(cat)={\frac {3}{100}}=0.03}$

• Now, assume we have 10 million documents and the word cat appears in one thousand of these.
• Then, the Inverse Document Frequency for cat is:
• ${\displaystyle IDF(cat)=\ln {\Bigl (}{\frac {10000000}{1000}}{\Bigr )}=4}$

• Finally, the TF-IDF Weight is the product of these quantities:
• ${\displaystyle IF{\text{-}}IDF(cat)=TF(cat)*IDF(cat)=0.03*4=0.12}$

##### Using TfidfTransformer method from Scikit-learn to compute the TF-IDF

Term weighting and Normalization can be done with TF-IDF, using scikit-learn's TfidfTransformer.

from sklearn.feature_extraction.text import TfidfTransformer

tfidf_transformer = TfidfTransformer().fit(messages_bow)
tfidf4 = tfidf_transformer.transform(bow4)
print(tfidf4)
# Output:
(0, 9554)     0.5385626262927564
(0, 7186)     0.4389365653379857
(0, 6222)     0.3187216892949149
(0, 6204)     0.29953799723697416
(0, 5261)     0.29729957405868723
(0, 4629)     0.26619801906087187
(0, 4068)     0.40832589933384067

We'll go ahead and check what is the IDF (inverse document frequency) of the word "u" and of word "university"?

print(tfidf_transformer.idf_[bow_transformer.vocabulary_['u']])
print(tfidf_transformer.idf_[bow_transformer.vocabulary_['university']])
# Output:
3.28005242674
8.5270764989

To transform the entire bag-of-words corpus into TF-IDF corpus at once:

messages_tfidf = tfidf_transformer.transform(messages_bow)
print(messages_tfidf.shape)
# Output:
(5572, 11425)

### Training the model

With messages represented as vectors, we can finally train our spam/ham classifier. Now we can actually use almost any sort of classification algorithms. For a variety of reasons, the Naive Bayes classifier algorithm is a good choice.

#### Naive Bayes classifier using scikit-learn

from sklearn.naive_bayes import MultinomialNB
spam_detect_model = MultinomialNB().fit(messages_tfidf, messages['label'])

Let's try classifying our single random message and checking how we do:

print('predicted:', spam_detect_model.predict(tfidf4)[0])
print('expected:', messages.label[3])
# Output:
predicted: ham
expected: ham

### Model Evaluation

all_predictions = spam_detect_model.predict(messages_tfidf)
print(type(all_predictions))
print(len(all_predictions))
print(all_predictions)

# Output:
<class 'numpy.ndarray'>
5572
['ham' 'ham' 'spam' ... 'ham' 'ham' 'ham']

We can use SciKit-Learn's built-in classification report, which returns precision, recall, f1-score, and a column for support (meaning how many cases supported that classification). Check out the links for more detailed info on each of these metrics and the figure below:

Precision and recall
from sklearn.metrics import classification_report
print (classification_report(messages['label'], all_predictions))

# Output:
precision    recall  f1-score   support

ham         0.98      1.00      0.99      4825
spam         1.00      0.85      0.92       747

avg / total         0.98      0.98      0.98      5572

There are quite a few possible metrics for evaluating model performance. Which one is the most important depends on the task and the business effects of decisions based off of the model. For example, the cost of mis-predicting "spam" as "ham" is probably much lower than mis-predicting "ham" as "spam".

In the above "evaluation", we evaluated accuracy on the same data we used for training. You should never actually evaluate on the same dataset you train on!

A proper way is to split the data into a training/test set, where the model only ever sees the training data during its model fitting and parameter tuning. The test data is never used in any way. This is then our final evaluation on test data is representative of true predictive performance.

### Train Test Split

from sklearn.model_selection import train_test_split

msg_train, msg_test, label_train, label_test = \
train_test_split(messages['message'], messages['label'], test_size=0.2)

print(len(msg_train), len(msg_test), len(msg_train) + len(msg_test))

# Output
4457 1115 5572

The test size is 20% of the entire dataset (1115 messages out of total 5572), and the training is the rest (4457 out of 5572). Note the default split would have been 30/70.

### Creating a Data Pipeline

Let's run our model again and then predict off the test set. We will use SciKit Learn's pipeline capabilities to store a pipeline of workflow. This will allow us to set up all the transformations that we will do to the data for future use. Let's see an example of how it works:

from sklearn.pipeline import Pipeline

pipeline = Pipeline([
('bow', CountVectorizer(analyzer=text_process)),  # strings to token integer counts
('tfidf', TfidfTransformer()),  # integer counts to weighted TF-IDF scores
('classifier', MultinomialNB()),  # train on TF-IDF vectors w/ Naive Bayes classifier
])

Now we can directly pass message text data and the pipeline will do our pre-processing for us! We can treat it as a model/estimator API:

pipeline.fit(msg_train,label_train)

# Output:
Pipeline(steps=[('bow', CountVectorizer(analyzer=<function text_process at 0x11e795bf8>, binary=False,
decode_error='strict', dtype=<class 'numpy.int64'>,
encoding='utf-8', input='content', lowercase=True, max_df=1.0,
max_features=None, min_df=1, ngram_range=(1, 1), preprocessor=None,...f=False, use_idf=True)), ('classifier', MultinomialNB(alpha=1.0, class_prior=None, fit_prior=True))])

predictions = pipeline.predict(msg_test)

print(classification_report(predictions,label_test))

# Output:
precision    recall  f1-score   support

ham          1.00      0.96      0.98      1001
spam          0.75      1.00      0.85       114

avg / total          0.97      0.97      0.97      1115

Now we have a classification report for our model on a true testing set!

There is a lot more to Natural Language Processing than what we've covered here, and its vast expanse of topics could fill up several college courses!

## Sentiment Analysis

### Rule-based sentiment analysis

Two of the most popular Sentiment Analysis solutions for Python are TextBlob and Vader Sentiment.