text:
How did I survive a short hand-to-hand 230V shock? [closed]

About 5-10 years ago (can't remember when exactly), my father asked me to unplug a lawn mower from an ungrounded power outlet with no sunken part (the kind which had been outlawed by the EU for a few years by then). The outlet was in a corner, somewhat inaccessible due to a computer desk, so I reached over from the side of the desk and outlet (not the front) in a really clumsy way and tried to unplug it even more clumsily by trying to push my fingers between the plug and the socket. I had my other hand against the nearby wall corner, and all of a sudden I felt a current go through my arms and chest, from the outlet, through my left hand and arm, over to my right hand and arm, and into the wall.

After about a second, I managed to get my fingers from between the plug and the shock stopped. I had only 2 fingers in there, one against each rod, and apart from being impressed by the event and having an afterfeeling in my chest for about 15 minutes afterwards, I didn't notice any harm from the event. I can still work, cycle recreationally for a few hours, exert myself with moving stuff and life live like I'm used to in general. The only thing which might be a consequence is that I sometimes have a minor pain for 10 seconds or so in my chest muscles, but those are sporadically and not related to any particular activities, so I don't know if it is related.

Thing is, I always read and heard that such jolts are lethal. The surge didn't last long, but it passed right through my chest and wasn't mitigated in any way by any kind of barrier. And you often hear about people being killed by testing batteries with their tongue, which are only a fraction of the power of a domestic grid. How did I survive this incident?

In case it's relevant: I was around 16 years, a normally built male with no particular muscles or fat layers, in Belgium.

closed as off-topic by Leon Heller, Matt Young, Phil Frost, Stephen Collings, Daniel GrilloJan 23 '14 at 15:08

• This question does not appear to be about electronics design within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

• possible duplicate of How much voltage is "dangerous"? – Groo Jan 23 '14 at 10:52
• As the reply below states: We can only speculate and that should be a good enough reason to close the question. There can be no definite answer to this. – alexan_e Jan 23 '14 at 10:58
• You operated a gadget (your body) outside its specifications. When you do so, you void all warranty: it is entirely possible that your body will no longer operate according to specs (that includes not working at all). But you seem to make the mistake (that is also common among naive users of electronic) that such a maltreatment is guaranteed to heave a specific effect (like, in your case killing you). This is in general NOT the case. For all parameters there is generally a very broad margin in which it is not certain what the effect will be, including both death and no harm at all. – Wouter van Ooijen Jan 23 '14 at 11:12
• @WoutervanOoijen That is definitely an answer and I would gladly up-vote it. – alexan_e Jan 23 '14 at 11:27
• This question appears to be off-topic because it is not about electronic design. – Leon Heller Jan 23 '14 at 11:40

First

And you often hear about people being killed by testing batteries with their tongue,

The chances of such reports being true are close to zero.
I have never heard of such a report that is reputable or traceable to source*.
I cannot think of a mechanism that would make doing this likely to be fatal.
I do not recommend that others do this without advice from their attorney, GP, surgeon, insurer and spouse., BUT, I have 'tested batteries with my tongue' probably hundreds of times in my lifetime at voltages up to 9V / PP3 batteries. The sensation is 'interesting but nothing like the sort of effects I have experienced from more substantial and life threatening electric shocks.

Electrocution by AC mains:

See references at end.

Short: You usually need to pass a certain amount of current through your heart muscle long enough to cause fibrillation of the heart. The trigger point is inexact and will vary widely with circumstance and person. Many people receive severe mains electric shocks and survive with little or no apparent damage. Others receive what may appear lesser shocks and die. Luck and more is involved and not doing it is the best protection.

I have read accident reports of people who died due to a finger to finger shock while unplugging a cord from a mains socket. There was probably a secondary path to earth through the body as well.

Longer:

Death from electric shock from mains AC at residential voltage levels (say 100 VAC - 240 VAC range) is usually caused by fibrillation of the heart. Current passing through the heart interferes with the natural pace making cycle and the heart goes into an oscillatory mode that does not support pumping. It usually takes a current of look_it_up mA for a period around a certain criticaL heart timing parameter. The details are not as important as is knowing that you want to keep current away from your heart or, if possible, away from your body.

I have had probably dozens of AC mains shocks over a long lifetime - some severe, most less so. I've also managed a hand to hand 1200 VDC shock (not at all recommended) and one RF kick from a 100W + voice triggered transmitter ("hey - look, the aerial is disconn ... AGH!!!") I've made an increasing habit of trying REALLY hard to avoid mains shocks and I can't now remember the last time I had one. The odd very high impedance tickle is known to happen from time to time - but as these are a step on the path to too much current they too are avoided.

Ground fault interrupters / GFI = Earth leak circuit breakers / ELCB are designed to detect leakage of current from a circuit to ground and to then terminate the power supply in less time than the critical period. Say around 10 mS from memory. I purposefully tripped an ELCB with my body long ago to see what it felt like. Back of hand contact as below. The shock was substantial and painful even though it lasted only for a few mS.

A major problem with electric shock is that the body's muscles tend to contract under current frow and the victim may grip the live item and not be able to release their grip. This effect can occur at as low s 12V DC under "ideal" conditions. (Such as eg standing in salt water holding a metal fish spear and a LED lantern powered by 12V and mounted on hand held metal pole. A friend did this and a fault caused a return path via the fish spear and water and their legs and they report having their hands clamped on the spear and being unable o release it. ) DC is worse than AC for this but AC can be every bit as bad as is requried to be fatal.

If you ever MUST touch something which may be "live" then I've seen it recommended that the back of the hand or fingers be used so that if the muscles contract the limb will contract away from the conductor and will; not instead grasp it. This is in fact the precaution that I have taken personally for many years but see your attorney surgeon etc as above and take this as comment and not advice.

Electric shock - OSU

Hyperphysics page - Electric Shock

Wikipedia Ventricular fibrillation

Wikipedia - Electric shock - magnitude says:

The minimum current a human can feel depends on the current type (AC or DC) and frequency.

A person can feel at least 1 mA (rms) of AC at 60 Hz, while at least 5 mA for DC.

At around 10 milliamperes, AC current passing through the arm of a 68 kg (150 lb) human can cause powerful muscle contractions; the victim is unable to voluntarily control muscles and cannot release an electrified object.[3] This is known as the "let go threshold" and is a criterion for shock hazard in electrical regulations.

The current may, if it is high enough, cause tissue damage or fibrillation which leads to cardiac arrest;
more than 30 mA[4] of AC (rms, 60 Hz) or 300 – 500 mA of DC can cause fibrillation.[5][6]

A sustained electric shock from AC at 120 V, 60 Hz is an especially dangerous source of ventricular fibrillation because it usually exceeds the let-go threshold, while not delivering enough initial energy to propel the person away from the source.
However, the potential seriousness of the shock depends on paths through the body that the currents take.[5] If the voltage is less than 200 V, then the human skin, more precisely the stratum corneum, is the main contributor to the impedance of the body in the case of a macroshock—the passing of current between two contact points on the skin. The characteristics of the skin are non-linear however.
If the voltage is above 450–600 V, then dielectric breakdown of the skin occurs.[7]
The protection offered by the skin is lowered by perspiration, and this is accelerated if electricity causes muscles to contract above the let-go threshold for a sustained period of time.[5]

If an electrical circuit is established by electrodes introduced in the body, bypassing the skin, then the potential for lethality is much higher if a circuit through the heart is established.
This is known as a microshock. Currents of only 10 µA can be sufficient to cause fibrillation in this case.

• A reader mentioned a report of a man being killed using a multimeter on an Ohms range and pushing the probe tips through his skin into his body so the current flowed through his core resistance of (it says) around 100 Ohms.

It is essentially certain that this account is fabricated
(and most "Darwin award" stories are. I'd be genuinely pleased to know of a reputable link to the original claimed report of ant reputable report where this happened.

Note that it is substantially different to connect to a 9V powered Ohm meter than to directly contact a 9V battery's terminals.
Battery across the tongue - my assessment above stands.
Battery hand to hand with probes/contacts pushed through skin into body core !!! - Ouch! - I'd not recommend it ir do it purposefully. Death may be possible, but seems unlikely. 12V across chest near heart using sharp tipped probes HAS caused death. (Reference not to hand). However ....

An Ohm meter even on a low Ohms range is designed to provide a voltage such that at zero Ohms external load the meter is just delivered full current.

An example of a Simpson 260 meter as claimed to be used by the cited report.
There are a range of model 260 Simpson meters but all seem to be 20,000 Ohms per volt meters meaning it needs I = V /R = 1V/ 20,000 Ohm = 50 uA of current to achieve full scale deflection. The original 1930's model had a 50 uA movement and all others since also seem to have had. This is typical of this class and age of meter.

While the designers MAY arrange for 100 uA or 1 mA of full scale current to flow on low Ohms with probes shorted, the odds of it being designed to deliver 100 MA or even 10 mA in such conditions is minimal.

Questionable 1999 Darwin Award report

Simpson model 260 multimeter as reported to have been used:

Original 1930's model 260 - even this had a 50 uA movement.

260 series 2

Simpson 260.com

260 9SP

260 AFP-xx

260 SR

Legion

• A Navy sailor did kill himself, by measuring his internal resistance of 100 Ohm. There was noone else in his room for a few minutes, so a current of 90mA, produced by the 9V PP3 battery inside his multimeter, was enough to take his life. darwinawards.com/darwin/darwin1999-50.html If your tongue and lips are severed, a 9V battery might kill you. Stop boasting about that, and please correct your post as fast as possible. I flagged it because it can take lifes. – user2987828 Mar 15 '16 at 14:56
• @user2987828 I'll add a reference to the Darwin award report that appears to be the original source of that tale. If you manage to find a better spurce I'd be most pleased to know of it | It APPEARS that that report is fabricated - but it may not be. One comment by someone who says they heard the tale in a training course is that the probes were inserted into the mans thumbs purposefully to access his core resistance. Brave, strong & stupid it seems. | HOWEVER my response related to applying a battery to the tongue, which provide a completely different current path, which excludes the .... – Russell McMahon Mar 17 '16 at 6:31
• ... heart (in all people I'm aware of :-) ). Hand to hand conduction was not being discussed and poses a quite different mode. Even then it would be extremely unlikely to cause death. (Not impossible). | If you reread my answer you will hopefully realise that it is a good answer overall and does constitute "boasting" [tm] but is an account of reality. | In giving advice I ALWAYS err on the side of safety and I'm happy that the warnings I've given in this case - viz "I do not recommend that others do this without advice from their attorney, GP, surgeon, insurer and spouse." would be .... – Russell McMahon Mar 17 '16 at 6:36
• ... completely clear to any reasonable person.. – Russell McMahon Mar 17 '16 at 6:36
• You might at least want to add that the tongue and the hand touching the battery should not be severed. – user2987828 Mar 21 '16 at 9:17

We can only speculate.

I had my other hand against the nearby wall corner,

Walls are usually not that conductive, it is likely that this was an important factor.

I had only 2 fingers in there, one against each rod

If you had a separate finger against each pin of the plug, I'd expect the majority of the current to flow through your hand. From the fact you don't report your fingers having been reduced to a burned mess, I deduce you didn't make good contact with the pins. Perhaps you only made contact with a neutral, which is bonded to earth nearby, so any potential on this conductor would be low.

Also note that "the resistance of dry skin is usually between 1,000-100,000 Ohms." so to pass through your skin twice the 230V might only pass a current of 1.15 mA.

I suspect that your skin resistance was probably lower but you were saved by the relatively non-conductive wall.

And "While any amount of current over 10 milliamps (0.01 amp) is capable of producing painful to severe shock, currents between 100 and 200 mA (0.1 to 0.2 amp) are lethal. Currents above 200 milliamps (0.2 amp), while producing severe burns and unconsciousness, do not usually cause death if the victim is given immediate attention."

References

It is current that kills or paralyzes a human, not voltage. The voltage is applied over your body, which acts as a resistor, and the current will be limited by the total resistance created between the positive and negative potentials in that circuit. In your case, your other hand was not touching the wall, which is not very conductive, meaning that its relatively large resistance limited the total current over your body.

A current of 30mA for more than a minute would likely result in respiratory paralysis. For larger currents, you need even shorter time before damage to your organism occurs. Given the fact that you were holding a wall, I am pretty sure that, while uncomfortable, the current was too low to induce any damage.


text:
# Beamer: Grouping environment counters

In beamer, when I use \setbeamertemplate{theorems}[numbered] but this groups them all as the following.

What I want is theorems, lemmas and other environments to have different counters such as the following.

Is there a simple way for this? I can use notheorems option for beamer and redefine the environments myself but in this case the colour styles of the environments are removed.

-
You can say \newtheorem{mylemma}{Lemma} or \newtheorem{mylemma}{\translate{Lemma}} if you want to rely on multilingual features. The appearance of the mylemma environment will be the same as for theorems, but with autonomous numbering. This said, I prefer consecutive numbering even for presentations. –  egreg Jul 12 '13 at 13:50
This also kills the colouring for example. –  bkarpuz Jul 12 '13 at 15:55
Please, give an example of what you're doing –  egreg Jul 12 '13 at 16:00
Please see the pictures in OP (just added). –  bkarpuz Jul 12 '13 at 16:11
@bkarpuz Use \theoremstyle according to my changed answer. –  Toscho Jul 12 '13 at 17:09

beamer uses amsthm, which doesn't have a \renewtheorem like ntheorem does. You could hack into beamer (the file is /tex/latex/beamer/beamerbasetheorems.sty) but that is really bad behaviour. It's probably easier, to just \undef (from the package etoolbox) the macro \lemma and recreate the theorem with \newtheorem.

\documentclass{beamer}
\usepackage{etoolbox}
\setbeamertemplate{theorems}[numbered]
\undef{\lemma}
\undef{\example}
\newtheorem{lemma}{\translate{Lemma}}
\theoremstyle{example}
\newtheorem{example}{\translate{Example}}
\begin{document}
\begin{frame}
\begin{lemma}{Foobar}
Foo and bar.
\end{lemma}
\begin{lemma}{Barfoo}
Either bar or foo.
\end{lemma}
\begin{theorem}{Something new}
No, not really.
\end{theorem}
\begin{example}{Color?}
Indeed.
\end{example}
\end{frame}
\end{document}

Concerning other theorem environments: look at the above file. After \mode<all>{ you'll find the definitions, beamer does, which you can \undef and recreate as you like. By default, the counting depends on the counting of theorem (except for proof/beweis of course). You'll also find the theoremstyles used for the different theorems. example for example (no pun intended) uses \theoremstyle{example}.

-
Nope, I do the same for example and it removes the example colouring. It is not green any more... –  bkarpuz Jul 12 '13 at 15:47
I changed the answer to accomodate for that. –  Toscho Jul 12 '13 at 17:10

format: plain


text:
If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Square roots of perfect squares

Learn how to find the square root of perfect squares like 25, 36, and 81.
Let's start by taking a look at an example evaluating the square root of start color #1fab54, 25, end color #1fab54:
square root of, start color #1fab54, 25, end color #1fab54, end square root, equals, question mark
Step 1: Ask, "What number squared equals start color #1fab54, 25, end color #1fab54?"
Step 2: Notice that start color #11accd, 5, end color #11accd squared equals start color #1fab54, 25, end color #1fab54.
start color #11accd, 5, end color #11accd, squared, equals, start color #11accd, 5, end color #11accd, times, start color #11accd, 5, end color #11accd, equals, start color #1fab54, 25, end color #1fab54
square root of, start color #1fab54, 25, end color #1fab54, end square root, equals, start color #11accd, 5, end color #11accd
Here's a question to make sure you understood:
How can we be sure that start color #11accd, 5, end color #11accd is the right answer?

Connection to a square

Finding the square root of start color #1fab54, 25, end color #1fab54 is the same as finding the side length of a square with an area of start color #1fab54, 25, end color #1fab54.
A square with an area of start color #1fab54, 25, end color #1fab54 has a side length of start color #11accd, 5, end color #11accd.

Practice Set 1:

Problem 1A
• Current
4, squared, equals

Reflection question

Which claim shows how square roots work?

Practice Set 2:

Problem 2A
• Current
square root of, 1, end square root, equals

Practice Set 3:

Problem 3A
• Current
square root of, 121, end square root, equals

Want to join the conversation?

• Can an exponent be a negative number?
• You already know that an exponent represents the number of times you have to multiply a number by itself. A negative exponent is equivalent to the inverse of the same number with a positive exponent. There is nothing special about solving a problem that includes negative exponentials.
• That is awesome for you continue to learn ahead
• What happens if try to find the
the square root of an imperfect square
• Most probably it will be an irrational number in which case we can only approximate its value.

However, sometimes we can write the radicand as a fraction of two perfect squares.
Example: √5.76 = √(576∕100) = √(144∕25) = √(12²∕5²) = 12∕5 = 2.4
• I just noticed something really interesting (I think):

If I can't remember a square of some numbers (7^2 and 8^2 can be a bit tricky for me for some reason) but I remember the square number of the root that comes before it (6 and 36 in the case I'm trying to find 7^2),
I can do 36+6 to make it into 6*7, and then add a 7 to make it into a 7*7.

I tried to play around and find a rule and I think I found the formula:
n^2 + 2n + 1 = ( n + 1 )^2
(where n is the root number of the square that you do know).

if you would visualize the numbers on a grid, the n^2 is the area of the square, while the 2n+1 is the number of the additional units the is added on the side.

It's easier to see it on a times table: When looking at 25, the number diagonally next to it is 36. If you count the 'units' (the other multiplies that are on the same axes that leads toward 36 IE: 3,6,9 up to 36 on both sides) they will be the same as the 2n+1.

I tried to find a formula for a square of a root that isn't immediately follows the root I know. example: 3^2 = 9, 5^2 = ?.
unfortunately I couldn't think on one consistent formula, because there is always a need to add more and (n+1) with more additional 1s the further the number is.

does the formula I found have a name? I'm pretty sure I wasn't the first to think of that lol
• You can use the pascal's triangle I suppose

Edit1: here: https://en.wikipedia.org/wiki/Polynomial_expansion

Edit2: Sorry that is not true. That applies to expansions with higher powers, but not between different sqaures.
But maybe you can look at sum of squares where
∑x^2 = n(n+1)(2n+1)/6
• So, a perfect square is basically the answer to an exponent? (ex. 2^2(4), 12^12(144))
• it is an integer with a square root that is also an integer
• How can we use square roots in life?
• There are many ways in life you can use square roots. Some of them include a mathmatician, engineer, architect, carpenter, etc.
• How do you solve square roots that can't be squared easily?
• what i do is if the number is less then 81 then I go through all of the numbers 1-9 to see if they match up. if its greater than 144 then i just use a calculator
• can a decimal have a square root
• Yes, decimals can have square roots. For example, the (principal) square root of 0.64 is 0.8, since 0.8*0.8 = 0.64.
• How to calculate imperfect squares?
• imperfect square roots (example: 32 SQUARE)(I am going to do square uppercased because I don't know how to make a square root sign)
32 SQUARE
25 SQUARE
than the other closest
36 SQUARE
than just find the root of these numbers
5
6
it is between 5 and 6
hope this helped and may God bless your day
• Would you do the same for a negative square root ?🤔
• You cannot find the negative square root of a number. Think of what square roots are. If we take 36 and find the square root, you'll see it's 6. Because 6 x 6 = 36. We multiply it by itself and it gives us 36.

We can't do this with negatives. Consider -36 and finding the square root of that. Which number multiplied by itself will get -36?

Well, remember the rules we have for multiplying negatives and positives.
negative x negative = positive
negative x positive = positive
positive x positive = positive.

It can't be -6, because that will give us a positive number, instead of -36.
It can't be 6, because that will also give us a positive number instead of -36.

So, negatives can't have square roots.

You'll learn in more advanced classes what we do in these cases.


text:
## Python for NLP: Working with Facebook FastText Library

This is the 20th article in my series of articles on Python for NLP. In the last few articles, we have been exploring deep learning techniques to perform a variety of machine learning tasks, and you should also be familiar with the concept of word embeddings. Word embeddings is a way to convert textual information into numeric form, which in turn can be used as input to statistical algorithms. In my article on word embeddings, I explained how we can create our own word embeddings and how we can use built-in word embeddings such as GloVe.

In this article, we are going to study FastText which is another extremely useful module for word embedding and text classification. FastText has been developed by Facebook and has shown excellent results on many NLP problems, such as semantic similarity detection and text classification.

In this article, we will briefly explore the FastText library. This article is divided into two sections. In the first section, we will see how FastText library creates vector representations that can be used to find semantic similarities between the words. In the second section, we will see the application of FastText library for text classification.

### FastText for Semantic Similarity

FastText supports both Continuous Bag of Words and Skip-Gram models. In this article, we will implement the skip-gram model to learn vector representation of words from the Wikipedia articles on artificial intelligence, machine learning, deep learning, and neural networks. Since these topics are quite similar, we chose these topics to have a substantial amount of data to create a corpus. You can add more topics of the similar nature if you want.

As a first step, we need to import the required libraries. We will make use of the Wikipedia library for Python, which can be downloaded via the following command:

\$ pip install wikipedia

#### Importing Libraries

The following script imports the required libraries into our application:

from keras.preprocessing.text import Tokenizer
from gensim.models.fasttext import FastText
import numpy as np
import matplotlib.pyplot as plt
import nltk
from string import punctuation
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from nltk.stem import WordNetLemmatizer
from nltk.tokenize import sent_tokenize
from nltk import WordPunctTokenizer

import wikipedia
import nltk
en_stop = set(nltk.corpus.stopwords.words('english'))

%matplotlib inline

You can see that we are using the FastText module from the gensim.models.fasttext library. For the word representation and semantic similarity, we can use the Gensim model for FastText. This model can run on Windows, however, for text classification, we will have to use Linux platform. We will see that in the next section.

#### Scraping Wikipedia Articles

In this step, we will scrape the required Wikipedia articles. Look at the script below:

artificial_intelligence = wikipedia.page("Artificial Intelligence").content
machine_learning = wikipedia.page("Machine Learning").content
deep_learning = wikipedia.page("Deep Learning").content
neural_network = wikipedia.page("Neural Network").content

artificial_intelligence = sent_tokenize(artificial_intelligence)
machine_learning = sent_tokenize(machine_learning)
deep_learning = sent_tokenize(deep_learning)
neural_network = sent_tokenize(neural_network)

artificial_intelligence.extend(machine_learning)
artificial_intelligence.extend(deep_learning)
artificial_intelligence.extend(neural_network)

To scrape a Wikipedia page, we can use the page method from the wikipedia module. The name of the page that you want to scrap is passed as a parameter to the page method. The method returns WikipediaPage object, which you can then use to retrieve the page contents via the content attribute, as shown in the above script.

The scraped content from the four Wikipedia pages are then tokenized into sentences using the sent_tokenize method. The sent_tokenize method returns list of sentences. The sentences for the four pages are tokenized separately. Finally, sentences from the four articles are joined together via the extend method.

#### Data Preprocessing

The next step is to clean our text data by removing punctuations and numbers. We will also convert the data into the lower case. The words in our data will be lemmatized to their root form. Furthermore, the stop words and the words with the length less than 4 will be removed from the corpus.

The preprocess_text function, as defined below performs the preprocessing tasks.

import re
from nltk.stem import WordNetLemmatizer

stemmer = WordNetLemmatizer()

def preprocess_text(document):
# Remove all the special characters
document = re.sub(r'\W', ' ', str(document))

# remove all single characters
document = re.sub(r'\s+[a-zA-Z]\s+', ' ', document)

# Remove single characters from the start
document = re.sub(r'\^[a-zA-Z]\s+', ' ', document)

# Substituting multiple spaces with single space
document = re.sub(r'\s+', ' ', document, flags=re.I)

# Removing prefixed 'b'
document = re.sub(r'^b\s+', '', document)

# Converting to Lowercase
document = document.lower()

# Lemmatization
tokens = document.split()
tokens = [stemmer.lemmatize(word) for word in tokens]
tokens = [word for word in tokens if word not in en_stop]
tokens = [word for word in tokens if len(word) > 3]

preprocessed_text = ' '.join(tokens)

return preprocessed_text

Let's see if our function performs the desired task by preprocessing a dummy sentence:

sent = preprocess_text("Artificial intelligence, is the most advanced technology of the present era")
print(sent)

final_corpus = [preprocess_text(sentence) for sentence in artificial_intelligence if sentence.strip() !='']

word_punctuation_tokenizer = nltk.WordPunctTokenizer()
word_tokenized_corpus = [word_punctuation_tokenizer.tokenize(sent) for sent in final_corpus]

The preprocessed sentence looks like this:

artificial intelligence advanced technology present

You can see the punctuations and stop words have been removed, and the sentences have been lemmatized. Furthermore, words with length less than 4, such as "era", have also been removed. These choices were chosen randomly for this test, so you may allow the words with smaller or greater lengths in the corpus.

#### Creating Words Representation

We have preprocessed our corpus. Now is the time to create word representations using FastText. Let's first define the hyper-parameters for our FastText model:

embedding_size = 60
window_size = 40
min_word = 5
down_sampling = 1e-2

Here embedding_size is the size of the embedding vector. In other words, each word in our corpus will be represented as a 60-dimensional vector. The window_size is the size of the number of words occurring before and after the word based on which the word representations will be learned for the word. This might sound tricky, however in the skip-gram model we input a word to the algorithm and the output is the context words. If the window size is 40, for each input there will be 80 outputs: 40 words that occur before the input word and 40 words that occur after the input word. The word embeddings for the input word are learned using these 80 output words.

The next hyper-parameter is the min_word, which specifies the minimum frequency of a word in the corpus for which the word representations will be generated. Finally, the most frequently occurring word will be down-sampled by a number specified by the down_sampling attribute.

Let's now create our FastText model for word representations.

%%time
ft_model = FastText(word_tokenized_corpus,
size=embedding_size,
window=window_size,
min_count=min_word,
sample=down_sampling,
sg=1,
iter=100)

All the parameters in the above script are self-explanatory, except sg. The sg parameter defines the type of model that we want to create. A value of 1 specifies that we want to create skip-gram model. Whereas zero specifies the bag of words model, which is the default value as well.

Execute the above script. It may take some time to run. On my machine the time statistics for the above code to run are as follows:

CPU times: user 1min 45s, sys: 434 ms, total: 1min 45s
Wall time: 57.2 s

Let's now see the word representation for the word "artificial". To do so, you can use the wv method of the FastText object and pass it the name of the word inside a list.

print(ft_model.wv['artificial'])

Here is the output:

[-3.7653010e-02 -4.5558015e-01  3.2035065e-01 -1.5289043e-01
4.0645871e-02 -1.8946664e-01  7.0426887e-01  2.8806925e-01
-1.8166199e-01  1.7566417e-01  1.1522485e-01 -3.6525184e-01
-6.4378887e-01 -1.6650060e-01  7.4625671e-01 -4.8166099e-01
2.0884991e-01  1.8067230e-01 -6.2647951e-01  2.7614883e-01
-3.6478557e-02  1.4782918e-02 -3.3124462e-01  1.9372456e-01
4.3028224e-02 -8.2326338e-02  1.0356739e-01  4.0792203e-01
-2.0596240e-02 -3.5974573e-02  9.9928051e-02  1.7191900e-01
-2.1196717e-01  6.4424530e-02 -4.4705093e-02  9.7391091e-02
-2.8846195e-01  8.8607501e-03  1.6520244e-01 -3.6626378e-01
-6.2017748e-04 -1.5083785e-01 -1.7499258e-01  7.1994811e-02
-1.9868813e-01 -3.1733567e-01  1.9832127e-01  1.2799081e-01
-7.6522082e-01  5.2335665e-02 -4.5766738e-01 -2.7947658e-01
3.7890410e-03 -3.8761377e-01 -9.3001537e-02 -1.7128626e-01
-1.2923178e-01  3.9627206e-01 -3.6673656e-01  2.2755004e-01]

In the output above, you can see a 60-dimensional vector for the word "artificial"

Let's now find top 5 most similar words for the words 'artificial', 'intelligence', 'machine', 'network', 'recurrent', 'deep'. You can chose any number of words. The following script prints the specified words along with the 5 most similar words.

semantically_similar_words = {words: [item[0] for item in ft_model.wv.most_similar([words], topn=5)]
for words in ['artificial', 'intelligence', 'machine', 'network', 'recurrent', 'deep']}

for k,v in semantically_similar_words.items():
print(k+":"+str(v))

The output is as follows:

artificial:['intelligence', 'inspired', 'book', 'academic', 'biological']
intelligence:['artificial', 'human', 'people', 'intelligent', 'general']
machine:['ethic', 'learning', 'concerned', 'argument', 'intelligence']
network:['neural', 'forward', 'deep', 'backpropagation', 'hidden']
recurrent:['rnns', 'short', 'schmidhuber', 'shown', 'feedforward']
deep:['convolutional', 'speech', 'network', 'generative', 'neural']

We can also find the cosine similarity between the vectors for any two words, as shown below:

print(ft_model.wv.similarity(w1='artificial', w2='intelligence'))

The output shows a value of "0.7481". The value can be anywhere between 0 and 1. A higher value means higher similarity.

#### Visualizing Word Similarities

Though each word in our model is represented as 60-dimensional vector, we can use principal component analysis technique to find two principal components. The two principal components can then be used to plot the words in a two dimensional space. However, first we need to create a list of all the words in the semantically_similar_words dictionary. The following script does that:

from sklearn.decomposition import PCA

all_similar_words = sum([[k] + v for k, v in semantically_similar_words.items()], [])

print(all_similar_words)
print(type(all_similar_words))
print(len(all_similar_words))

In the script above, we iterate through all the key-value pairs in the semantically_similar_words dictionary. Each key in the dictionary is a word. The corresponding value is a list of all semantically similar words. Since we found the top 5 most similar words for a list of 6 words i.e. 'artificial', 'intelligence', 'machine', 'network', 'recurrent', 'deep', you will see that there will be 30 items in the all_similar_words list.

Next, we have to find the word vectors for all these 30 words, and then use PCA to reduce the dimensions of the word vectors from 60 to 2. We can then use the plt method, which is an alias of the matplotlib.pyplot method to plot the words on a two-dimensional vector space.

Execute the following script to visualize the words:

word_vectors = ft_model.wv[all_similar_words]

pca = PCA(n_components=2)

p_comps = pca.fit_transform(word_vectors)
word_names = all_similar_words

plt.figure(figsize=(18, 10))
plt.scatter(p_comps[:, 0], p_comps[:, 1], c='red')

for word_names, x, y in zip(word_names, p_comps[:, 0], p_comps[:, 1]):
plt.annotate(word_names, xy=(x+0.06, y+0.03), xytext=(0, 0), textcoords='offset points')

The output of the above script looks like this:

You can see the words that frequently occur together in the text are close to each other in the two dimensional plane as well. For instance, the words "deep" and "network" are almost overlapping. Similarly, the words "feedforward" and "backpropagation" are also very close.

Now we know how to create word embeddings using FastText. In the next section, we will see how FastText can be used for text classification tasks.

### FastText for Text Classification

Text classification refers to classifying textual data into predefined categories based on the contents of the text. Sentiment analysis, spam detection, and tag detection are some of the most common examples of use-cases for text classification.

FastText text classification module can only be run via Linux or OSX. If you are a Windows user, you can use Google Colaboratory to run FastText text classification module. All the scripts in this section have been run using Google Colaboratory.

#### The Dataset

The dataset for this article can be downloaded from this Kaggle link. The dataset contains multiple files, but we are only interested in the yelp_review.csv file. The file contains more than 5.2 million reviews about different businesses including restaurants, bars, dentists, doctors, beauty salons, etc. However, we will only be using the first 50,000 records to train our model due to memory constraints. You can try with more records if you want.

Let's import the required libraries and load the dataset:

import pandas as pd
import numpy as np

bins = [0,2,5]
review_names = ['negative', 'positive']

yelp_reviews['reviews_score'] = pd.cut(yelp_reviews['stars'], bins, labels=review_names)

In the script above we load the yelp_review_short.csv file that contains 50,000 reviews with the pd.read_csv function.

We will simplify our problem by converting the numerical values for the reviews into categorical ones. This will be done by adding a new column ,reviews_score, to our dataset. If the user review has a value between 1-2 in the Stars column (which rates the business on a 1-5 scale), the reviews_score column will have a string value negative. If the rating is between 3-5 in the Stars column, the reviews_score column will contain a value positive. This makes our problem, a binary classification problem.

Finally the header of the dataframe is printed as shown below:

#### Installing FastText

The next step is to import FastText models, which can be imported using the wget command from the GitHub repository, as shown in the following script:

!wget https://github.com/facebookresearch/fastText/archive/v0.1.0.zip

Note: If you are executing the above command from a Linux terminal, you don't have to prefix ! before the above command. In Google Colaboratory notebook, any command after the ! is executed as a shell command and not within the Python interpreter. Hence all non-Python commands here are prefixed by !.

If you run the above script and see the following results, that means FastText has been successfully downloaded:

--2019-08-16 15:05:05--  https://github.com/facebookresearch/fastText/archive/v0.1.0.zip
Resolving github.com (github.com)... 140.82.113.4
Connecting to github.com (github.com)|140.82.113.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/zip]
Saving to: ‘v0.1.0.zip’

v0.1.0.zip              [ <=>                ]  92.06K  --.-KB/s    in 0.03s

2019-08-16 15:05:05 (3.26 MB/s) - ‘v0.1.0.zip’ saved [94267]

The next step is to unzip FastText modules. Simply type the following command:

!unzip v0.1.0.zip

Next, you have to navigate to the directory where you downloaded FastText and then execute the !make command to run C++ binaries. Execute the following steps:

cd fastText-0.1.0
!make

If you see the following output, that means FastText is successfully installed on your machine.

c++ -pthread -std=c++0x -O3 -funroll-loops -c src/args.cc
c++ -pthread -std=c++0x -O3 -funroll-loops -c src/dictionary.cc
c++ -pthread -std=c++0x -O3 -funroll-loops -c src/productquantizer.cc
c++ -pthread -std=c++0x -O3 -funroll-loops -c src/matrix.cc
c++ -pthread -std=c++0x -O3 -funroll-loops -c src/qmatrix.cc
c++ -pthread -std=c++0x -O3 -funroll-loops -c src/vector.cc
c++ -pthread -std=c++0x -O3 -funroll-loops -c src/model.cc
c++ -pthread -std=c++0x -O3 -funroll-loops -c src/utils.cc
c++ -pthread -std=c++0x -O3 -funroll-loops -c src/fasttext.cc
c++ -pthread -std=c++0x -O3 -funroll-loops args.o dictionary.o productquantizer.o matrix.o qmatrix.o vector.o model.o utils.o fasttext.o src/main.cc -o fasttext

To verify the installation, execute the following command:

!./fasttext

You should see that these commands are supported by FastText:

usage: fasttext <command> <args>

The commands supported by FastText are:

supervised              train a supervised classifier
quantize                quantize a model to reduce the memory usage
test                    evaluate a supervised classifier
predict                 predict most likely labels
predict-prob            predict most likely labels with probabilities
skipgram                train a skipgram model
cbow                    train a cbow model
print-word-vectors      print word vectors given a trained model
print-sentence-vectors  print sentence vectors given a trained model
nn                      query for nearest neighbors
analogies               query for analogies

#### Text Classification

Before we train FastText models to perform text classification, it is pertinent to mention that FastText accepts data in a special format, which is as follows:

_label_tag This is sentence 1
_label_tag2 This is sentence 2.

If we look at our dataset, it is not in the desired format. The text with positive sentiment should look like this:

__label__positive burgers are very big portions here.

Similarly, negative reviews should look like this:

__label__negative They do not use organic ingredients, but I thi...

The following script filters the reviews_score and text columns from the dataset and then prefixes __label__ before all the values in the reviews_score column. Similarly, the \n and \t are replaced by a space in the text column. Finally, the updated dataframe is written to the disk in the form of yelp_reviews_updated.txt.

import pandas as pd
from io import StringIO
import csv

col = ['reviews_score', 'text']

yelp_reviews = yelp_reviews[col]
yelp_reviews['reviews_score']=['__label__'+ s for s in yelp_reviews['reviews_score']]
yelp_reviews['text']= yelp_reviews['text'].replace('\n',' ', regex=True).replace('\t',' ', regex=True)
yelp_reviews.to_csv(r'/content/drive/My Drive/Colab Datasets/yelp_reviews_updated.txt', index=False, sep=' ', header=False, quoting=csv.QUOTE_NONE, quotechar="", escapechar=" ")

Let's now print the head of the updated yelp_reviews dataframe.

yelp_reviews.head()

You should see the following results:

reviews_score   text
0   __label__positive   Super simple place but amazing nonetheless. It...
1   __label__positive   Small unassuming place that changes their menu...
2   __label__positive   Lester's is located in a beautiful neighborhoo...
3   __label__positive   Love coming here. Yes the place always needs t...
4   __label__positive   Had their chocolate almond croissant and it wa...

Similarly, the tail of the dataframe looks like this:

    reviews_score   text
49995   __label__positive   This is an awesome consignment store! They hav...
49996   __label__positive   Awesome laid back atmosphere with made-to-orde...
49997   __label__positive   Today was my first appointment and I can hones...
49998   __label__positive   I love this chic salon. They use the best prod...
49999   __label__positive   This place is delicious. All their meats and s...

We have converted our dataset into the required shape. The next step is to divide our data into train and test sets. The 80% data i.e. the first 40,000 records out of 50,000 records will be used to train the data, while 20% data (the last 10,000 records) will be used to evaluate the performance of the algorithm.

The following script divides the data into training and test sets:

!head -n 40000 "/content/drive/My Drive/Colab Datasets/yelp_reviews_updated.txt" > "/content/drive/My Drive/Colab Datasets/yelp_reviews_train.txt"
!tail -n 10000 "/content/drive/My Drive/Colab Datasets/yelp_reviews_updated.txt" > "/content/drive/My Drive/Colab Datasets/yelp_reviews_test.txt"

Once the above script is executed, the yelp_reviews_train.txt file will be generated, which contains the training data. Similarly, the newly generated yelp_reviews_test.txt file will contain test data.

Now is the time to train our FastText text classification algorithm.

%%time
!./fasttext supervised -input "/content/drive/My Drive/Colab Datasets/yelp_reviews_train.txt" -output model_yelp_reviews

To train the algorithm we have to use supervised command and pass it the input file. The model name is specified after the -output keyword. The above script will result in a trained text classification model called model_yelp_reviews.bin. Here is the output for the script above:

Read 4M words
Number of words:  177864
Number of labels: 2
Progress: 100.0%  words/sec/thread: 2548017  lr: 0.000000  loss: 0.246120  eta: 0h0m
CPU times: user 212 ms, sys: 48.6 ms, total: 261 ms
Wall time: 15.6 s

You can take a look at the model via !ls command as shown below:

!ls

Here is the output:

args.o             Makefile         quantization-results.sh
classification-results.sh  model.o          src
CONTRIBUTING.md        model_yelp_reviews.bin   tutorials
dictionary.o           model_yelp_reviews.vec   utils.o
eval.py            PATENTS          vector.o
fasttext           pretrained-vectors.md    wikifil.pl
fasttext.o         productquantizer.o       word-vector-example.sh
get-wikimedia.sh       qmatrix.o            yelp_reviews_train.txt

You can see the model_yelp_reviews.bin in the above list of documents.

Finally, to test the model you can use the test command. You have to specify the model name and the test file after the test command, as shown below:

!./fasttext test model_yelp_reviews.bin "/content/drive/My Drive/Colab Datasets/yelp_reviews_test.txt"

The output of the above script looks like this:

N   10000
[email protected] 0.909
[email protected] 0.909
Number of examples: 10000

Here [email protected] refers to precision and [email protected]refers to recall. You can see our model achieves precision and recall of 0.909 which is pretty good.

Let's now try to clean our text of punctuations, special characters, and convert it into the lower case to improve the uniformity of text. The following script cleans the train set:

!cat "/content/drive/My Drive/Colab Datasets/yelp_reviews_train.txt" | sed -e "s/$$[.\!?,’/()]$$/ \1 /g" | tr "[:upper:]" "[:lower:]" > "/content/drive/My Drive/Colab Datasets/yelp_reviews_train_clean.txt"

And the following script cleans the test set:

"/content/drive/My Drive/Colab Datasets/yelp_reviews_test.txt" | sed -e "s/$$[.\!?,’/()]$$/ \1 /g" | tr "[:upper:]" "[:lower:]" > "/content/drive/My Drive/Colab Datasets/yelp_reviews_test_clean.txt"

Now, we will train the model on the cleaned training set:

%%time
!./fasttext supervised -input "/content/drive/My Drive/Colab Datasets/yelp_reviews_train_clean.txt" -output model_yelp_reviews

And finally, we will use the model trained on cleaned training set to make predictions on the cleaned test set:

!./fasttext test model_yelp_reviews.bin "/content/drive/My Drive/Colab Datasets/yelp_reviews_test_clean.txt"

The output of the above script is as follows:

N   10000
[email protected] 0.915
[email protected] 0.915
Number of examples: 10000

You can see a slight increase in both precision and recall. To further improve the model, you can increase the epochs and learning rate of the model. The following script sets the number of epochs to 30 and learning rate to 0.5.

%%time
!./fasttext supervised -input "/content/drive/My Drive/Colab Datasets/yelp_reviews_train_clean.txt" -output model_yelp_reviews -epoch 30 -lr 0.5

You can try different numbers and see if you can get better results. Don't forget to share your results in the comments!

### Conclusion

FastText model has recently been proved state of the art for word embeddings and text classification tasks on many datasets. It is very easy to use and lightning fast as compared to other word embedding models.

In this article, we briefly explored how to find semantic similarities between different words by creating word embeddings using FastText. The second part of the article explains how to perform text classification via FastText library.

Paris (France)
Programmer | Blogger | Data Science Enthusiast | PhD To Be | Arsenal FC for Life


text:
# Skein or Keccak stream cipher construction

I am wondering if using Skein or the Keccak hash algorithm in this construction (as a stream cipher) is secure:

• $H$ = Keccak or Skein hash with a 256 bit output
• $K$ = The main 256 bit random key, pre-shared between sender and receiver
• $K_M$ = A secondary 256 bit random key for creating the MAC, pre-shared between sender and receiver
• $IV$ = A per message 256 bit random initialization vector, sent in the clear with the ciphertext and MAC
• $i$ = counter starting at 0 for each message which increments by 1 every 256 bit block
• $K_i$ = 256 bit block of the generated key for encrypting the corresponding 256 bit block of the plaintext $P_i$
• $P_i$ = 256 bit block of the plaintext. The final plaintext block would be padded to the right with 0 bits, thus the final concatenated plaintext is a multiple of 256 bits and disguises the true plaintext length.
• $C_i$ = 256 bit block of ciphertext
• $|$ = concatenation
• ⊕ = XOR

Encryption:

1. $K_i$ = $H$($K$ | $IV$ | $i$)
2. $C_i$ = $K_i$ ⊕ $P_i$

MAC:

• $H$($K_M$ | $IV$ | $C_i$ ... $C_n$)

I hope I explained that clearly.

My other question: Is there a particular attack on using the same key for encryption and MAC?

-

I am wondering if using Skein or the Keccak hash algorithm in this construction (as a stream cipher) is secure:

In the case of Skein and Keccak it should be secure. However, both of those have defined their own cipher modes which you should IMO prefer. (For compatibility, if not security.)

• The Skein one is defined in section 4.10 of the paper. It uses the underlying primitive directly rather than hashing the key and nonce.

• For Keccak the web site links to a separate paper on an authenticated encryption mode. It uses the sponge to squeeze a larger number of output bits, like the SHAKE modes of the hash function.

Is there a particular attack on using the same key for encryption and MAC?

You must first make sure the MAC invocation can never match an encryption one. I.e. it is not possible for $K|IV|C$ to match any $K|IV|i$.

Easiest would probably be to add a string to make them differ, like $H(K|\text{'E'}|IV|i)$ and $H(K|\text{'A'}|IV|C)$.

Generically, your construction is not necessarily secure. First a hash function doesn't have to be a secure MAC when you prepend the key. Second, a stream cipher must be a PRF, which is a stronger condition than unforgeability for a MAC.

For example, you could define a stupid MAC like: $MAC_k(m)||MAC_k(m)$ and it would be just as strong a MAC as the original, but would make a lousy stream cipher.

(In practice most MACs do seem to also claim to be PRF.)

-
[+1] For what it’s worth: there’s a question handling “Is there a difference between PRF and a hash function?” which provides some additional info (and confirms the later part of this answer). –  e-sushi Aug 5 at 12:43

If you replace $H$ with a MAC that is build using $H$, i.e. NMAC, then it will be provably secure. Encryption will be $C_i = MAC_k(IV | i) \oplus P_i$. You are guaranteed by the MAC security property (existential forgery) that an adversary cannot generate any of the key stream on his own and so you are left with a secure stream cipher. Just using $H$ by itself probably will not have any attacks on it (or else they would lead to some significant weakness in the underlying hash function) but it will not be provably secure.

The problem with your construction in general is that you are assuming some strong hiding property of the hash function that may or may not exist. The main properties of a cryptographic hash function are:

1. Pre-image resistance: for a given $x$, it should be difficult to find a message $m$ such that $H(m) = x$

2. Second pre-image resistance: for a given $x$ and $m$, such that $H(m) = x$, it should be difficult to find $m'$ such that $m \neq m'$ and $H(m') = x$

3. Collision resistance: it should be difficult to find two messages $m$ and $m'$ such that $H(m) = H(m')$

Collision resistance implies second pre-image resistance, and in most cases also implies pre-image resistance, so it is the most useful one to consider. However, a hash function could be collision resistance and still leak many of the bits of the input. For instance, if $H$ is a collision resistant hash function, you can construct $H'$ as follows:

$$H'(m) = \text{first 10 bits of m } | H(m)$$

and it will still be collision resistant. Now, obviously SHA-3 does not have this property, but the point is that it was not tested for strict hiding. If you wanted that you would use an actual cipher which was tested for that. Therefore you should not use it as if it does have that property.

-
Digging around I can see from this answer and this answer that Skein and Keccak are secure as MACs in the form $H$($K$ | $M$) and they have strong collision resistance, second pre-image resistance and pre-image resistance. Shouldn't they have the required hiding property for use as a stream cipher? It seems overkill and slow to need NMAC or HMAC when it is already secure... –  kimi Aug 5 at 1:18
Oh well sure, if it has a built-in MAC mode then you can certainly use that. I wasn't aware of that before. I meant only that you cannot generically use a hash function for encryption like you were proposing, but a MAC would suffice. It doesn't have to be NMAC. –  Travis Mayberry Aug 5 at 2:44
A MAC does not necessarily suffice. $\:$ One needs a PRF. $\;\;\;\;$ –  Ricky Demer Aug 5 at 4:19
Well the hash functions listed above are secure as a generic MAC in the simple $H$($K$ | $M$). Skein does have a built-in MAC mode which is slightly better though. On the Keccak website the authors state: "Unlike SHA-1 and SHA-2, Keccak does not have the length-extension weakness, hence does not need the HMAC nested construction. Instead, MAC computation can be performed by simply prepending the message with the key." So technically the construct in my original post is using the MAC mode and I do not see why you cannot turn it into a stream cipher like that... –  kimi Aug 5 at 4:23
Oh you're right Ricky. I remembered you could encrypt from a MAC but actually you would have to do it one bit at a time. You could have a degenerate MAC that always sets the last bit to one for instance, which would make a bad stream cipher. But you could do something like a Goldreich-Levin hard core predicate and use that to encrypt a single bit. But, you could do the same thing with a hash function so actually my whole point is kind of nullified :D –  Travis Mayberry Aug 5 at 11:21


text:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
Rank
Name
Level
League
Trophies
Donations
Role
#1
11
4438
379

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  for i, row in enumerate(soup.findAll("div",attrs = {"class":"clan__rowContainer"})): user_dict = {} for j,col in enumerate(row.findAll("div",attrs = {"class":"clan__row"})): if j == 0: user_dict["rank"] = col.string.strip().replace("#","") elif j == 1: user_dict["name"] = col.a.string.strip() user_dict["uid"] = col.a.get("href").strip("/profile/") elif j == 2: user_dict["level"] = col.span.string.strip() elif j == 3: user_dict["league"] = col.contents[1].div.get("class")[0].replace("league__","") elif j == 4: user_dict["score"] = col.div.string.strip() elif j == 5: user_dict["donations"] = col.string.strip() elif j == 6: user_dict["role"] = col.string.strip() print(user_dict)


text:
# 33.5 Quarks: is that all there is?

 Page 1 / 20
• Define fundamental particle.
• Describe quark and antiquark.
• List the flavors of quark.
• Outline the quark composition of hadrons.
• Determine quantum numbers from quark composition.

Quarks have been mentioned at various points in this text as fundamental building blocks and members of the exclusive club of truly elementary particles. Note that an elementary or fundamental particle    has no substructure (it is not made of other particles) and has no finite size other than its wavelength. This does not mean that fundamental particles are stable—some decay, while others do not. Keep in mind that all leptons seem to be fundamental, whereas no hadrons are fundamental. There is strong evidence that quarks are the fundamental building blocks of hadrons as seen in [link] . Quarks are the second group of fundamental particles (leptons are the first). The third and perhaps final group of fundamental particles is the carrier particles for the four basic forces. Leptons, quarks, and carrier particles may be all there is. In this module we will discuss the quark substructure of hadrons and its relationship to forces as well as indicate some remaining questions and problems.

## Conception of quarks

Quarks were first proposed independently by American physicists Murray Gell-Mann and George Zweig in 1963. Their quaint name was taken by Gell-Mann from a James Joyce novel—Gell-Mann was also largely responsible for the concept and name of strangeness. (Whimsical names are common in particle physics, reflecting the personalities of modern physicists.) Originally, three quark types—or flavors    —were proposed to account for the then-known mesons and baryons. These quark flavors are named up    ( u ), down    ( d ), and strange    ( s ). All quarks have half-integral spin and are thus fermions. All mesons have integral spin while all baryons have half-integral spin. Therefore, mesons should be made up of an even number of quarks while baryons need to be made up of an odd number of quarks. [link] shows the quark substructure of the proton, neutron, and two pions. The most radical proposal by Gell-Mann and Zweig is the fractional charges of quarks, which are $±\left(\frac{2}{3}\right){q}_{e}$ and $\left(\frac{1}{3}\right){q}_{e}$ , whereas all directly observed particles have charges that are integral multiples of ${q}_{e}$ . Note that the fractional value of the quark does not violate the fact that the e is the smallest unit of charge that is observed, because a free quark cannot exist. [link] lists characteristics of the six quark flavors that are now thought to exist. Discoveries made since 1963 have required extra quark flavors, which are divided into three families quite analogous to leptons.

## How does it work?

To understand how these quark substructures work, let us specifically examine the proton, neutron, and the two pions pictured in [link] before moving on to more general considerations. First, the proton p is composed of the three quarks uud , so that its total charge is $+\left(\frac{2}{3}\right){q}_{e}+\left(\frac{2}{3}\right){q}_{e}-\left(\frac{1}{3}\right){q}_{e}={q}_{e}$ , as expected. With the spins aligned as in the figure, the proton’s intrinsic spin is $+\left(\frac{1}{2}\right)+\left(\frac{1}{2}\right)-\left(\frac{1}{2}\right)=\left(\frac{1}{2}\right)$ , also as expected. Note that the spins of the up quarks are aligned, so that they would be in the same state except that they have different colors (another quantum number to be elaborated upon a little later). Quarks obey the Pauli exclusion principle. Similar comments apply to the neutron n , which is composed of the three quarks udd . Note also that the neutron is made of charges that add to zero but move internally, producing its well-known magnetic moment. When the neutron ${\beta }^{-}$ decays, it does so by changing the flavor of one of its quarks. Writing neutron ${\beta }^{-}$ decay in terms of quarks,

Why is the sky blue...?
It's filtered light from the 2 forms of radiation emitted from the sun. It's mainly filtered UV rays. There's a theory titled Scatter Theory that covers this topic
Mike
A heating coil of resistance 30π is connected to a 240v supply for 5min to boil a quantity of water in a vessel of heat capacity 200jk. If the initial temperature of water is 20°c and it specific heat capacity is 4200jkgk calculate the mass of water in a vessel
A thin equi convex lens is placed on a horizontal plane mirror and a pin held 20 cm vertically above the lens concise in position with its own image the space between the undersurface of d lens and the mirror is filled with water (refractive index =1•33)and then to concise with d image d pin has to
Be raised until its distance from d lens is 27cm find d radius of curvature
Azummiri
what happens when a nuclear bomb and atom bomb bomb explode add the same time near each other
A monkey throws a coconut straight upwards from a coconut tree with a velocity of 10 ms-1. The coconut tree is 30 m high. Calculate the maximum height of the coconut from the top of the coconut tree? Can someone answer my question
v2 =u2 - 2gh 02 =10x10 - 2x9.8xh h = 100 ÷ 19.6 answer = 30 - h.
Ramonyai
why is the north side is always referring to n side of magnetic
who is a nurse
A nurse is a person who takes care of the sick
Bukola
a nurse is also like an assistant to the doctor
explain me wheatstone bridge
good app
samuel
Wheatstone bridge is an instrument used to measure an unknown electrical resistance by balancing two legs of a bridge circuit, one leg of which includes the unknown component.
MUHD
Rockwell Software is Rockwell Automation’s "Retro Encabulator". Now, basically the only new principle involved is that instead of power being generated by the relative motion of conductors and fluxes, it’s produced by the modial interaction of magneto-reluctance and capacitive diractance. The origin
Chip
what refractive index
write a comprehensive note on primary colours
relationship between refractive index, angle of minimum deviation and angle of prism
Harrison
Who knows the formula for binding energy,and what each variable or notation stands for?
1. A black thermocouple measures the temperature in the chamber with black walls.if the air around the thermocouple is 200 C,the walls are at 1000 C,and the heat transfer constant is 15.compute the temperature gradient
what is the relationship between G and g
G is the u. constant, as g stands for grav, accelerate at a discreet point
Mark
Olaiya
pls explain in details
Olaiya
G is a universal constant
Mark
g stands for the gravitational acceleration point. hope this helps you.
Mark
balloon TD is at a gravitational acceleration at a specific point
Mark
I'm sorry this doesn't take dictation very well.
Mark
Can anyone explain the Hooke's law of elasticity?
extension of a spring is proportional to the force applied so long as the force applied does not exceed the springs capacity according to my textbook
Amber
does this help?
Amber
Yes, thanks
Olaiya
so any solid can be compressed how compressed is dependent upon how much force is applied F=deltaL
Amber
sorry, the equation is F=KdeltaL delta is the triangle symbol and L is length so the change in length is proportional to amount of Force applied I believe that is what Hookes law means. anyone catch any mistakes here please correct me :)
Amber
I think it is used only for solids and not liquids, isn't it?
Olaiya
basically as long as you dont exceed the elastic limit the object should return to it original form but if you exceed this limit the object will not return to original shape as it will break
Amber
Thanks for the explanation
Olaiya
yh, liquids don't apply here, that should be viscosity
Chiamaka
hope it helps 😅
Amber
also, an object doesnt have to break necessarily, but it will have a new form :)
Amber
Yes
Olaiya
yeah, I think it is for solids but maybe there is a variation for liquids? that I am not sure of
Amber
ok
Olaiya
good luck!
Amber
Same
Olaiya
aplease i need a help on spcific latent heat of vibrations
Bilgate
specific latent heat of vaporisation
Bilgate
how many kilometers makes a mile
Faizyab
Aakash
equal to 1.609344 kilometers.
MUHD