compute the cosine coefficient of two arrays
compute the binary cosine coefficient of two arrays
CosineCoefficient( v1, v2 )
BinaryCosineCoefficient( v1, v2 )
vector or list of integers
The cosine coefficient is a measure of similarity between two vectors.
In binary form, where the vectors contain 1's and 0's, the formula can be expressed in set notation.
Both v1 and v2 must be the same size.
In the context of text comparison, v1 and v2 could be a count of the occurrences of certain words within two essay sets. In the binary form v1 and v2 would contain 1 for the presence of a word, and 0 for its absence.
For positive integer counts, the Cosine and BinaryCosine coefficients will range from 0 to 1, where 1 is a perfect match, and 0 indicates no overlap. The higher the score in-between, the more similar the vectors.
The Binary form of this command will accept any vector as input and interpret all non-zero entries as 1s.
This function is part of the EssayTools package, so it can be used in the short form CosineCoefficient(..) only after executing the command with(EssayTools). However, it can always be accessed through the long form of the command by using EssayTools[CosineCoefficient](..).
Asimov ≔ The most exciting phrase to hear in science, the one that heralds new discoveries, is not 'Eureka!' but 'That's funny...':
Heisenberg ≔ It is not surprising that our language should be incapable of describing the processes occurring within the atoms, for, as has been remarked, it was invented to describe the experiences of daily life, and these consist only of processes involving exceedingly large numbers of atoms. Furthermore, it is very difficult to modify our language so that it will be able to describe these atomic processes, for words can only describe things of which we can form mental pictures, and this ability, too, is a result of daily experience. Fortunately, mathematics is not subject to this limitation, and it has been possible to invent a mathematical scheme - the quantum theory - which seems entirely adequate for the treatment of atomic processes; for visualization, however, we must content ourselves with two incomplete analogies - the wave picture and the corpuscular picture.:
Born ≔ The ultimate origin of the difficulty lies in the fact (or philosophical principle) that we are compelled to use the words of common language when we wish to describe a phenomenon, not by logical or mathematical analysis, but by a picture appealing to the imagination. Common language has grown by everyday experience and can never surpass these limits. Classical physics has restricted itself to the use of concepts of this kind; by analysing visible motions it has developed two ways of representing them by elementary processes; moving particles and waves. There is no other way of giving a pictorial description of motions -- we have to apply it even in the region of atomic processes, where classical physics breaks down.:
W ≔ CountUseOfEachWord⁡Asimov,Heisenberg,Born,science,language,atomic,describe,phrase,exciting,mathematical
allwords ≔ map⁡x→op⁡StringTools:-Words⁡x,Asimov,Heisenberg,Born
W ≔ CountUseOfEachWord⁡Asimov,Heisenberg,Born,allwords
The EssayTools[CosineCoefficient] and EssayTools[BinaryCosineCoefficient] commands were introduced in Maple 17.
For more information on Maple 17 changes, see Updates in Maple 17.
Download Help Document
What kind of issue would you like to report? (Optional)